Documentation

DocsAPI ReferenceTemplates API

Templates API

GET/v1/templates

List templates.

TypeScript
const templates = await client.listTemplates();
curl
curl https://api.outreachagent.dev/v1/templates \
  -H "Authorization: Bearer $OUTREACHAGENT_API_KEY"
POST/v1/templates

Create a new template.

ParameterTypeRequiredDescription
namestringYesTemplate name
subjectstringYesSubject line (supports Liquid)
htmlstringNoHTML body (supports Liquid)
textstringNoPlaintext body (supports Liquid). When only text is provided, the email is sent as plaintext-only
bodystringNoAlias for text — plaintext body content
TypeScript
const tmpl = await client.createTemplate({
  name: "Follow Up",
  subject: "Re: {{ contact.attributes.topic }}",
  body: "Hi {{ contact.fullName }}, following up on {{ contact.attributes.topic }}."
});
curl
curl -X POST https://api.outreachagent.dev/v1/templates \
  -H "Authorization: Bearer $OUTREACHAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Follow Up","subject":"Re: {{ contact.attributes.topic }}","body":"Hi {{ contact.fullName }}, following up."}'
GET/v1/templates/:templateId

Get template details.

TypeScript
const tmpl = await client.getTemplate("tmpl_abc123");
curl
curl https://api.outreachagent.dev/v1/templates/tmpl_abc123 \
  -H "Authorization: Bearer $OUTREACHAGENT_API_KEY"
PATCH/v1/templates/:templateId

Update a template.

ParameterTypeRequiredDescription
namestringNoUpdated name
subjectstringNoUpdated subject
htmlstringNoUpdated HTML body
textstringNoUpdated plaintext body
bodystringNoAlias for text
TypeScript
await client.updateTemplate("tmpl_abc123", { subject: "Updated: {{ contact.attributes.topic }}" });
curl
curl -X PATCH https://api.outreachagent.dev/v1/templates/tmpl_abc123 \
  -H "Authorization: Bearer $OUTREACHAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject": "Updated: {{ contact.attributes.topic }}"}'
DELETE/v1/templates/:templateId

Delete a template.

TypeScript
await client.deleteTemplate("tmpl_abc123");
curl
curl -X DELETE https://api.outreachagent.dev/v1/templates/tmpl_abc123 \
  -H "Authorization: Bearer $OUTREACHAGENT_API_KEY"
POST/v1/templates/:templateId/preview

Preview a template with variables. Returns rendered HTML and any missing variables.

ParameterTypeRequiredDescription
variablesobjectYesKey-value pairs for Liquid variables
TypeScript
const preview = await client.previewTemplate("tmpl_abc123", {
  fullName: "Jane",
  topic: "our partnership"
});
// preview.missingVariables = []
curl
curl -X POST https://api.outreachagent.dev/v1/templates/tmpl_abc123/preview \
  -H "Authorization: Bearer $OUTREACHAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"variables": {"fullName": "Jane", "topic": "our partnership"}}'