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.
post
https://fillthedoc.com
/api/documents
Create a document
Example request body
1
{
2
"template": "cao-employee",
3
"values": {
4
"cao_name": "CAO Employee Pension",
5
"pension_fund": "P.A."
6
}
7
}
Copied!
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.
get
https://fillthedoc.com
/api/documents/{id}
Retrieve a document
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.
post
https://fillthedoc.com
/api/documents/{id}
Update a document
Example request body
1
{
2
"step": null,
3
"values": {
4
"country": "Netherlands"
5
}
6
}
Copied!
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
https://fillthedoc.com
/api/documents/{id}
Delete a document
Last modified 1yr ago