Skip to content

Download Document

Download a specific document as a PDF file using the Docstron API. This endpoint allows you to retrieve the generated PDF document.

GET https://api.docstron.com/v1/documents/download/{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-489a79af-8680-4a08-a777-df52f26f296f)
Terminal window
curl --location 'https://api.docstron.com/v1/documents/download/document-489a79af-8680-4a08-a777-df52f26f296f' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data ''

200 - Success Response

The endpoint returns the PDF file directly with the following headers:

Content-Type: application/pdf
Content-Disposition: attachment; filename="file_2025-10-16_18-01-38_0e92e433.pdf"

The response body contains the binary PDF file data.

Terminal window
# Save the PDF to a file
curl --location 'https://api.docstron.com/v1/documents/download/document-489a79af-8680-4a08-a777-df52f26f296f' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--output document.pdf

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
  • PDF generation is still in progress

Solution: Verify the document_id is correct. Ensure the document hasn’t been deleted and that generation has completed.


500 - Internal Server Error

Returned when an unexpected server error occurs while retrieving the document.

{
"success": false,
"message": "Failed to download the document.",
"data": []
}

Common causes:

  • Temporary server issue
  • File storage connectivity problem
  • Service maintenance
  • Corrupted PDF file

Solution: Wait a few moments and retry the request. If the problem persists, contact support@docstron.com.

If you have questions about applications or need assistance:

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