Documentation
DocsAPI ReferenceTemplates API
Templates API
GET
/v1/templatesList templates.
TypeScript
const templates = await client.listTemplates();
curl
curl https://api.outreachagent.dev/v1/templates \ -H "Authorization: Bearer $OUTREACHAGENT_API_KEY"
POST
/v1/templatesCreate a new template.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Template name |
| subject | string | Yes | Subject line (supports Liquid) |
| html | string | No | HTML body (supports Liquid) |
| text | string | No | Plaintext body (supports Liquid). When only text is provided, the email is sent as plaintext-only |
| body | string | No | Alias 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/:templateIdGet 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/:templateIdUpdate a template.
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | No | Updated name |
| subject | string | No | Updated subject |
| html | string | No | Updated HTML body |
| text | string | No | Updated plaintext body |
| body | string | No | Alias 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/:templateIdDelete 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/previewPreview a template with variables. Returns rendered HTML and any missing variables.
| Parameter | Type | Required | Description |
|---|---|---|---|
| variables | object | Yes | Key-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"}}'