Skip to main content
Use these endpoints to manage the full lifecycle of your message templates — from creation with merge tokens to updates with attached images. All template endpoints use the /v1/template base path.

Create a template

POST /v1/template
title
string
required
Display name for the template.
content
object
required
A GalleryContent object. Must include text and optionally a gallery array of image objects.
local_id
string
Client-provided unique identifier for mapping to your own records.
archived
boolean
Set to true to create the template in an archived state.
curl --request POST \
  --url https://api.heymarket.com/v1/template \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "Welcome message",
    "local_id": "88ae517b-ff42-4ef2-958d-86b27db6b21c",
    "content": {
      "text": "Hey {{first_name}} {{last_name}}, welcome to our service!"
    },
    "archived": false
  }'
{
  "id": 101,
  "rev": 1,
  "uuid": "88ae517b-ff42-4ef2-958d-86b27db6b21c"
}

Get a template

GET /v1/template/{id}
id
integer
required
The ID of the template to retrieve.
curl --request GET \
  --url https://api.heymarket.com/v1/template/101 \
  --header 'Authorization: Bearer YOUR_API_KEY'
{
  "id": 101,
  "name": "Welcome message",
  "local_id": "88ae517b-ff42-4ef2-958d-86b27db6b21c",
  "content": {
    "text": "Hey {{first_name}} {{last_name}}, welcome to our service!",
    "gallery": []
  },
  "shared": true,
  "archived": false,
  "rev": 1
}

List templates

POST /v1/templates Returns up to 30 of your most recent templates by default. Pass a date to page through older results.
date
string
RFC 3339 timestamp. Returns templates updated before this date, enabling pagination.
curl --request POST \
  --url https://api.heymarket.com/v1/templates \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{}'

Update a template

PUT /v1/template/{id} Accepts the same body as the create endpoint. You can update the title, content, gallery images, or archived status.
id
integer
required
The ID of the template to update.
curl --request PUT \
  --url https://api.heymarket.com/v1/template/101 \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "Welcome with image",
    "local_id": "88ae517b-ff42-4ef2-958d-86b27db6b21c",
    "content": {
      "text": "Hey {{first_name}}, check this out!",
      "gallery": [
        {
          "url": "https://example.com/image.jpg",
          "original_url": "https://example.com/image.jpg"
        }
      ]
    }
  }'

Delete a template

DELETE /v1/template/{id}
id
integer
required
The ID of the template to delete.
curl --request DELETE \
  --url https://api.heymarket.com/v1/template/101 \
  --header 'Authorization: Bearer YOUR_API_KEY'
"ok"
To send a template as a message, pass the template’s id as the template_id field when calling POST /v1/message/send. Merge tokens are resolved automatically from the recipient contact’s fields.