Download Document
Download a specific document as a PDF file using the Docstron API. This endpoint allows you to retrieve the generated PDF document.
Endpoint
Section titled “Endpoint”GET https://api.docstron.com/v1/documents/download/{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-489a79af-8680-4a08-a777-df52f26f296f ) |
Request Examples
Section titled “Request Examples”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 ''
Response
Section titled “Response”200 - Success Response
The endpoint returns the PDF file directly with the following headers:
Content-Type: application/pdfContent-Disposition: attachment; filename="file_2025-10-16_18-01-38_0e92e433.pdf"
The response body contains the binary PDF file data.
Save to File Example
Section titled “Save to File Example”# Save the PDF to a filecurl --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
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
- 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.
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!