Errors
The error format of the onefold HTTP API, every published error code with its meaning, and how OAuth endpoint errors differ.
onefold returns errors in two formats, one per family of endpoints. Branch on the machine-readable value in each; never on the human-readable text.
| Endpoints | Format | Branch on |
|---|---|---|
/api/v1/… | {"code": …, "detail": …} | code |
/o/… | {"error": …, "error_description": …}, as OAuth 2.0 defines | error |
API errors
{
"code": "validation_failed",
"detail": "…",
"fields": { "email": ["…"] }
}| Field | Present | Meaning |
|---|---|---|
code | Always | Stable and machine-readable. Codes are only ever added, never renamed. |
detail | Always | For people. Its wording can change at any time. |
fields | With validation_failed | Each field name mapped to its messages |
retry_after | With rate_limited and token_exchange_locked_out | Seconds to wait. Also sent as the Retry-After header. |
A request to a URL that matches no endpoint returns a plain 404 with no code.
Codes
code | Meaning |
|---|---|
api_key_application_not_found | The Onefold-Application header names no application this organization key reaches. |
api_key_application_required | An organization API key names the application it acts on in the Onefold-Application header, on every call. |
api_key_scope_missing | This API key does not carry the scope this endpoint needs. Add the scope to the key, or use a key that carries it, rather than retrying. |
attribution_not_entitled | This plan does not include campaign attribution. |
authentication_failed | The credential was presented and rejected — expired, revoked, or never valid. Do not retry; obtain a new one. |
bad_request | The request was refused. See detail for what was wrong with it. |
conflict | The request collided with the current state of the resource. |
feature_unavailable | This capability is not offered by this deployment. Retrying cannot succeed. |
former_users_not_entitled | This plan does not include former users. |
invalid_metadata | A key or value the store will not hold. detail says which. |
media_too_large | The file is larger than this plan's per-file upload limit. The image itself is fine; a higher plan raises the ceiling. |
metadata_too_large | The document is over the size cap. Refused whole rather than truncated. |
method_not_allowed | That HTTP method is not accepted on this path. |
not_acceptable | This endpoint cannot answer in any format the request will accept. |
not_authenticated | No credential was presented, or it was not readable. |
not_found | No such resource, or none this caller may see. The two are deliberately indistinguishable. |
parse_error | The request body could not be parsed. |
permission_denied | The credential is valid but does not reach this. Retrying with the same one cannot succeed. |
profile_edit_not_consented | The person has not granted this application profile:edit, so it cannot change their profile. |
profile_field_hidden | That field is hidden, by the organization or by this application's profile configuration. |
profile_field_invalid | The profile field, its requirement, or the value given for it was rejected. |
profile_field_not_found | No such custom profile field, or none the caller may read: unknown, removed, or another application's. |
profile_field_read_only | The caller reads that custom profile field and may not change it. |
profile_section_hidden | That section is hidden, by the organization or by this application's profile configuration. |
rate_limited | Over the request budget. retry_after is the number of seconds to wait, and is also sent as the Retry-After header. Back off and retry — this one is temporary. |
server_error | Something failed on this side. Safe to retry. |
service_unavailable | A dependency this request needed did not answer. Inconclusive rather than failed — retry shortly. |
session_not_found | No such session is visible to you: it is not the person's, it has been signed out, or none of your tokens were authorized in it. |
signup_field_invalid | The question, or the answer to it, was rejected. |
signup_fields_required | Some of these answers are required and cannot be skipped. |
signup_prompt_already_submitted | These answers were already submitted. |
signup_prompt_expired | The sign-up form expired. Start again from the application. |
signup_prompt_invalid | The sign-up form no longer refers to anything. |
token_exchange_locked_out | Too many token exchanges from this address were refused for a bad client secret, so this one was not evaluated. Retry-After carries the remaining window. Retrying with the same secret cannot succeed — check your credentials. |
unprocessable_image | That image could not be decoded, cropped or re-encoded — an unsupported format, an empty crop, or a file past the edge, frame or pixel budget. |
unsupported_media_type | The request's Content-Type is not accepted here. |
validation_failed | One or more fields were rejected. fields maps each field name to its messages, and detail repeats the first of them. |
Each endpoint page in this reference lists the codes that endpoint can return.
By status
| Status | Codes | What to do |
|---|---|---|
400 | api_key_application_required, bad_request, invalid_metadata, metadata_too_large, parse_error, profile_field_hidden, profile_field_invalid, profile_field_not_found, profile_field_read_only, signup_field_invalid, signup_fields_required, signup_prompt_expired, signup_prompt_invalid, unprocessable_image, validation_failed | Fix the request. Retrying it unchanged fails again. |
401 | authentication_failed, not_authenticated | Send a credential, or get a new one. |
403 | api_key_scope_missing, attribution_not_entitled, former_users_not_entitled, permission_denied, profile_edit_not_consented | The credential is valid and does not reach this. Do not retry. |
404 | api_key_application_not_found, feature_unavailable, not_found, profile_section_hidden, session_not_found | The resource does not exist, or your credential cannot see it. |
405, 406, 415 | method_not_allowed, not_acceptable, unsupported_media_type | Fix the method or the headers. |
409 | conflict, signup_prompt_already_submitted | The request conflicts with current state. |
413 | media_too_large | Send a smaller file. |
429 | rate_limited, token_exchange_locked_out | Wait retry_after seconds, then retry. |
500, 503 | server_error, service_unavailable | Retry with backoff. |
The two 401 codes are told apart below. A 429 is explained in
Rate limits.
The two 401 codes
| Code | Meaning | What to do |
|---|---|---|
not_authenticated | No credential was sent, or it could not be read | Send Authorization: Bearer … |
authentication_failed | The credential is expired, revoked or was never valid | For an access token, refresh it. For an API key, use a current one. |
404 is also "not yours"
The management API answers 404 for a user who has not authorized your application, exactly
as for a user who does not exist. The two are deliberately indistinguishable.
OAuth errors
The endpoints under /o/ use the OAuth 2.0 error format:
{ "error": "invalid_grant", "error_description": "…" }| Where | Errors | Reference |
|---|---|---|
| Your callback, as query parameters | access_denied, invalid_scope, invalid_request, login_required | Authorization request and callback |
| The token endpoint | invalid_grant, invalid_request, invalid_client, invalid_target | Token exchange |
The token endpoint's two 429 responses are the exception: they use the API format, with
code, because OAuth 2.0 defines no error for them.
For symptoms and fixes, see Troubleshooting.