Response shape
Every v2 error response has one envelope: an error object with a stable code, a safe message, the referenceId that support can look up (also sent as the X-Wellfriend-Reference-Id header), and retryable. Some codes add a details object, such as requiredScopes or maximumBytes.
{
"error": {
"code": "SCOPE_FORBIDDEN",
"message": "The bearer key does not include every required scope.",
"referenceId": "ref_8f2c41d7a9e34b10",
"retryable": false,
"details": { "requiredScopes": ["documents.process"] }
}
}Common statuses
| Status | Meaning | What to do |
|---|---|---|
| 400 | Invalid body, header, idempotency key or query value (each with its own code) | Fix the request before retrying. |
| 401 | Missing, malformed, expired or revoked key | Send Authorization: Bearer with an active v2 key. |
| 403 | The key lacks a required scope, or an organisation owner capped this member's monthly use | Use a key with the scopes in details.requiredScopes, or ask an organisation owner to raise the cap (ORGANISATION_MEMBER_CAP_REACHED). |
| 404 | Resource not found for this key's organisation, workspace and environment | Check the ID and the key's environment. |
| 409 | Revision conflict, key limit or a terminal workflow run | Read the current state, then decide. |
| 410 | The retired /api/v1 API was called | Use the /api/v2 replacement. |
| 413 | Document larger than your plan's per-file limit or the single-request limit, or missing Content-Length | Send a smaller file with its exact length, or use the chunked upload above 100 MiB. |
| 422 | Well-formed request the platform cannot carry out (unsupported tool, invalid resource fields, unsafe webhook URL) | Change the input; an identical retry fails again. |
| 429 | Request-unit balance (or the organisation's shared pool) exhausted | Add request units; unmetered calls keep working. |
| 500 | Unexpected service error | Retry with backoff when retryable is true and contact support with the referenceId if it repeats. |
| 503 | The service is temporarily unavailable | Retry with backoff and the same idempotency key. |
Common error codes
Each operation's possible responses are listed in /docs/api/openapi.json. These are the codes integrations meet most often.
| HTTP | Code | Meaning | What to do |
|---|---|---|---|
| 400 | REQUEST_BODY_INVALID | The JSON body could not be decoded or has unknown fields. | Fix the body against the operation's request schema. |
| 400 | IDEMPOTENCY_KEY_INVALID | The Idempotency-Key header or idempotencyKey field is missing or malformed. | Send 8–200 letters, digits, period, underscore, colon or hyphen. |
| 400 | DOCUMENT_ADMISSION_INVALID | Filename, title, content type, checksum or idempotency key on POST /api/v2/documents is invalid. | Send X-Wellfriend-Filename, Content-Type and a valid Idempotency-Key. |
| 400 | OPERATION_INPUT_INVALID | documentId, toolId or idempotencyKey is missing on POST /api/v2/document-operations. | Send all three fields. |
| 401 | AUTHENTICATION_REQUIRED | The bearer key is missing, malformed, expired or revoked. | Send Authorization: Bearer with an active wf_v2_test or wf_v2_live key. |
| 403 | SCOPE_FORBIDDEN | The key lacks a scope the operation requires; details.requiredScopes lists them. | Create or rotate to a key with those scopes. |
| 404 | DOCUMENT_NOT_FOUND | No document with this ID exists for the key's organisation, workspace and environment. | Check the ID and that the key's environment matches the one that created it. |
| 404 | OPERATION_NOT_FOUND | No operation with this ID exists for the key's organisation, workspace and environment. | Use the operation ID returned when the operation was created. |
| 409 | RESOURCE_REVISION_CONFLICT | A resource update named a revision that is no longer current. | Read the resource again and retry with its current revision. |
| 410 | API_VERSION_RETIRED | The request used the retired /api/v1 API. | Move the call to its /api/v2 replacement. |
| 413 | DOCUMENT_SIZE_INVALID | Content-Length is missing or above the single-request limit (details.maximumBytes, 100 MiB). | Send the exact byte length, or use the chunked upload (details.uploadsUrl, POST /api/v2/uploads) for a larger file. |
| 413 | UPLOAD_TOO_LARGE_FOR_PLAN | The file is above your plan's per-file limit (details.limitBytes, details.plan). | Send a smaller file or move to a plan with a higher limit. |
| 422 | OPERATION_UNSUPPORTED | The toolId is not a tool that document operations run. | Use a toolId from /docs/developer-api/jobs-and-downloads, for example compress-pdf. |
| 422 | RESOURCE_INPUT_INVALID | A template, signature request, annotation, form, Deal Room, portal or embed body failed validation. | Fix the fields named in the message. |
| 403 | ORGANISATION_MEMBER_CAP_REACHED | An organisation owner capped this member's monthly use and it is reached (details.cap, details.used). | Ask an organisation owner to raise the cap, or wait for the next month. |
| 429 | API_REQUEST_UNITS_EXHAUSTED | The Developer request-unit balance, or the organisation's shared pool (details.pool organisation), cannot cover a metered operation. | Add request units or wait for the next allowance; an identical retry fails until then. |
| 500 | DOCUMENT_CREATE_FAILED | The document could not be stored. | Retry with the same idempotency key; it is marked retryable. |
| 503 | BILLING_ADAPTER_UNAVAILABLE | Request units could not be reserved right now. | Retry with backoff and the same idempotency key. |
| 503 | PLATFORM_TEMPORARILY_UNAVAILABLE | The service could not check the key or accept the request right now; the key itself is not at fault. | Retry after the Retry-After header (2 s) with the same idempotency key. |
Error: API version retired
Every request to /api/v1 returns HTTP 410 with code API_VERSION_RETIRED, retryable false, a replacement of /api/v2/ and a docsUrl. The request is not processed and is never charged. Move the call to its v2 replacement (see the migration table on /docs/developer-api) and create a v2 key; v1 key pairs are not accepted by v2.
/api/v1 request{
"error": {
"code": "API_VERSION_RETIRED",
"message": "API v1 has been retired. Use /api/v2/ instead.",
"retryable": false,
"referenceId": "ref_8f2c41d7a9e34b10",
"replacement": "/api/v2/"
}
}Operation failures
A document operation that ends as failed or cancelled is not an HTTP error: GET /api/v2/document-operations/{operationId} returns 200 with the state, and failed operations carry errorCode and errorMessage.
Retry decisions
- Retry only when error.retryable is true, after any Retry-After delay, with exponential backoff and a retry limit.
- Do not retry 400, 401, 403, 404, 413 or 422 without changing the request, key, scopes or input.
- For network uncertainty after a create call, retry with the same idempotency key instead of sending a request with a new key.
- For a failed operation, read errorCode and decide whether to create a new operation with changed input.
Troubleshooting
- 401 and 403: fix the key or its scopes; retrying the same request will not help.
- 400, 413 and 422: show the problem next to the input that caused it.
- 429 and 503: retry only when error.retryable is true, after any Retry-After delay.
- Log the error code and referenceId. Support can find a request by its referenceId without seeing your file.