Skip to main content

Base URL & Versioning

Base URL​

All API requests are made to:

https://api.docpayload.com/v1

The one exception is the token endpoint, https://api.docpayload.com/oauth2/token: OAuth 2.0's own resource, it sits outside the version (Authentication).

Every operation, with its parameters and responses, is in the interactive API reference, where you can also send requests with your own key.

API versioning​

The API version is included in the URL path. The current version is v1.

When breaking changes are introduced, a new version will be released (e.g., v2). Previous versions remain available for a deprecation period with advance notice.

A deprecation is announced on the responses it concerns, in the Deprecation (RFC 9745) and Sunset (RFC 8594) headers. Today they mark a definition written in the previous shape, which the API translates until 1 April 2027 and then refuses; see Errors.

Request format​

All request bodies must be JSON with the Content-Type: application/json header, and at most 1 MB; a larger body is answered 413 (PAYLOAD_TOO_LARGE). Files are uploaded as multipart form data, up to their own limits.

YOUR_ACCESS_TOKEN is the access token you get by exchanging your API key's Client ID and secret; see Authentication.

curl -X POST https://api.docpayload.com/v1/{YOUR_TENANT_ID}/documents/generate/pdf \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "document": { ... } }'
# { "status": "succeeded", "fileName": "...", "downloadUrl": "...", "errorCodes": [], ... }

Response format​

  • Document generation endpoints return JSON with status, fileName, downloadUrl and errorCodes; see Generate
  • CRUD endpoints return application/json
  • Every response carries a Request-Id header: the request's id, made by the server, the same as an error's requestId. Log it, and give it when contacting support; it also finds the request in the Activity panel
  • Errors are RFC 9457 Problem Details (application/problem+json) with a stable code, and { error, error_description } from the token endpoint as OAuth 2.0 has it; see Errors
  • Lists are an object: the items in value and, while there are more, nextLink, the absolute URL of the next page. Ask for a page size with maxpagesize (a page may hold fewer), then follow nextLink as it is until a page comes without one. A list refuses a query parameter it does not take with 400 VALIDATION_ERROR, rather than ignore it
  • Versions: a template and a webhook endpoint answer with an ETag, their version. Send it back as If-Match when you change or delete them, and a change made on a version that moved since you read it is refused with 412 PRECONDITION_FAILED, changing nothing, rather than overwriting what someone else saved. Without If-Match, the change is made as before
  • Status codes: a create answers 201 Created with a Location header naming what was made, and the thing made in the body; an action (:rename) answers 200 with a body; a delete answers 204 No Content, also when what it names is already gone, so a retried delete succeeds as the first did; a delivery is queued and answers 202 Accepted
  • Values from a fixed set (a status, a visibility, a billing cycle) are strings in camelCase, as field names are: "succeeded", "private", "payAsYouGo". A currency is its ISO 4217 code, "USD". A set may grow: handle a value you do not know rather than fail on it
  • Actions that are not a create, read, update or delete are a POST on the resource they act on, the action after a colon: POST /v1/{tenantId}/templates/{id}:rename, POST /v1/{tenantId}/templates:move

Rate limits​

Every request is counted against a named budget. Each endpoint has its own count, except documents and outbound, which are each shared by the endpoints they cover:

BudgetWhat it coversLimit
documentsDocuments generated (generate)600 a minute per tenant, shared
workspaceEvery other request of a tenant (downloads, templates, assets, webhooks, deliveries)6,000 a minute per tenant, for each endpoint
outboundWhat the platform calls on your behalf: a signing key tested or registered, a webhook tested10 a minute per tenant, shared
exportsThe .ndjson exports of your audit, metrics and errors3 a minute per tenant, for each endpoint
accountSigning in, token requests (POST /oauth2/token: reuse the token until it expires), creating a tenant13 a minute per caller, for each endpoint
draftingDefinition drafting (ai:generate-definition)5 a minute per tenant, shared
strictWhat mails someone or tests a password, an invitation among them5 a minute per caller, for each endpoint
publicPages, examples, and the links in a delivery email700 a minute per caller, for each endpoint

A plan's monthly allowance is a limit too: past it, generation is answered 402 with MONTHLY_ALLOWANCE_REACHED.

The document limit is your tenant's own and can be raised on request. A download never counts as a document.

Every answer says how much of its budget is left, in the RateLimit-Policy and RateLimit headers (draft-ietf-httpapi-ratelimit-headers): RateLimit-Policy names each limit the request was counted against, with its size (q) and its window in seconds (w), and RateLimit what is left of it (a). Each limit is named by its budget, and "anonymous" is the limit of a caller with no tenant:

HTTP/1.1 200 OK
RateLimit-Policy: "workspace";q=6000;w=60, "documents";q=600;w=60
RateLimit: "workspace";a=5987, "documents";a=588

Pace on a rather than wait to be refused. A request over a limit is answered 429 Too Many Requests, with the seconds to wait in Retry-After, the limit spent named in RateLimit with nothing left (a=0) until then, and in the problem's violated-policies:

HTTP/1.1 429 Too Many Requests
Retry-After: 37
RateLimit-Policy: "workspace";q=6000;w=60, "documents";q=600;w=60
RateLimit: "workspace";a=5412, "documents";a=0;w=37