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.2019.10+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 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+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": "string",
- "description": "string",
- "url": "/templates/tem_g3L7Cw6Hp5wUaf395LehwK",
- "localizations": [
- {
- "localization": "loc_g3L7Cw6Hp5wUaf395LehwK",
- "language": "en-US",
- "name": "English (US)",
- "url": "/localizations/loc_g3L7Cw6Hp5wUaf395LehwK"
}
], - "createdAt": "2024-11-25T21:32:31Z",
- "updatedAt": "2024-11-25T21:32:31Z"
}
]
}
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" 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+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": "string",
- "description": "string",
- "url": "/templates/tem_g3L7Cw6Hp5wUaf395LehwK",
- "compiled": {
- "sender": "Example",
- "replyTo": "Example",
- "subject": "PGh0bWw+PC9odG1sPgo=",
- "html": "PGh0bWw+PC9odG1sPgo=",
- "text": "PGh0bWw+PC9odG1sPgo="
}, - "createdAt": "2024-11-25T21:32:31Z",
- "updatedAt": "2024-11-25T21:32:31Z",
- "localizations": [
- {
- "localization": "loc_g3L7Cw6Hp5wUaf395LehwK",
- "language": "en-US",
- "name": "English (US)",
- "url": "/localizations/loc_g3L7Cw6Hp5wUaf395LehwK"
}
]
}
Drafts represent unpublished versions of templates that are still mutable. There could be many in progress drafts for a template.
Returns all 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+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": "string",
- "description": "string",
- "url": "/drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU",
- "createdAt": "2024-11-25T21:32:31Z",
- "updatedAt": "2024-11-25T21:32:31Z"
}
]
}
Gets a 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" 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+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": "string",
- "url": "/drafts/tdft_g3L7Cw6Hp5wUaf395LehwK/dft_g3L7Cw6Hp5wU",
- "compiled": {
- "sender": "Example",
- "replyTo": "Example",
- "subject": "PGh0bWw+PC9odG1sPgo=",
- "html": "PGh0bWw+PC9odG1sPgo=",
- "text": "PGh0bWw+PC9odG1sPgo="
}, - "createdAt": "2024-11-25T21:32:31Z",
- "updatedAt": "2024-11-25T21:32:31Z",
- "localizations": [
- {
- "localization": "loc_g3L7Cw6Hp5wUaf395LehwK",
- "language": "en-US",
- "name": "English (US)",
- "url": "/localizations/loc_g3L7Cw6Hp5wUaf395LehwK"
}
]
}
Returns localization metadata for the draft
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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+json" |
A list of localizations
[- {
- "localization": "loc_g3L7Cw6Hp5wUaf395LehwK",
- "language": "en-US",
- "name": "English (US)",
- "url": "/localizations/loc_g3L7Cw6Hp5wUaf395LehwK"
}
]
Returns the list of values that need to be translated for the draft. Set the Accept
header to application/vnd.dyspatch.2019.10+json
to get a JSON object, or text/vnd.dyspatch.2019.10+x-gettext-translation
to get the POT file.
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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+json" |
Localization keys
[- {
- "key": "string",
- "comment": "string"
}
]
Moves the 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+json" |
Successfully submitted
Invalid request
Unauthenticated
Unauthorized
Resource not found
Rate limit exceeded
Server error
Server error
Completely replaces any existing translations for the given language with those provided in request body. Variables embedded in keys or values are expected to be in the format %(my_variable)s
and will automatically convert to the correct Dyspatch format depending on the type of template. Accepts key/value pairs in JSON format or in gettext PO file format. For JSON set Content-Type
header to application/json
. For gettext PO format set Content-Type
header to text/x-gettext-translation
.
draftId required | string A draft 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+json" |
property name* | string |
Successful
{- "Hello %(name)s": "Bonjour %(name)s",
- "Welcome": "Bienvenue"
}
Inserts a localization or sets the name on an existing localization that already uses the languageId
draftId required | string A draft 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+json" |
name | string |
Successful upsert
{- "name": "English (US)"
}
Deletes the localization with the given language ID if it exists
draftId required | string A draft 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+json" |
Successful delete
Localization objects are the same as Template objects except they contain localized content.
If your account is using localizations then use this instead of the compiled Template object.
Returns a specific localization object with a matching ID
localizationId required | string A localization ID |
targetLanguage required | string Enum: "html" "handlebars" "ampscript" "freemarker" "cheetah" "jinja" 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 "2019.10", set the value to "application/vnd.dyspatch.2019.10+json" |
A localization object with the requested ID
Invalid request
Unauthenticated
Unauthorized
Resource not found
Rate limit exceeded
Server error
Server error
{- "id": "loc_g3L7Cw6Hp5wUaf395LehwK",
- "language": "en-US",
- "url": "/localizations/loc_g3L7Cw6Hp5wUaf395LehwK",
- "template": "tem_g3L7Cw6Hp5wU",
- "compiled": {
- "sender": "Example",
- "replyTo": "Example",
- "subject": "PGh0bWw+PC9odG1sPgo=",
- "html": "PGh0bWw+PC9odG1sPgo=",
- "text": "PGh0bWw+PC9odG1sPgo="
}, - "createdAt": "2024-11-25T21:32:31Z",
- "updatedAt": "2024-11-25T21:32:31Z",
- "name": "English (US)"
}