docubend
Documentation

Errors

Every refusal is JSON with the same two keys, plus whatever a program has to act on.

The shape of a refusal#

Every refusal is JSON with the same two keys, plus whatever a program has to act on. Branch on the extra fields, never on detail — that is a sentence written for a person and it is allowed to improve.

409
{
  "ok": false,
  "detail": "that PDF is locked against copying and editing. Post it again with unlock=1 to have the lock removed first.",
  "locked": "restrictions",
  "opens": true,
  "allows": { "print": true, "copy": false, "modify": false },
  "unlock": "post again with ?unlock=1"
}

Status codes#

CodeWhat it means
400The request was not understood — usually no source field, or one that is not the right type. The message lists what this endpoint takes.
401No token, an expired one (they last an hour), or one whose credential has been revoked. Ask for a new token — the body says so, and carries a link to this page.
402This account's plan does not include what was asked for. The API itself is Pro and Enterprise.
403The credential's scopes do not cover this call — a documents:read token cannot write.
404No such document, or no such route. A document belonging to somebody else is a 404, not a 403.
405That path is real, and does not take that method — the Allow header says which it does. A missing path is a 404 instead, so the two are never confused.
409The document changed underneath a versioned update — or the PDF you sent is locked against copying and editing. That one carries locked: "restrictions" and opens with no password at all: post it again with ?unlock=1.
413The file is larger than the plan allows (512 MB on Pro and Enterprise).
415We cannot read that kind of file. The message lists the kinds we can.
422We could read it and it was damaged, or it was a mermaid diagram type that cannot honestly be drawn as boxes and arrows — or the PDF will not open without a password. That one carries locked: "password": send the password with unlock=1.
429The account's daily allowance is spent. A Retry-After header says how long until it resets.
507That would put the account over its storage.
A real path with the wrong method is a 405, never a 404. GET /api/v1/pdfs — which is what everybody types first, and what a browser does if you paste the URL — used to answer "no such route" about a route that is right there, sending people looking for a typo in a path that was never wrong. It carries an Allow header now.

Headers that carry information#

HeaderOnWhat it says
Allowon every 405A real path with the wrong method is a 405 naming the methods it does take — never a 404. GET /api/v1/pdfs is the one everybody types first.
Retry-Afteron 429Seconds until midnight UTC, when the daily allowance resets.
X-Docubend-Warningon .pdfWhat was lossy, when something was. The body has to be a PDF and nothing else, so this is where it goes.
X-Docubend-Droppedon .mmdShapes mermaid cannot say, counted. With X-Docubend-Shapes and X-Docubend-Loose-Connectors.