Skip to content

Errors

This page explains all error codes you might encounter when using the Docstron API, along with common causes and solutions.

All error responses from the Docstron API follow this structure:

{
"success": false,
"message": "Error description",
"data": []
}

For validation errors, an additional errors array is included:

{
"success": false,
"message": "Validation failed",
"errors": [
{
"field": "field_name",
"message": "Error description",
"type": "error_type"
}
]
}

The request was invalid or cannot be processed due to client error.

{
"success": false,
"message": "No fields provided to update.",
"data": []
}

When it occurs:

  • Updating a template or document without providing any data
  • Empty request body for endpoints that require data

Solution:

  • Ensure all required fields are included in your request
  • Verify the request body is not empty
{
"success": false,
"message": "You've reached the maximum monthly limit of 20 documents for your subscription.",
"data": []
}

When it occurs:

  • You’ve exceeded your plan’s monthly document generation limit

Solution:


Authentication failed or API key is invalid.

{
"detail": "Invalid API key"
}

When it occurs:

  • The API key is incorrect or has been revoked
  • API key has been regenerated and old key is being used

Solution:

  • Verify your API key at docstron.com/api-keys
  • Generate a new API key if needed
  • Check for typos in the Authorization header
{
"detail": "Not authenticated"
}

When it occurs:

  • No Authorization header is included in the request
  • Authorization header is malformed

Solution:

  • Add the Authorization header: Authorization: Bearer YOUR_API_KEY
  • Ensure the Bearer token format is correct

The requested resource does not exist.

{
"success": false,
"message": "Application not found.",
"data": []
}

When it occurs:

  • Invalid or non-existent application_id
  • Application has been deleted
  • Application belongs to a different account

Solution:

  • Verify the application_id is correct
  • List all applications using the Get All Applications endpoint
  • Ensure you’re using the correct API key for the account
{
"success": false,
"message": "Template not found.",
"data": []
}

When it occurs:

  • Invalid or non-existent template_id
  • Template has been deleted
  • Template belongs to a different application

Solution:

  • Verify the template_id is correct
  • Check if the template still exists using the Get Template endpoint
  • Ensure the template hasn’t been deleted
{
"success": false,
"message": "Template not found. Please ensure application and template are active.",
"data": []
}

When it occurs:

  • Template exists but is marked as inactive
  • Application is marked as inactive
  • Template or application has been deleted

Solution:

  • Verify both the template and application are active
  • Update template status using Update Template
  • Check application status in the dashboard
{
"success": false,
"message": "Document not found.",
"data": []
}

When it occurs:

  • Invalid or non-existent document_id
  • Document has been deleted
  • Document belongs to a different account

Solution:

  • Verify the document_id is correct
  • Check if the document still exists
  • Ensure you’re using the correct API key for the account

The request was well-formed but contains semantic errors.

{
"success": false,
"message": "Validation failed",
"errors": [
{
"field": "response_type",
"message": "Input should be 'pdf', 'json_with_base64' or 'document_id'",
"type": "literal_error"
}
]
}

When it occurs:

  • Invalid value for response_type in document generation
  • Field values don’t match expected types or formats
  • Invalid enum values

Solution:

  • Check the errors array for specific field issues
  • Ensure values match the allowed options
  • Valid response_type values: pdf, json_with_base64, document_id

An unexpected error occurred on the server.

{
"success": false,
"message": "Template engine error!",
"data": []
}

When it occurs:

  • Template rendering fails
  • Missing required data for template placeholders
  • Invalid placeholder syntax in template
  • Circular dependencies in template logic

Solution:

  • Verify all template placeholders have corresponding data
  • Check template syntax for errors
  • Ensure the data object includes all required fields
  • Test template with sample data
{
"success": false,
"message": "Failed to create the document",
"data": []
}

When it occurs:

  • PDF generation service is unavailable
  • Temporary server issue
  • Database error during document storage

Solution:

  • Wait a few moments and retry the request
  • If persistent, contact support@docstron.com
  • Check the status page for service updates
{
"success": false,
"message": "Failed to get all the applications.",
"data": []
}

When it occurs:

  • Database connectivity issue
  • Temporary server problem

Solution:

{
"success": false,
"message": "Failed to get the application.",
"data": []
}

When it occurs:

  • Database connectivity issue
  • Temporary server problem

Solution:

{
"success": false,
"message": "Failed to get the template.",
"data": []
}

When it occurs:

  • Database connectivity issue
  • Temporary server problem

Solution:

{
"success": false,
"message": "Failed to update the template.",
"data": []
}

When it occurs:

  • Database connectivity issue
  • Temporary server problem during update

Solution:

{
"success": false,
"message": "Failed to delete the template.",
"data": []
}

When it occurs:

  • Database connectivity issue
  • Temporary server problem during deletion

Solution:

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

When it occurs:

  • Database connectivity issue
  • Temporary server problem

Solution:

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

When it occurs:

  • Database connectivity issue
  • Temporary server problem during update

Solution:


Problem: Getting 401 errors consistently

Checklist:

  1. ✅ API key is correct and copied completely
  2. ✅ Authorization header format: Authorization: Bearer YOUR_API_KEY
  3. ✅ API key hasn’t been revoked or regenerated
  4. ✅ Using the correct API key for the account
  5. ✅ No extra spaces or characters in the key

Problem: Getting 404 errors for existing resources

Checklist:

  1. ✅ ID is copied correctly (no typos)
  2. ✅ Resource hasn’t been deleted
  3. ✅ Resource belongs to the correct account
  4. ✅ For templates/applications: Check if they’re active
  5. ✅ Using the correct API endpoint URL

Problem: Getting 500 errors during PDF generation

Checklist:

  1. ✅ Template contains all required placeholders
  2. ✅ Data object includes values for all placeholders
  3. ✅ Template HTML/CSS syntax is valid
  4. ✅ Template is marked as active
  5. ✅ Application is marked as active
  6. ✅ Not exceeding monthly document limit

Problem: Getting 422 validation errors

Checklist:

  1. ✅ All required fields are included
  2. ✅ Field values match expected types
  3. ✅ Enum values are spelled correctly (e.g., response_type)
  4. ✅ JSON is properly formatted
  5. ✅ No extra or misspelled fields

If you’re experiencing errors that aren’t covered here or need assistance:

  • 📧 Email: support@docstron.com
  • 📚 Documentation: API Reference
  • 💬 Live Support: Available in your dashboard
  • 🐛 Report Issues: Include error details, request/response, and timestamps

When reporting errors, please include:

  • Complete error response
  • The API endpoint you were calling
  • Request body (remove sensitive data)
  • Timestamp of the error
  • Your application/template IDs (if applicable)