Errors
On this page
When a request fails, the Tenth API responds with an RFC 7807 problem body (content type application/problem+json):
{
"type": "https://tenthbilling.com/docs/errors#insufficient_credits",
"title": "insufficient credits",
"status": 409,
"code": "insufficient_credits",
"detail": "This customer has 10 ai_tokens available; the debit needs 25.",
"request_id": "req-..."
}
| Field | Description |
|---|---|
type | A link to this page, at the code's section. |
title | The code with spaces instead of underscores. |
status | The HTTP status. |
code | The stable error code. Codes are never renamed or reused. |
detail | A readable explanation. Optional. |
request_id | The request's ID. Quote it to support. Optional. |
errors | Field-level issues, such as [{ "path": "...", "message": "..." }] on a validation_failed. Optional. |
Branch on code, never on detail. The wording of detail can change at any time; code can't.
Responses with status 429, and most with 503, carry a Retry-After header with the number of seconds to wait.
In the SDKs
- Node: failed calls throw
TenthError, withstatus,code,detail,requestId,errorsandretryAfterSeconds. The SDK already retries 429 and 5xx responses, honoringRetry-After. See Node SDK errors. - Expo: errors are
TenthSdkErrors, withcode,message(a sentence you can show the customer),statusandrequestId. Purchases and restores never throw; their failures carrycodeandmessage. See Expo SDK errors.
Each SDK also has a few codes of its own, for errors raised before a request reaches Tenth (such as network_error and timeout). Those are listed on the SDK pages.
Requests
bad_request
400. The request couldn't be read: malformed JSON, an invalid Idempotency-Key header, or a call that doesn't fit the key, such as using me with a secret key. Body-level problems from the server framework, like a body that's too large or an unsupported content type, also use this code, with their own HTTP status (such as 413 or 415). Fix the request using detail.
validation_failed
422. A field is missing or invalid, or the request isn't allowed for this object, such as refunding more than remains or changing an App Store subscription from your server. errors lists the fields when there are any. Fix the input; retrying the same request fails the same way.
not_found
404. The route, or the object you named, doesn't exist in this app and environment. Tenth returns the same error for objects that belong to someone else. Check the ID, and that you're using the right key for the environment.
conflict
409. The object isn't in a state that allows this: a hold that's already committed or released, a grant that's already revoked, a purchase that's already fully refunded, or a request with the same Idempotency-Key still in progress. Read the object's current state; for an in-progress request, retry shortly with the same key.
idempotency_key_reused
422. You reused an idempotency key (the Idempotency-Key header, or a credit spend's idempotency_key) with a different request. Use a new key for each distinct request, and the same key only when retrying the same one.
rate_limited
429. Too many requests for this key, customer or client. Wait for the number of seconds in Retry-After, then retry. The limits are listed in Rate limits.
internal_error
500. Something failed on Tenth's side. Retry the request. If it keeps failing, contact support with the request_id.
Keys and authentication
invalid_api_key
401. The Authorization header is missing, isn't a Tenth API key, or names a key that doesn't exist. Send Authorization: Bearer tenth_... with a key copied from the dashboard.
api_key_revoked
401. The key was revoked. Create a new key in the dashboard and deploy it.
secret_key_required
403. The endpoint needs a secret key, and you sent a publishable key. Call it from your server with @tenthbilling/node, never from an app.
customer_token_required
401. A publishable-key call needs to know which customer it's for, and the request had neither X-Customer-Token (the signed-in user's token) nor X-Anonymous-Id. The Expo SDK sends one of these for you; if you call the API directly, add one.
customer_token_invalid
401. The customer token or anonymous ID was refused: not a JWT, expired or badly signed, issued to an origin the app doesn't accept, missing its user ID claim, or the app has no identity provider (or server-minted tokens) set up. Check the app's Identity page in the dashboard, and that the token is fresh.
forbidden
403. The key can't do this. A publishable key can only act for the signed-in customer (use me) and can only merge an anonymous ID into that customer. Do anything else from your server with a secret key.
origin_not_allowed
403. A browser request came from an origin that isn't one of the app's web origins. Add the origin under Settings → Web → Web origins in the dashboard.
environment_mismatch
403. Reserved for requests that mix the test and live environments. Make sure the key's environment matches the objects you name.
Purchases and credits
receipt_invalid
422. The App Store or Google Play doesn't recognize the transaction for this app and environment. Retrying won't help; on iOS, the Expo SDK finishes the transaction so it isn't sent again. It does the same for receipt_belongs_to_other_customer and validation_failed, and leaves every other failure unfinished so it's sent again (see How purchases work). Check that the purchase was made for this app, and with a key for the matching environment.
receipt_belongs_to_other_customer
409. The purchase is already recorded for a different customer of this app. Restore purchases, which applies the app's transfer policy, or sign in to the original account.
store_unavailable
503. Apple, Google or Stripe couldn't be reached or failed, or that provider isn't available on this deployment. The purchase isn't lost. Retry after Retry-After when it's present.
provider_not_connected
422. The app has no working connection to the provider this needs: no App Store, Google Play or Stripe connection for the environment, a connection that was removed, or credentials the provider now refuses. Fix the connection in the dashboard under Connections.
insufficient_credits
409. The customer doesn't have enough available credits for the debit or hold. Show them a way to buy more. Credits held by open reservations don't count as available.
client_debit_not_allowed
403. The app tried to spend credits with a publishable key, and this credit type doesn't allow spending from the app. Spend from your server with tenth.credits.debit, or allow app-side spending in the credit type's settings.
client_debit_limit_exceeded
422. An app-side debit asked for more than the credit type allows per call from the app. Spend smaller amounts, or spend from your server.
customer_alias_conflict
409. The app user ID you tried to alias already belongs to another customer, and the app's merge policy is reject. Pick a different merge policy for the call, or leave the customers separate.
anchor_not_supported_for_store
422. A fixed billing day was set on a product that isn't sold through Stripe. Only Stripe subscriptions can bill on a fixed day; App Store and Google Play set their own renewal dates.
Dashboard and workspace
These come from the dashboard's management API. You'll usually see them as messages in the dashboard.
unauthenticated
401. No dashboard session, an expired one, or a provider webhook with an invalid signature. Sign in again.
tenant_required
400. The request didn't name a workspace in X-Tenth-Tenant, or the value isn't a workspace ID.
not_a_member
403. You aren't a member of that workspace. Ask one of its owners or admins for an invitation.
insufficient_role
403. Your role can't do this, such as an admin granting the owner role or a non-admin including customer email in an export. Ask an owner or admin.
invitation_invalid
400. The invitation link is invalid or expired, or it's for a different email address. Ask for a new invitation, or sign in with the invited address.
in_use
409. You tried to delete something that's still in use: an entitlement that products or grants use, a credit type customers hold, or an image a paywall uses. Remove it from those first.
paywall_asset_limit_reached
409. The app already has the maximum number of paywall images for this environment. Delete unused images first.
export_too_large
422. An export job stopped because the export is over the size limit (10 million rows or 1 GiB compressed). This shows as the export's failure reason in the dashboard rather than as a response to a request. Choose a shorter date range or fewer apps.
billing_read_only
402. The workspace's Tenth invoice is more than 30 days unpaid, so the dashboard is read-only. Pay the invoice or add a payment method on the Billing page. Your customers and your app aren't affected.
billing_not_configured
503. Tenth's own billing isn't set up on this deployment, so there's nothing to pay yet.
signups_open
409. You tried to join the waitlist, but sign-ups are open. Sign up instead.
signups_closed
409. Sign-ups are by invitation only, so there's no waitlist to join.
waitlist_unavailable
503. The waitlist couldn't be reached. Submitting again is safe; wait for Retry-After first.