Dyspatch API (2019.03)

Introduction

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.

API Client Libraries

Dyspatch provides API Clients for popular languages and web frameworks.

Authentication

Bearer

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.03+json'
Security Scheme Type API Key
Header parameter name: Authorization

Templates

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.

List Templates

Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.

Authorizations:
query Parameters
cursor
string

A cursor value used to retrieve a specific page from a paginated result set.

header Parameters
Accept
required
string

A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"

Responses

200

A list of templates

400

Invalid request

401

Unauthenticated

403

Unauthorized

429

Rate limit exceeded

500

Server error

default

Server error

get/templates
https://api.dyspatch.io/templates

Response samples

Content type
application/vnd.dyspatch.2019.03+json
Copy
Expand all Collapse all
{
  • "cursor":
    {
    },
  • "data":
    [
    ]
}

Get Template by ID

Gets a template object with the matching ID. Templates without a published draft will result in an error.

Authorizations:
path Parameters
templateId
required
string

A template ID

query Parameters
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.

header Parameters
Accept
required
string

A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"

Responses

200

A template object with the requested ID. Templates without a published draft will result in an error.

400

Invalid request

401

Unauthenticated

403

Unauthorized

404

Resource not found

429

Rate limit exceeded

500

Server error

default

Server error

get/templates/{templateId}
https://api.dyspatch.io/templates/{templateId}

Response samples

Content type
application/vnd.dyspatch.2019.03+json
Copy
Expand all Collapse all
{
  • "id": "tem_g3L7Cw6Hp5wU",
  • "name": "string",
  • "description": "string",
  • "url": "/templates/tem_g3L7Cw6Hp5wUaf395LehwK",
  • "compiled":
    {
    },
  • "createdAt": "2024-11-25T21:32:30Z",
  • "updatedAt": "2024-11-25T21:32:30Z",
  • "localizations":
    [
    ]
}

Localizations

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.

Get Localization Object by ID

Returns a specific localization object with a matching ID

Authorizations:
path Parameters
localizationId
required
string

A localization ID

query Parameters
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.

header Parameters
Accept
required
string

A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"

Responses

200

A localization object with the requested ID

400

Invalid request

401

Unauthenticated

403

Unauthorized

404

Resource not found

429

Rate limit exceeded

500

Server error

default

Server error

get/localizations/{localizationId}
https://api.dyspatch.io/localizations/{localizationId}

Response samples

Content type
application/vnd.dyspatch.2019.03+json
Copy
Expand all Collapse all
{
  • "id": "loc_g3L7Cw6Hp5wUaf395LehwK",
  • "language": "en-US",
  • "url": "/localizations/loc_g3L7Cw6Hp5wUaf395LehwK",
  • "template": "tem_g3L7Cw6Hp5wU",
  • "compiled":
    {
    },
  • "createdAt": "2024-11-25T21:32:30Z",
  • "updatedAt": "2024-11-25T21:32:30Z",
  • "name": "English (US)"
}