The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our Implementation Guide for more details on how to implement Dyspatch.
Set Bearer followed by your API key as the Authorization header in your API requests.
Authorization: Bearer EXAMPLEAPIKEYXXXXXXXX12345678
Below is an example curl request with an API key in the Authorization header.
curl --request GET \
--url https://api.dyspatch.io/templates \
--header 'Authorization: Bearer EXAMPLEAPIKEYXXXXXXXX12345678' \
--header 'Accept: application/vnd.dyspatch.2024.08+json'
Security Scheme Type | API Key |
---|---|
Header parameter name: | Authorization |
Templates are the email templates found in your Dyspatch account. Only the published Template Draft is returned.
A typical integration will start with using the Templates list endpoint to iterate through and sync Templates.
Gets a list of Template Metadata objects for all published templates. Up to 25 results returned before results are paginated.
cursor | string A cursor value used to retrieve a specific page from a paginated result set. |
Accept required | string A version of the API that should be used for the request. For example, to use version "2024.08", set the value to "application/vnd.dyspatch.2024.08+json" |
A list of templates
Invalid request
Unauthenticated
Unauthorized
Rate limit exceeded
Server error
Server error
{- "cursor": {
- "next": "string",
- "hasMore": true
}, - "data": [
- {
- "id": "tem_g3L7Cw6Hp5wU",
- "name": "Template Name",
- "description": "Description of Template",
- "url": "/templates/tem_g3L7Cw6Hp5wUaf395LehwK",
- "path": "fdr_01gb8vd6pz/fdr_01gqjmdbq/fdr_01gqjmg1",
- "workspaceId": "fdr_01gb8vd6pz",
- "localizations": [
- {
- "id": "loc_g3L7Cw6Hp5wUaf395LehwK",
- "name": "English (US)",
- "url": "/localizations/loc_g3L7Cw6Hp5wUaf395LehwK",
- "localeGroup": "lgr_alka38ajla301",
- "languages": [
- "fr-FR"
], - "updatedAt": "2024-09-04T21:28:49Z"
}
], - "createdAt": "2024-09-04T21:28:49Z",
- "updatedAt": "2024-09-04T21:28:49Z",
- "publishedDraftId": "tdft_g3L7Cw6Hp5wU"
}
]
}
Gets a template object with the matching ID. Templates without a published draft will result in an error.
templateId required | string A template ID |
targetLanguage required | string Enum: "html" "handlebars" "ampscript" "freemarker" "cheetah" "jinja" "liquid" "mandrillhandlebars" "handlebarsjava" The type of templating language to compile as. Should only be used for visual templates. |
Accept required | string A version of the API that should be used for the request. For example, to use version "2024.08", set the value to "application/vnd.dyspatch.2024.08+json" |
A template object with the requested ID. Templates without a published draft will result in an error.
Invalid request
Unauthenticated
Unauthorized
Resource not found
Rate limit exceeded
Server error
Server error
{- "id": "tem_g3L7Cw6Hp5wU",
- "name": "Template Name",
- "description": "Description of Template",
- "url": "/templates/tem_g3L7Cw6Hp5wUaf395LehwK",
- "compiled": {
- "sender": "example@example.com",
- "replyTo": "example@example.com",
- "subject": "PGh0bWw+PC9odG1sPgo=",
- "html": "PGh0bWw+PC9odG1sPgo=",
- "ampHtml": "PGh0bWwg4pqhNGVtYWlsPjwvaHRtbD4=",
- "text": "dGV4dCBjb250ZW50"
}, - "path": "fdr_01gb8vd6pz/fdr_01gqjmdbq/fdr_01gqjmg1",
- "workspaceId": "fdr_01gb8vd6pz",
- "createdAt": "2024-09-04T21:28:49Z",
- "updatedAt": "2024-09-04T21:28:49Z",
- "publishedDraftId": "tdft_g3L7Cw6Hp5wU",
- "localizations": [
- {
- "id": "loc_g3L7Cw6Hp5wUaf395LehwK",
- "name": "English (US)",
- "url": "/localizations/loc_g3L7Cw6Hp5wUaf395LehwK",
- "localeGroup": "lgr_alka38ajla301",
- "languages": [
- "fr-FR"
], - "updatedAt": "2024-09-04T21:28:49Z"
}
]
}
Renders a template into HTML using the provided data.
templateId required | string A template ID |
Accept required | string A version of the API that should be used for the request. For example, to use version "2024.08", set the value to "application/vnd.dyspatch.2024.08+json" |
Rendered template contents incorporating the data passed in the request body.
Invalid request
Unauthenticated
Unauthorized
Resource not found
Rate limit exceeded
Server error
Server error
{- "html": "<html>Hello, world!<html>",
- "ampHtml": "<html ⚡4email>Hello, world!<html>",
- "text": "Hello, world!",
- "subject": "Email Subject Line",
- "sender": "example@example.com",
- "replyTo": "example@example.com"
}
Renders a template into HTML for the selected language using the provided data.
templateId required | string A template ID |
languageId required | string A language ID (eg: en-US) |
Accept required | string A version of the API that should be used for the request. For example, to use version "2024.08", set the value to "application/vnd.dyspatch.2024.08+json" |
Rendered template contents in the selected language, incorporating the data passed in the request body.
Invalid request
Unauthenticated
Unauthorized
Resource not found
Rate limit exceeded
Server error
Server error
{- "html": "<html>Hello, world!<html>",
- "ampHtml": "<html ⚡4email>Hello, world!<html>",
- "text": "Hello, world!",
- "subject": "Email Subject Line",
- "sender": "example@example.com",
- "replyTo": "example@example.com"
}
Drafts represent unpublished versions of templates that are still mutable. There could be many in progress drafts for a template.
Returns all Email drafts for your organization.
cursor | string A cursor value used to retrieve a specific page from a paginated result set. |
status | string Value: "awaitingTranslation" Filter the list of drafts by a particular status |
Accept required | string A version of the API that should be used for the request. For example, to use version "2024.08", set the value to "application/vnd.dyspatch.2024.08+json" |
Drafts
Invalid request
Unauthenticated
Unauthorized
Resource not found
Rate limit exceeded
Server error
Server error
{- "cursor": {
- "next": "string",
- "hasMore": true
}, - "data": [
- {
- "id": "tdft_g3L7Cw6Hp5wU",
- "templateId": "tem_g3L7Cw6Hp5wU",
- "name": "Draft Name",
- "url": "/drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU",
- "path": "fdr_01gb8vd6pz/fdr_01gqjmdbq/fdr_01gqjmg1",
- "workspaceId": "fdr_01gb8vd6pz",
- "createdAt": "2024-09-04T21:28:49Z",
- "updatedAt": "2024-09-04T21:28:49Z",
- "status": "LOCKED_FOR_TRANSLATION",
- "templateName": "Template Name",
- "designApprovedDate": "2024-09-04T21:28:49Z"
}
]
}
Moves the Email draft into submitted state.
draftId required | string A draft ID |
Accept required | string A version of the API that should be used for the request. For example, to use version "2024.08", set the value to "application/vnd.dyspatch.2024.08+json" |
Successfully submitted
Invalid request
Unauthenticated
Unauthorized
Resource not found
Rate limit exceeded
Server error
Server error
Gets a Email draft object with the matching ID. The "compiled" field will contain the template in the default, unlocalized form.
draftId required | string A draft ID |
targetLanguage required | string Enum: "html" "handlebars" "ampscript" "freemarker" "cheetah" "jinja" "liquid" "mandrillhandlebars" "handlebarsjava" The type of templating language to compile as. Should only be used for visual templates. |
Accept required | string A version of the API that should be used for the request. For example, to use version "2024.08", set the value to "application/vnd.dyspatch.2024.08+json" |
A draft object with the requested ID.
Invalid request
Unauthenticated
Unauthorized
Resource not found
Rate limit exceeded
Server error
Server error
{- "id": "tdft_g3L7Cw6Hp5wU",
- "template": "tem_g3L7Cw6Hp5wU",
- "name": "Draft Name",
- "url": "/drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU",
- "path": "fdr_01gb8vd6pz/fdr_01gqjmdbq/fdr_01gqjmg1",
- "workspaceId": "fdr_01gb8vd6pz",
- "compiled": {
- "sender": "example@example.com",
- "replyTo": "example@example.com",
- "subject": "PGh0bWw+PC9odG1sPgo=",