Document API
Users can create a document based on a template by filling out a form. These documents are stored by fillthedoc and given a 32 byte unique (unguessable) hash as identifier. The document can only be fetched using this hash as JSON data, HTML or PDF.
Create a document
POST
https://fillthedoc.com/api/documents
Create a new document based on a template.
Headers
Content-Type
string
"application/json"
Request Body
template
string
Template id or reference
values
object
Data to prefill the document
callback
string
Webhook URL that's called when the document is filled out
The template
property is required and can be a template id or template reference. When creating a new document, the latest version of the template is always used. Only published templates can be used to create a document.
The document can be prefilled by adding a values
property in the request. The data should match the structure defined by the template's form.
The response contains an edit_url
property. If the end user needs to complete the information for the document, send him to this URL. The document id is a unique and unguessable 32 bit random value. The user doesn't need any information other than this URL.
If a callback
URL was specified when creating the document, it will be called when the end user completes filling out the document. The request body is a JSON representation of the document and similar to the response body when creating a document.
The document will automatically be locked after the user has completed the form. You may update the document to unlock it.
Retrieve a document
GET
https://fillthedoc.com/api/documents/{id}
Get a document as PDF, HTML or JSON.
Path Parameters
id
string
Unique (32 bit) document id
Headers
Accept
string
"application/pdf", "text/html" or "application/json"
Use the Accept
header to specify if you'd like to receive the document data and metadata as JSON or just contents as PDF or HTML.
Do not send the URL for generating the PDF directly to the end user. It will not be accessible without the API key. Instead, use the API to download the PDF, store it locally, and allow the user to download it from your system.
Update a document
POST
https://fillthedoc.com/api/documents/{id}
Update the document data or unlock the document.
Path Parameters
id
string
Unique (32 bit) document id
Headers
If-Unmodified-Since
string
Used for optimistic locking
Request Body
step
string
Step the user is on or "finished" when done
values
object
Data of the document
Documents are automatically be locked after the user has completed the form. This is indicated by the step
property which is set to finished
. Set the step
property to null
to allow the user to modify the document. The edit url remains unchanged. Once the end user is finished, the webhook (specified as callback
when the document was created) will be called again.
It's possible to modify the data, prior to generating the PDF or HTML document, via the values
property. The values are merged, even for nested data, as specified by RFC 7396 (regardless of the Content-Type
).
You should send an If-Unmodified-Since
header for optimistic locking. This prevents overwriting the document data, which may have been modified by the user is the document is not locked.
Delete a document
DELETE
https://fillthedoc.com/api/documents/{id}
Delete a document from fillthedoc.
Path Parameters
id
string
Unique (32 bit) document id
Last updated