Skip to content

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.

PATCH https://api.docstron.com/v1/documents/{document_id}

This endpoint requires authentication using a Bearer token. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Path Parameters

ParameterTypeRequiredDescription
document_idstringYesThe unique identifier of the document (e.g., document-49da9cea-b1b9-4216-aa21-7690850d2f4c)

Request Body

ParameterTypeRequiredDescription
dataobjectYesKey-value pairs to update the document attributes
Terminal window
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"
}
}'

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"
}
}
FieldTypeDescription
successbooleanIndicates if the request was successful
messagestringA message describing the response
data.document_idstringUnique identifier of the document
data.template_idstringThe template used to generate this document
data.attributesobjectUpdated document attributes as a JSON object
data.created_atstringTimestamp when the document was originally created (ISO 8601 format)
data.updated_atstringTimestamp when the document was last updated (ISO 8601 format)

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.

⚠️ 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.

  • 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
  • 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

If you have questions about applications or need assistance:

  • 📧 Email: support@docstron.com
  • 💬 Live Chat: Available in your dashboard
  • 📚 Documentation: You’re reading it!