Developer API

Developer API errors

The v2 error envelope, the common error codes with their HTTP status, operation failures, retry decisions and the retired v1 response.

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.

Example error
{
  "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

StatusMeaningWhat to do
400Invalid body, header, idempotency key or query value (each with its own code)Fix the request before retrying.
401Missing, malformed, expired or revoked keySend Authorization: Bearer with an active v2 key.
403The key lacks a required scope, or an organisation owner capped this member's monthly useUse a key with the scopes in details.requiredScopes, or ask an organisation owner to raise the cap (ORGANISATION_MEMBER_CAP_REACHED).
404Resource not found for this key's organisation, workspace and environmentCheck the ID and the key's environment.
409Revision conflict, key limit or a terminal workflow runRead the current state, then decide.
410The retired /api/v1 API was calledUse the /api/v2 replacement.
413Document larger than your plan's per-file limit or the single-request limit, or missing Content-LengthSend a smaller file with its exact length, or use the chunked upload above 100 MiB.
422Well-formed request the platform cannot carry out (unsupported tool, invalid resource fields, unsafe webhook URL)Change the input; an identical retry fails again.
429Request-unit balance (or the organisation's shared pool) exhaustedAdd request units; unmetered calls keep working.
500Unexpected service errorRetry with backoff when retryable is true and contact support with the referenceId if it repeats.
503The service is temporarily unavailableRetry 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.

HTTPCodeMeaningWhat to do
400REQUEST_BODY_INVALIDThe JSON body could not be decoded or has unknown fields.Fix the body against the operation's request schema.
400IDEMPOTENCY_KEY_INVALIDThe Idempotency-Key header or idempotencyKey field is missing or malformed.Send 8–200 letters, digits, period, underscore, colon or hyphen.
400DOCUMENT_ADMISSION_INVALIDFilename, 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.
400OPERATION_INPUT_INVALIDdocumentId, toolId or idempotencyKey is missing on POST /api/v2/document-operations.Send all three fields.
401AUTHENTICATION_REQUIREDThe bearer key is missing, malformed, expired or revoked.Send Authorization: Bearer with an active wf_v2_test or wf_v2_live key.
403SCOPE_FORBIDDENThe key lacks a scope the operation requires; details.requiredScopes lists them.Create or rotate to a key with those scopes.
404DOCUMENT_NOT_FOUNDNo 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.
404OPERATION_NOT_FOUNDNo operation with this ID exists for the key's organisation, workspace and environment.Use the operation ID returned when the operation was created.
409RESOURCE_REVISION_CONFLICTA resource update named a revision that is no longer current.Read the resource again and retry with its current revision.
410API_VERSION_RETIREDThe request used the retired /api/v1 API.Move the call to its /api/v2 replacement.
413DOCUMENT_SIZE_INVALIDContent-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.
413UPLOAD_TOO_LARGE_FOR_PLANThe 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.
422OPERATION_UNSUPPORTEDThe toolId is not a tool that document operations run.Use a toolId from /docs/developer-api/jobs-and-downloads, for example compress-pdf.
422RESOURCE_INPUT_INVALIDA template, signature request, annotation, form, Deal Room, portal or embed body failed validation.Fix the fields named in the message.
403ORGANISATION_MEMBER_CAP_REACHEDAn 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.
429API_REQUEST_UNITS_EXHAUSTEDThe 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.
500DOCUMENT_CREATE_FAILEDThe document could not be stored.Retry with the same idempotency key; it is marked retryable.
503BILLING_ADAPTER_UNAVAILABLERequest units could not be reserved right now.Retry with backoff and the same idempotency key.
503PLATFORM_TEMPORARILY_UNAVAILABLEThe 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

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.

Response to any /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.