Update Document
Update the data attributes of an existing document using the Docstron API. This endpoint allows you to modify the data used to generate the document without regenerating it.
Endpoint
Section titled “Endpoint”PATCH https://api.docstron.com/v1/documents/{document_id}
Authentication
Section titled “Authentication”This endpoint requires authentication using a Bearer token. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Parameters
Section titled “Parameters”Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
document_id | string | Yes | The unique identifier of the document (e.g., document-49da9cea-b1b9-4216-aa21-7690850d2f4c ) |
Request Body
Parameter | Type | Required | Description |
---|---|---|---|
data | object | Yes | Key-value pairs to update the document attributes |
Request Examples
Section titled “Request Examples”curl --location --request PATCH 'https://api.docstron.com/v1/documents/document-49da9cea-b1b9-4216-aa21-7690850d2f4c' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data '{ "data": { "customer_name": "John Doe", "amount": "$299.00" } }'
Response
Section titled “Response”200 - Success Response
{ "success": true, "message": "Request successful", "data": { "document_id": "document-517145ce-5a09-4e47-a257-887e239ecb36", "template_id": "template-8c043edf-fa70-4e51-a8a2-36f67958ca16", "attributes": { "date": "March 31, 2026", "invoice_id": "6546789" }, "created_at": "2025-10-15T18:19:48", "updated_at": "2025-10-16T17:18:08" }}
Response Fields
Section titled “Response Fields”Field | Type | Description |
---|---|---|
success | boolean | Indicates if the request was successful |
message | string | A message describing the response |
data.document_id | string | Unique identifier of the document |
data.template_id | string | The template used to generate this document |
data.attributes | object | Updated document attributes as a JSON object |
data.created_at | string | Timestamp when the document was originally created (ISO 8601 format) |
data.updated_at | string | Timestamp when the document was last updated (ISO 8601 format) |
Error Responses
Section titled “Error Responses”404 - Document Not Found
Returned when the provided document_id
does not exist or is invalid.
{ "success": false, "message": "Document not found.", "data": []}
Common causes:
- Invalid or mistyped
document_id
- Document has been deleted
- The document belongs to a different account
Solution: Verify the document_id
is correct using the Get Document endpoint.
500 - Internal Server Error
Returned when an unexpected server error occurs while updating the document.
{ "success": false, "message": "Failed to update the document.", "data": []}
Common causes:
- Temporary server issue
- Database connectivity problem
- Service maintenance
Solution: Wait a few moments and retry the request. If the problem persists, contact support@docstron.com.
Important Notes
Section titled “Important Notes”⚠️ Note: Updating document attributes does not regenerate the PDF. This endpoint only updates the metadata stored with the document. If you need to regenerate the PDF with new data, use the Generate Document endpoint to create a new document.
When to Use Update Document
Section titled “When to Use Update Document”- Metadata tracking - Store additional information about the document
- Audit trail - Record changes or updates to document-related data
- Corrections - Fix data entry errors in the stored attributes
When to Regenerate Instead
Section titled “When to Regenerate Instead”- Visual changes needed - If the PDF content needs to change
- Template updates - If you’ve modified the template
- New data presentation - If you need the new data visible in the PDF
Need Help?
Section titled “Need Help?”If you have questions about applications or need assistance:
- 📧 Email: support@docstron.com
- 💬 Live Chat: Available in your dashboard
- 📚 Documentation: You’re reading it!