Errors, retries and idempotency
The error envelope, every code you can receive, and how to retry each one without making things worse.
The envelope
One error shape covers the platform. Everything under /appcenter/v3 — the Application API, webhook self-service, the admin surface — answers an error as { success: false, error: { code, message, fields?, details? } }. The OpenID Connect endpoints are the only exception: they answer the RFC 6749 shape, { error, error_description }. fields is the validation slot, one dotted path per issue; details carries anything else and can never override code, message or fields. Branch on the status and on error.code, never on message.
{
"success": false,
"error": {
"code": "app_not_bound",
"message": "This OAuth client is not linked to an application. Ask an App Center administrator to assign it."
}
}{
"success": false,
"error": {
"code": "VALIDATION_FAILED",
"message": "Provide exactly one of email, emails or uuids",
"fields": [
{ "path": "email", "message": "Provide exactly one of email, emails or uuids" }
]
}
}{
"success": false,
"error": {
"code": "RATE_LIMITED",
"message": "Too many requests for this application, please try again later."
}
}The limiter renders through the same helper as every other rejection. Retry-After is sent as a header, not a body field.
{
"error": "invalid_target",
"error_description": "requested resource is not configured for this client"
}Status codes are real: a non-2xx answer is a failure, and an HTTP client that throws on error status is doing the right thing. message is for humans and for logs; error.code is what you branch on. A 401 is the bearer middleware refusing before any route logic runs, so its code is always UNAUTHENTICATED.
Codes
VALIDATION_FAILED- Status422
- MeaningA path, query or body failed validation.
error.fields[]names every offending field - Retry?No
UNAUTHENTICATED- Status401
- MeaningNo bearer token, or an expired one. Refused before any route logic runs
- Retry?Refresh, then once
service_token_required- Status403
- MeaningThe request did not carry an
:servicetoken — a user token was used on/app/* - Retry?No
app_not_bound- Status403
- MeaningThe client is inactive, or not linked to an application
- Retry?No
NOT_FOUND- Status404
- MeaningThe record does not exist. The
messagedistinguishesUser does not exist,Account not foundandWebhook not found - Retry?No
CONFLICT- Status409
- MeaningA uniqueness or state conflict — that webhook URL is already registered
- Retry?Usually no
VERSION_CONFLICT- Status409
- MeaningThe
versionyou sent is stale; someone else wrote first - Retry?Re-read, merge, retry once
webhook_limit_reached- Status409
- MeaningThe per-application webhook cap of 10 is reached
- Retry?No
RATE_LIMITED- Status429
- MeaningMore than 600 requests a minute from one service client
- Retry?Yes, honouring
Retry-After invalid_request- Status400
- MeaningOIDC only: the authorize or token request is malformed — missing PKCE, unknown grant
- Retry?No
invalid_target- Status400
- MeaningOIDC only: the requested resource audience is not assigned to the client
- Retry?No
invalid_grant- Status400
- MeaningOIDC only: code or refresh token rejected, expired or already used
- Retry?Sign in again
invalid_client- Status401
- MeaningOIDC only: unknown client, or the secret did not match
- Retry?No
INTERNAL_ERROR- Status5xx
- MeaningPlatform fault.
messageis deliberately generic in production - Retry?Yes, with backoff
Why the codes are inconsistent in case
The shared SCREAMING_SNAKE codes (NOT_FOUND, VALIDATION_FAILED, VERSION_CONFLICT) come from the platform's own error table; the lowercase ones (app_not_bound, service_token_required, webhook_limit_reached, rate_limited) were defined by the application surface. Match them exactly — not_found is not NOT_FOUND.
Retry policy by category
- Never retry a
4xxother than429. A validation error does not become valid. - Retry once on
VERSION_CONFLICT— after re-reading the record, or the second attempt conflicts too. - Retry with backoff on
429and5xx, honouringRetry-Afterwhen it is present. - Do not retry a rotation or a credential operation blindly: they are not idempotent in the way you expect, and a doubled rotation invalidates the secret you just stored.
Idempotency
- Reads are safe. Writes that carry a
versionare effectively compare-and-swap. - Webhook deliveries are deduplicated by delivery id — see Webhooks.
- Transfers and deletion requests are idempotent per operation id, so a retry after a timeout is the correct move.
Something here out of date or unclear?
The platform team answers integration questions directly.
