REST API
On this page
Both SDKs are thin clients of Tenth's REST API. Call it directly from any language. The full reference, with every endpoint, field and response, is the OpenAPI document for the public API.
Base URL
The base URL is https://api.tenthbilling.com, and every endpoint is under /v1. Requests and responses are JSON, and errors are RFC 7807 problem bodies (see Errors).
Authentication
Send an API key as a bearer token. Here the secret key (tenth_test_sk_...) is in the TENTH_SECRET_KEY environment variable:
curl https://api.tenthbilling.com/v1/customers/user_123/entitlements \
-H "Authorization: Bearer $TENTH_SECRET_KEY"
The key decides the app and the environment, so there's nothing else to send. Test keys only see test data and live keys only see live data.
| Key | Where | What it can do |
|---|---|---|
Secret (tenth_test_sk_..., tenth_live_sk_...) | Your server only | Act for any customer of the app: read state, spend credits, give grants, manage Stripe subscriptions, read the event feed. |
Publishable (tenth_test_pk_..., tenth_live_pk_...) | Apps | Act only for one customer, named by a customer token or an anonymous ID (below). |
Customers in the path
Customer endpoints take the customer's app_user_id in the path, URL-encoded: /v1/customers/{app_user_id}/....
With a publishable key, use me instead, and say who the customer is with one of these headers:
| Header | Value |
|---|---|
X-Customer-Token | The signed-in user's token from your identity provider, or a token your server minted. See Customer identity. |
X-Anonymous-Id | An anonymous ID the Expo SDK generated ($tenth_anon_...). |
A publishable key can't name another customer. Calls that would cost you money or touch other customers need a secret key and fail with secret_key_required otherwise.
What's in the API
| Area | Endpoints (all under /v1) |
|---|---|
| Customers and access | GET /customers/{id}, GET /customers/{id}/entitlements, PATCH /customers/{id}, POST /customers/{id}/alias, DELETE /customers/{id}, GET /customers/{id}/export |
| Credits | GET /customers/{id}/credits, POST /customers/{id}/credits/{type}/debit and /reserve, POST /customers/{id}/credits/{type}/holds/{hold}/commit and /release |
| Grants | POST /customers/{id}/grants, DELETE /grants/{id} |
| Offerings | GET /offerings/current, GET /offerings/{key} |
| Stripe | POST /checkout-sessions, POST /payment-intents, POST /subscriptions/{id}/change, /cancel, /resume and /anchor, POST /purchases/{id}/refund, GET /customers/me/management-url |
| Store purchases | POST /receipts, POST /receipts/restore, POST /apple/offer-signatures |
| Feeds | GET /events, GET /revenue/transactions |
The Node SDK reference describes each call and its body. The OpenAPI document has the exact paths and schemas.
Idempotency
Send an Idempotency-Key header (1 to 255 printable ASCII characters) on any POST, PATCH or DELETE. Tenth stores the first response for that key and caller:
- the same key with the same request returns the stored response, with the header
Idempotent-Replayed: true; - the same key with a different request fails with
idempotency_key_reused; - the same key while the first request is still running fails with
conflict; retry shortly with the same key.
Use one key per piece of work, and reuse it only to retry that work. Credit spends also take an idempotency_key in the body, which keeps a spend from ever applying twice.
Pagination
Lists such as GET /v1/events and GET /v1/revenue/transactions return { data, has_more }, oldest first. Pass the last ID you received as after to get the next page. limit is 1 to 100 (default 50).
Rate limits
Requests over a limit get 429 rate_limited with a Retry-After header. Stay under these:
| Scope | Limit |
|---|---|
| Per client IP address | 1,200 requests a minute |
| Per API key | 6,000 requests a minute |
| Per customer (publishable-key calls) | 120 requests a minute |
| Checkouts and payment forms | 30 per customer an hour |
| Receipts and restores | 120 per customer an hour |
| App Store promotional offer signatures | 30 per customer an hour |
| New anonymous customers | 200 per app, environment and IP an hour |
| Stripe actions (refunds, subscription changes) | 2,000 per app an hour |
| Webhook test events | 60 per endpoint an hour |
| Webhook replays | 2,000 per endpoint an hour |
Windows are fixed (they reset each minute or hour). If you need more, contact support.
Versioning
The API is versioned in the path (/v1), and webhook payloads carry a dated version (currently 2026-10-25).
- Within v1, changes are additive. New endpoints, new optional request fields, new response fields, new error codes and new webhook event types can appear at any time. Ignore fields and event types you don't know, and branch on error
code. - Breaking changes get a new version. Removing or renaming a field, changing its type or meaning, or making an optional field required ships as a new dated version (or
/v2). The old one keeps working. - Deprecation: a version is supported for at least 6 months after its replacement is announced, with notice by email to workspace owners and in the changelog. TODO(owner): confirm notice period.
- Error codes are never renamed or reused.