Skip to Content
sesameSend

Templates

Create and manage Templates

Retrieve a list of templates

GET /templates

Query parameters

NameTypeRequiredDescription
limitintegernoNumber of items to return.
afterstringnoReturn items after this cursor.
beforestringnoReturn items before this cursor.

Example

curl -X GET "$SESAMESEND_URL/templates" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "list",
  "data": [
    {
      "id": "string",
      "name": "string",
      "status": "draft",
      "published_at": "2023-10-06 23:47:56.678+00",
      "created_at": "2023-10-06 23:47:56.678+00",
      "updated_at": "2023-10-06 23:47:56.678+00",
      "alias": "string"
    }
  ],
  "has_more": true
}

Create a template

POST /templates

Body

FieldTypeRequiredDescription
namestringyesThe name of the template.
aliasstringnoThe alias of the template.
fromstringnoSender email address. To include a friendly name, use the format "Your Name <sender@example.com>".
subjectstringnoEmail subject.
reply_tostring[]noReply-to email addresses.
htmlstringyesThe HTML version of the template.
textstringnoThe plain text version of the template.
variablesobject[]no
variables[].keystringyesThe key of the variable.
variables[].type"string" | "number" | "boolean" | "object" | "list"yesThe type of the variable.
variables[].fallback_valuestring | number | boolean | object | any[]noThe fallback value of the variable.

Example

curl -X POST "$SESAMESEND_URL/templates" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "html": "string"
}'

Responses

StatusDescription
201OK
{
  "id": "string",
  "object": "template"
}

Retrieve a single template

GET /templates/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Template ID or alias.

Example

curl -X GET "$SESAMESEND_URL/templates/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "template",
  "id": "string",
  "current_version_id": "string",
  "name": "string",
  "alias": "string",
  "from": "string",
  "subject": "string",
  "reply_to": null,
  "html": "string",
  "text": "string",
  "variables": [
    {
      "id": "string",
      "key": "string",
      "type": "string",
      "fallback_value": "string",
      "created_at": "2023-10-06 23:47:56.678+00",
      "updated_at": "2023-10-06 23:47:56.678+00"
    }
  ],
  "created_at": "2023-10-06 23:47:56.678+00",
  "updated_at": "2023-10-06 23:47:56.678+00",
  "status": "draft",
  "published_at": "2023-10-06 23:47:56.678+00",
  "has_unpublished_versions": true
}

Update an existing template

PATCH /templates/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Template ID or alias.

Body

FieldTypeRequiredDescription
namestringnoThe name of the template.
aliasstringnoThe alias of the template.
fromstringnoSender email address. To include a friendly name, use the format "Your Name <sender@example.com>".
subjectstringnoEmail subject.
reply_tostring[]noReply-to email addresses.
htmlstringnoThe HTML version of the template.
textstringnoThe plain text version of the template.
variablesobject[]no
variables[].keystringyesThe key of the variable.
variables[].type"string" | "number" | "boolean" | "object" | "list"yesThe type of the variable.
variables[].fallback_valuestring | number | boolean | object | any[]noThe fallback value of the variable.

Example

curl -X PATCH "$SESAMESEND_URL/templates/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Responses

StatusDescription
200OK
{
  "id": "string",
  "object": "template"
}

Remove an existing template

DELETE /templates/{id}

Path parameters

NameTypeRequiredDescription
idstringyesThe Template ID or alias.

Example

curl -X DELETE "$SESAMESEND_URL/templates/<id>" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "object": "template",
  "id": "string",
  "deleted": true
}

Publish a template

POST /templates/{id}/publish

Path parameters

NameTypeRequiredDescription
idstringyesThe Template ID or alias.

Example

curl -X POST "$SESAMESEND_URL/templates/<id>/publish" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "id": "string",
  "object": "template"
}

Duplicate a template

POST /templates/{id}/duplicate

Path parameters

NameTypeRequiredDescription
idstringyesThe Template ID or alias.

Example

curl -X POST "$SESAMESEND_URL/templates/<id>/duplicate" \
  -H "Authorization: Bearer $OPENSEND_API_KEY"

Responses

StatusDescription
200OK
{
  "id": "string",
  "object": "template"
}