View as Markdown

Errors

Every response has the same envelope. A failure carries a stable code you can branch on and a message written for a person.

The envelope

A successful response puts the result in data:

200
{
  "data": { "id": "0b8f6c1e-3d2a-4a57-9c41-7e5d2f8a1b90" },
  "_agent": { "summary": "created customer", "status": "ok", "next_actions": [], "warnings": [] },
  "api_version": "2026-07-01"
}

A failure puts the reason in error:

422
{
  "error": { "code": "validation_failed", "message": "success_url: must be an https URL" },
  "_agent": { "summary": "success_url: must be an https URL", "status": "error", "next_actions": [], "warnings": [] },
  "api_version": "2026-07-01"
}
  • error.code is stable. Branch on it, never on the message.
  • error.message is for people and logs. It can change.
  • error.details is present on some errors and holds facts about the refusal, such as earliest_effective_at on effective_at_too_soon.
  • _agent is a short plain-language summary of what happened, for AI agents calling the API. warnings is worth logging: it is where the API says a secret will not be shown again.

Money in any response is a string of whole minor units, such as "1999".

Status codes

StatusMeaning
200, 201, 202Done, created, or accepted to be processed shortly.
400The request cannot be read: the body is not valid JSON, or something required is missing, such as a required Idempotency-Key.
401No valid key or session.
402Your workspace is over its GlobalyMint plan's monthly billed-volume limit, so new live subscriptions are paused until it upgrades.
403The key or role is not allowed to do this.
404No such route or resource in this workspace and mode.
409The request conflicts with the current state.
422The request was understood and refused.
413The request body is too large.
415The Content-Type is not supported. Send application/json.
429Too many requests. Wait for Retry-After seconds.
500Our fault. Safe to retry with the same idempotency key.

Common codes

CodeStatusWhat to do
unauthorized401Send a valid key. Check that it is not revoked or expired, and that it matches the mode you expect.
forbidden403The message names the missing scope or role. See Scopes.
tenant_suspended403The workspace is suspended. Contact us.
not_found404Check the id and the mode. A test key cannot see live data.
validation_failed422The message starts with the field that failed.
unprocessable422The request is well formed but cannot be carried out; the message says why.
conflict409The thing already exists, or the same reference was used with different values.
invalid_transition409The resource is not in a state that allows this, such as voiding a paid invoice.
idempotency_key_required400Add an Idempotency-Key header. See Idempotency.
idempotency_key_reused409The key was used before with a different body. Use a new key for a new operation.
idempotency_in_progress409The first request with this key is still running. Retry shortly with the same key.
idempotency_outcome_unknown409The first request with this key started over 2 hours ago and never finished. Check whether it took effect; if not, retry with a new key. See Idempotency.
idempotency_key_invalid400The key starts with the reserved prefix internal:. Choose another key.
invalid_json400The body is not valid JSON.
payload_too_large413The body is too large.
unsupported_media_type415The Content-Type is not supported. Send application/json.
rate_limited429Wait for Retry-After seconds. See Rate limits.
internal_error500Retry. If it continues, send us the request id.

Some operations have their own codes. The ones you are most likely to meet:

CodeStatusWhen
gateway_not_configured422No Stripe credentials are saved for this mode.
currency_locked409A customer's currency cannot change once they have been billed.
invoice_already_paid409A payment was recorded on an invoice that is already settled.
amount_mismatch422A recorded payment is not exactly the amount due.
currency_mismatch422A one-off invoice names a currency that is not the customer's.
plan_not_one_time422A one-off invoice line names a recurring plan.
promotion_code_invalid422The promotion code does not apply.
items_locked422A checkout created with lock_items was asked to change its items.
change_not_allowed422The product's portal settings do not allow this change.
session_closed409The checkout session is complete or expired.
payment_method_not_ready422The payment method has not been confirmed yet.
effective_at_too_soon422A price change must be at least 30 days away.
plan_limit_reached402A new live subscription was refused because your workspace is over its plan's billed-volume limit and the grace period has ended. Existing subscriptions keep renewing; test mode is never refused. Upgrade under Settings › Plan and billing.
not_replayable422A webhook delivery cannot be replayed: the endpoint is disabled (enable it first), it was a test event, or the event is older than 30 days.
insufficient_credits409The customer's credit pool cannot cover the amount.

Check a request without running it

Many write endpoints accept ?dry_run=true. The body is validated and nothing is executed; a valid request answers 200 with { "dry_run": true, "valid": true }, and an invalid one answers 422 as usual. An endpoint that does not support it ignores the parameter and runs the request, so try it in test mode first.

In the SDK

Every error extends MintError, which has code and message.

ClassWhen
MintApiErrorAny non-2xx response. Has status, code, message, requestId and details.
AuthenticationError401
ForbiddenError403
NotFoundError404
ValidationError400 and 422
InsufficientCreditsError409 insufficient_credits
RateLimitError429. Has retryAfterSeconds.
MintConnectionErrorNo HTTP answer: a network error or a timeout.
PlanLimitErrorThrown by Entitlements#assert, never by the network.
WebhookVerificationErrorA webhook failed verification.

On this page