Skip to main content

Error Response Format

When a request fails, the API returns a JSON object with an error key. The value is either a single string or an array of strings describing what went wrong. Single error:
Multiple errors (typically validation failures):

HTTP Status Codes

Error Examples by Status Code

400 Bad Request

401 Unauthorized

403 Forbidden

Standard permission error:
Plan limit reached (includes an upgrade URL):

404 Not Found

422 Unprocessable Entity

429 Too Many Requests

The response also includes the following headers:

500 Internal Server Error

Rate Limits

The DocuTrust API enforces rate limits to ensure fair usage and platform stability. When you exceed the limit, the API returns a 429 Too Many Requests response. The Retry-After header tells you how many seconds to wait before retrying.

Rate Limit Headers

Every API response includes rate limit headers so you can track your usage proactively:

Plan Limits

Some API actions are restricted by your account’s subscription plan. When you exceed a plan limit, the API returns a 403 Forbidden response that includes an upgrade_url field pointing to your billing page:
Common plan-limited resources include:
  • Monthly submission count
  • Number of templates
  • Number of API tokens
  • Number of team members
  • File storage capacity

Best Practices

Exponential Backoff

When you receive a 429 or 5xx response, implement exponential backoff with jitter to avoid thundering herd problems:

Idempotency

Create and send operations accept an Idempotency-Key header to prevent duplicate requests on retry. Keys expire after 24 hours. Keys are bound to the calling token — a different token cannot replay another’s cached response.

Error Handling Checklist

Do not assume every response is successful. Check the status code before parsing the response body as a success payload.
The error field may be a string or an array of strings. Handle both cases in your error handling logic.
Every API response includes an X-Request-Id header. Log this value so you can reference it when contacting support about 500 errors.
When rate-limited, always wait at least as long as the Retry-After header specifies. Ignoring this header will extend your rate limit window.
These errors indicate a problem with the request itself. Retrying the same request will produce the same error. Fix the request parameters before retrying.
When you receive a 403 with an upgrade_url, display a clear message to the user explaining the plan limit and providing a link to upgrade.