Skip to content

Templates

Reusable content that steps, broadcasts and transactional emails can copy.

View as Markdown

List templates

GET/projects/{project_id}/templates

Newest first, without content; get one template for it.

Parameters

NameInTypeNotes
project_idpathstringRequired
cursorquerystring | nullOptional
limitqueryintegerOptional, default 50
Request
curl "https://sendocado.com/api/v1/projects/$PROJECT_ID/templates" \
  -H "Authorization: Bearer $SENDOCADO_API_KEY"
Response 200
{
  "templates": [
    {
      "id": "29be2u66mr26846p7q9m2i0hz2uep1en",
      "name": "Receipt",
      "subject": "Your Acme receipt for {{ variables.order_number }}",
      "created_at": 1789136000000
    }
  ],
  "next_cursor": null
}

Errors

StatusTypeExample message
400invalid_datalimit: Too big: expected number to be <=200
401unauthorizedSend a valid API key as "Authorization: Bearer sc_…", or sign in.
404project_not_foundProject not found.
429rate_limitedToo many requests. Try again in 12 seconds.

Create a template

POST/projects/{project_id}/templates

Content is html or markdown; text and merge_tags in the response are worked out from it.

Parameters

NameInTypeNotes
project_idpathstringRequired

Body

Send JSON with every field; use null for a value you do not set.

FieldTypeNotes
namestringRequired
subjectstringRequired
preview_textstring | nullRequired
htmlstring | nullRequired
markdownstring | nullRequired
Request
curl -X POST "https://sendocado.com/api/v1/projects/$PROJECT_ID/templates" \
  -H "Authorization: Bearer $SENDOCADO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Receipt",
  "subject": "Your Acme receipt for {{ variables.order_number }}",
  "preview_text": null,
  "html": "<p>Thanks for your order, {{ first_name | there }}.</p>\n<p>Order {{ variables.order_number }}: {{ variables.total }}</p>\n",
  "markdown": null
}'
Response 201
{
  "id": "29be2u66mr26846p7q9m2i0hz2uep1en",
  "project_id": "ujzde8gxd6ncf10epf91dhodzdoc9is0",
  "name": "Receipt",
  "subject": "Your Acme receipt for {{ variables.order_number }}",
  "preview_text": null,
  "html": "<p>Thanks for your order, {{ first_name | there }}.</p>\n<p>Order {{ variables.order_number }}: {{ variables.total }}</p>\n",
  "text": "Thanks for your order, {{ first_name | there }}.\n\nOrder {{ variables.order_number }}: {{ variables.total }}",
  "merge_tags": ["first_name", "variables.order_number", "variables.total"],
  "created_at": 1789136000000
}

Errors

StatusTypeExample message
400invalid_dataSend a JSON request body.
401unauthorizedSend a valid API key as "Authorization: Bearer sc_…", or sign in.
404project_not_foundProject not found.
429rate_limitedToo many requests. Try again in 12 seconds.

Get a template

GET/templates/{template_id}

The template’s content, with its plain text and merge tags.

Parameters

NameInTypeNotes
template_idpathstringRequired
Request
curl "https://sendocado.com/api/v1/templates/$TEMPLATE_ID" \
  -H "Authorization: Bearer $SENDOCADO_API_KEY"
Response 200
{
  "id": "29be2u66mr26846p7q9m2i0hz2uep1en",
  "project_id": "ujzde8gxd6ncf10epf91dhodzdoc9is0",
  "name": "Receipt",
  "subject": "Your Acme receipt for {{ variables.order_number }}",
  "preview_text": null,
  "html": "<p>Thanks for your order, {{ first_name | there }}.</p>\n<p>Order {{ variables.order_number }}: {{ variables.total }}</p>\n",
  "text": "Thanks for your order, {{ first_name | there }}.\n\nOrder {{ variables.order_number }}: {{ variables.total }}",
  "merge_tags": ["first_name", "variables.order_number", "variables.total"],
  "created_at": 1789136000000
}

Errors

StatusTypeExample message
401unauthorizedSend a valid API key as "Authorization: Bearer sc_…", or sign in.
404template_not_foundTemplate not found.
429rate_limitedToo many requests. Try again in 12 seconds.

Update a template

PUT/templates/{template_id}

Emails already made from the template keep their own copy of its content.

Parameters

NameInTypeNotes
template_idpathstringRequired

Body

Send JSON with every field; use null for a value you do not set.

FieldTypeNotes
namestringRequired
subjectstringRequired
preview_textstring | nullRequired
htmlstring | nullRequired
markdownstring | nullRequired
Request
curl -X PUT "https://sendocado.com/api/v1/templates/$TEMPLATE_ID" \
  -H "Authorization: Bearer $SENDOCADO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Receipt",
  "subject": "Your Acme receipt for {{ variables.order_number }}",
  "preview_text": null,
  "html": "<p>Thanks for your order, {{ first_name | there }}.</p>\n<p>Order {{ variables.order_number }}: {{ variables.total }}</p>\n",
  "markdown": null
}'
Response 200
{
  "id": "29be2u66mr26846p7q9m2i0hz2uep1en",
  "project_id": "ujzde8gxd6ncf10epf91dhodzdoc9is0",
  "name": "Receipt",
  "subject": "Your Acme receipt for {{ variables.order_number }}",
  "preview_text": null,
  "html": "<p>Thanks for your order, {{ first_name | there }}.</p>\n<p>Order {{ variables.order_number }}: {{ variables.total }}</p>\n",
  "text": "Thanks for your order, {{ first_name | there }}.\n\nOrder {{ variables.order_number }}: {{ variables.total }}",
  "merge_tags": ["first_name", "variables.order_number", "variables.total"],
  "created_at": 1789136000000
}

Errors

StatusTypeExample message
400invalid_dataSend a JSON request body.
401unauthorizedSend a valid API key as "Authorization: Bearer sc_…", or sign in.
404template_not_foundTemplate not found.
429rate_limitedToo many requests. Try again in 12 seconds.

Delete a template

DELETE/templates/{template_id}

Emails made from it keep their copy of the content.

Parameters

NameInTypeNotes
template_idpathstringRequired
Request
curl -X DELETE "https://sendocado.com/api/v1/templates/$TEMPLATE_ID" \
  -H "Authorization: Bearer $SENDOCADO_API_KEY"

Answers 204 with no body.

Errors

StatusTypeExample message
401unauthorizedSend a valid API key as "Authorization: Bearer sc_…", or sign in.
404template_not_foundTemplate not found.
429rate_limitedToo many requests. Try again in 12 seconds.