API reference
Response formats
Read the JSON envelope, request IDs, value types, and billing metadata that responses share.
Most operations return a JSON envelope: data and meta on success, error and meta on failure. This page describes the shared parts. The payload of each operation is in its API reference page.
Envelope
The shapes below show the envelope only, not the payload of a particular operation.
{"data": {}, "meta": {"request_id": "req_example"}}{"error": {"code": "validation_error", "message": "Invalid request."}, "meta": {"request_id": "req_example"}}- Use
error.codefor program logic. Messages can change. - The
X-Request-IDresponse header matchesmeta.request_id. Keep it for troubleshooting.
Value types
| Value | Format |
|---|---|
| Money and rates | Decimal strings |
| Credits | Integers |
| Optional values | null has a field-specific meaning. Do not convert every null to zero. |
Billing and paging metadata
| Field | Meaning |
|---|---|
meta.billable | Whether the request uses credit billing. |
meta.credit.cost | Credits charged. A charged response can include it. |
meta.credit.remaining | Remaining credits, estimated under concurrent use. |
meta.page | Present when the response lists a page. Contains limit, has_next, and next_cursor. |
GET /me returns account totals in data.credit instead.
Exceptions
- The export body is the document itself. Read billing from the
X-Billable,X-Credit-Cost, andX-Credit-Remainingheaders. - A
304response has no body. - Health and other documented exceptions follow their operation schema.
Next, see errors or read price data.