Skip to content

Get Template

Retrieve details of a specific template using the Docstron API. This endpoint allows you to fetch template information, content, and styling.

GET https://api.docstron.com/v1/templates/{template_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
template_idstringYesThe unique identifier of the template (e.g., template-c2465c0b-fc54-4672-b9ac-7446886cd6de)
Terminal window
curl --location 'https://api.docstron.com/v1/templates/template-c2465c0b-fc54-4672-b9ac-7446886cd6de' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data ''

200 - Success Response

{
"success": true,
"message": "Request successful",
"data": {
"template_id": "template-c2465c0b-fc54-4672-b9ac-7446886cd6de",
"application_id": "app-7b4d78fb-820c-4ca9-84cc-46953f210301",
"name": "Template 1",
"is_active": true,
"created_at": "2025-10-12T17:06:33",
"updated_at": "2025-10-12T17:06:33",
"content": "<h1>Hello World!</h1>",
"extra_css": "@page { margin: 3cm; @bottom-left { color: #1ee494; content: '♥ Thank you!'; } }"
}
}
FieldTypeDescription
successbooleanIndicates if the request was successful
messagestringA message describing the response
dataobjectThe created template object
data.template_idstringUnique identifier of the created template
data.application_idstringThe application ID associated with this template
data.namestringName of the template
data.is_activebooleanWhether the template is active (true) or inactive (false)
data.created_atstringTimestamp when the template was created (ISO 8601 format)
data.updated_atstringTimestamp when the template was last updated (ISO 8601 format)
data.contentstringHTML content of the template
data.extra_cssstringAdditional CSS rules for PDF styling

404 - Template Not Found

Returned when the provided template_id does not exist or is invalid.

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

Common causes:

  • Invalid or mistyped template_id
  • Template has been deleted
  • The template belongs to a different application

Solution: Verify the template_id is correct. You can list all templates by creating them through the Create Template endpoint and storing their IDs.


500 - Internal Server Error

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

{
"success": false,
"message": "Failed to get the template.",
"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.

If you have questions about applications or need assistance:

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