Introduction

Billing infrastructure for usage-based pricing

View as Markdown

Afternoon is a billing platform that helps you meter usage, manage customers and subscriptions, and generate invoices. The Afternoon API gives you programmatic access to every part of the billing lifecycle.

Core concepts

ConceptDescription
CustomersThe people or organizations you bill. Each customer can have billing and shipping addresses, an external ID for mapping to your system, and one or more subscriptions.
SubscriptionsLink a customer to a plan. Subscriptions track status, billing anchor day, and renewal dates.
InvoicesItemized bills sent to customers. Invoices follow a lifecycle from draft to open to paid (or void / uncollectible). Line items can be added, updated, and removed while in draft.
EventsBillable usage events you send to Afternoon. Events are identified by an idempotency key and processed asynchronously via a durable queue.

How it works

1

Send usage events

Instrument your application to send billable events to the /v1/events/ingest endpoint whenever metered activity occurs (API calls, compute time, storage, etc.).

2

Manage customers and subscriptions

Create customers and attach them to plans via subscriptions. Afternoon tracks billing periods and renewal dates automatically.

3

Generate invoices

Create draft invoices, add line items, and finalize them to assign an invoice number and open them for payment. Afternoon provides a hosted payment page for each finalized invoice.

API design

The Afternoon API follows these conventions:

  • Base URLhttps://api.afternoon.co
  • Authentication — Bearer token via API key (see Authentication)
  • Content type — All request and response bodies are application/json
  • Pagination — List endpoints use cursor-based pagination with limit and cursor query parameters
  • Error format — Errors return { success: false, error: { code, message }, request_id }
  • Rate limiting — 1,000 requests per minute per company. Rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset) are included on every response.

Next steps