Templates

Templates are the reusable emails, texts and scripts your team builds in the dashboard. Use these routes to find a template's template_id, read its content, or fill in its merge fields for one contact before you send.

You build and edit templates in the dashboard. Where a send takes a template:

  • Emails: POST /email/public/email/merged-template. See Email.
  • RCS texts: template_id on POST /sms. See Texts.
  • Email campaigns: email_template_id. See Campaigns.

Routes

Method Route Scope What it does
GET /template/public/templates contacts:read List your templates
GET /template/public/templates/{template_id} contacts:read Get one template
POST /template/public/templates/{template_id}/merge contacts:read Fill in a template for a contact

List your templates

Returns templates newest first. With no limit, every match is returned.

Field Type Required Description
type string No email, sms, rcs, script, chat or macro.
status string No active or draft. Default: both.
search string No Matches the name or content, ignoring case.
skip integer No Templates to skip. Default 0.
limit integer No Page size.
curl "https://api-v2.dropcowboy.com/template/public/templates?type=email&status=active&limit=20" \
  -H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET"
{
  "data": {
    "templates": [
      {
        "_id": "66f2b1c4e8a9d3f1a2b4c6d9",
        "team_id": "cd5cd773-4617-4b28-854d-d3adc74c96d5",
        "user_id": "fa933d82-485f-43b0-80ab-860121f06980",
        "template_id": "be51cd74-12cd-4cc0-bc58-701d3292564d",
        "name": "Appointment reminder",
        "description": "Sent the day before a booking",
        "type": "email",
        "status": "active",
        "subject": "See you tomorrow, {{contact.first_name|there}}",
        "preview": "A reminder about your appointment tomorrow.",
        "text": "Hi {{contact.first_name|there}}, this is {{user.first_name}} confirming your appointment tomorrow.",
        "html_text": "<p>Hi {{contact.first_name|there}}, this is {{user.first_name}} confirming your appointment tomorrow.</p>",
        "attachments": [],
        "created_at": 1757491200000,
        "created_by": "fa933d82-485f-43b0-80ab-860121f06980",
        "updated_at": 1759312800000,
        "updated_by": "fa933d82-485f-43b0-80ab-860121f06980",
        "deleted_at": null
      }
    ],
    "totalItems": 1
  },
  "meta": { "request_id": "1e979536-0ee5-4b32-ae35-80826b24079e" }
}

data.totalItems counts every match, not just this page. Timestamps are epoch milliseconds. RCS templates also carry rcs_type, rcs_content and fallback_sms_text.

Get a template

curl https://api-v2.dropcowboy.com/template/public/templates/be51cd74-12cd-4cc0-bc58-701d3292564d \
  -H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET"

The response is one template, with the same fields as in the list.

If no template on your account has that id, the call returns 404.

Fill in a template for a contact

Returns the template with every merge field replaced by the contact's values. Use it to preview what a contact will receive, or to send the result through your own channel.

Field Type Required Description
merged_contact_id string Yes The contact whose fields fill the template.
merged_user_id string No The team member whose fields fill user merge fields, such as the sender's name. Default: the user the API key belongs to.
curl -X POST https://api-v2.dropcowboy.com/template/public/templates/be51cd74-12cd-4cc0-bc58-701d3292564d/merge \
  -H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "merged_contact_id": "487d8607-e415-4d90-a1e1-f9c1a746e0a1" }'
{
  "data": {
    "subject": "See you tomorrow, Jordan",
    "html_text": "<p>Hi Jordan, this is Sam confirming your appointment tomorrow.</p>",
    "attachments": []
  },
  "meta": { "request_id": "6bd7057f-747b-454e-bcc3-5185c9017a90" }
}

For an RCS template, data holds rcs_type, the filled-in rcs_content and fallback_sms_text. Its subject and html_text are empty strings.

Merge fields look like {{contact.first_name}}, {{contact.custom.lead_source}} or {{user.first_name}}. Add a default after |, for example {{contact.first_name|there}}, for contacts with that field empty.

Errors

Status When What to do
400 merged_contact_id is missing. Send the contact's id.
404 Template not found, Contact not found or User not found. Check each id. Find templates with List your templates and contacts with Contacts.

For every other error, see Responses, errors and limits.

Code samples

The requests from this page, ready to copy. Set DC_KEY and DC_SECRET to your API key pair first.

List your templates
curl "https://api-v2.dropcowboy.com/template/public/templates?type=email&status=active&limit=20" \
  -H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET"
Get a template
curl https://api-v2.dropcowboy.com/template/public/templates/be51cd74-12cd-4cc0-bc58-701d3292564d \
  -H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET"
Fill in a template for a contact
curl -X POST https://api-v2.dropcowboy.com/template/public/templates/be51cd74-12cd-4cc0-bc58-701d3292564d/merge \
  -H "x-key: $DC_KEY" -H "x-secret: $DC_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "merged_contact_id": "487d8607-e415-4d90-a1e1-f9c1a746e0a1" }'