List Templates of a type (Read-Only)
GET/api/templates/{type}
Returns the identifying columns of every template of the type, capped at 500 rows. The template body is left out here because it is a whole HTML document; read one template by id to get it. Templates are read-only through this API - see the resource description.
Passing search lowers the default page size to 20 rows. That default is only a default: send limit to ask for more, up to the 500 row ceiling. Every listing reports the cap it applied in the X-Result-Limit response header, the ceiling in X-Result-Max-Limit, and whether the cap is what ended the list in X-Result-Truncated, so a truncated page is never mistaken for the whole set.
Headers
| Field | Type | Description |
|---|---|---|
| authtoken | String | Authentication token, generated from admin area |
Parameters
| Field | Type | Description |
|---|---|---|
| type | String | Template type |
| search | String | optional Optional keyword, matched against the template name or title |
| limit | Number | optional Optional page size, 1 to 500. Defaults to 500, or to 20 when search is used |
| template_type | String | optional Optional filter, email templates only |
| language | String | optional Optional language filter, email templates only |
| ticket_type_id | Number | optional Optional filter by ticket type, ticket templates only |
curl -X GET "https://yoursite.com/api/templates/lead" \
-H "authtoken: YOUR_API_TOKEN" Email-Response:
HTTP/1.1 200 OK
[
{
"id": "1",
"template_name": "login_info",
"email_subject": "Login details",
"template_type": "default",
"language": ""
}
] Contract-Response:
HTTP/1.1 200 OK
[
{ "id": "1", "title": "Template 3.7" }
] Invalid-Type:
HTTP/1.1 400 Bad Request
{ "status": false, "messages": { "type": "Invalid template type. Allowed values: email, ticket, contract, proposal" } } No-Data:
HTTP/1.1 404 Not Found
{ "status": false, "messages": { "error": "No data were found" } }