Create template document
POST /template/
Authorization: Bearer <cartat_api_token>
Content-Type: application/jsonUse a DOCUMENT header when the template needs an approved document example. Upload the document first with POST /template/media, then use the returned media handle in the template request.
Example
{
"name": "invoice_document",
"category": "UTILITY",
"language": "en_US",
"components": [
{
"type": "HEADER",
"format": "DOCUMENT",
"example": {
"header_handle": ["uploaded_document_handle"]
}
},
{
"type": "BODY",
"text": "Hi {{customer_name}}, your invoice document is attached.",
"example": {
"body_text_named_params": [
{
"param_name": "customer_name",
"example": "John"
}
]
}
}
]
}Required validation
Field
Rule
name
Required and must contain only letters, numbers, and underscores.
category
Required. Use AUTHENTICATION, UTILITY, or MARKETING.
components[].format
Required for headers. Use DOCUMENT.
components[].example.header_handle
Required for document headers.