Create a document
POST https://api.129.212.147.181.sslip.io/v1/documents
Generates a document from a ready session; send Docgen-Subject with it. Returns at once with status: "queued"; send Accept: text/event-stream to stream it instead (same events as GET /v1/documents/{document}/stream).
A session can make any number of documents (another mode, another format); each appears in the session's outputs.
Headers
Bearer dg_test_… or Bearer dg_live_…
Your reference for the end user (a user ID, a hash; never an email).
A session is bound to the subject it was created with, and every call
on it must send the same value or it is 404. Set it from your own
login, never from what the browser sent. Required to create and list
sessions unless your organisation has subjects turned off.
Retrying with the same key and body returns the original response. Kept 24 hours.
Body
A ready session. Its form and answers are used; send Docgen-Subject too.
basic drafts quickly from the answers; advanced drafts against current state law. Defaults to basic, or advanced for a form filed on its official PDF, which offers only that (see the session's document.generate action). One of basic, advanced
One of pdf, docx, html
How long file links live, up to your plan maximum (7 days).
Up to 20 keys of your own, echoed back and shown in logs. Don't put personal data here.
Returns
202 Accepted: a Document object. Queued. With Accept: text/event-stream, the event stream instead.
Errors
| Status | Code | What to do |
|---|---|---|
| 422 | parameter_missing | Pass session. |
| 422 | parameter_invalid | error.fields names the bad parameter (mode, formats, lifetime_seconds, metadata). |
| 422 | format_unavailable | DOCX is not available yet; ask for pdf or html. A form filed on its official PDF (a deed, for example) comes only as pdf. |
| 422 | mode_unavailable | A form filed on its official PDF comes only in advanced mode, which is its default. The session's document.generate action lists the modes and formats a form offers. |
| 409 | session_not_ready | The session is still finding the form or asking questions; pending_question is what is left. |
| 404 | session_not_found | Check the ID, and that Docgen-Subject is the subject the session was created for. |
| 410 | session_deleted | The session was deleted with its conversation and answers. Start a new one. |
| 503 | provider_unavailable | No model is configured for live keys yet. Use a test key. |
Any endpoint can also return the common errors (bad key, rate limit, idempotency).