Skip to main content

Endpoints

MethodPathDescription
GET/api/automations/templates/List available templates
GET/api/automations/templates/{id}/Get a template
POST/api/automations/templates/{id}/install/Install a template as a new rule

List Templates

GET /api/automations/templates/
Authorization: Bearer <token>
Returns all templates available in the gallery — both built-in templates and any custom templates your workspace has created. Query Parameters:
ParameterTypeDescription
categorystringFilter by category (e.g., lead_management, sales_pipeline, customer_success, support)
triggerstringFilter by trigger type
searchstringSearch by name or description
Response:
{
  "count": 8,
  "results": [
    {
      "id": "tmpl_01HX...",
      "name": "New Lead Welcome Sequence",
      "description": "Sends a welcome email immediately and creates a follow-up task after 2 days.",
      "category": "lead_management",
      "trigger": "lead_created",
      "stepCount": 3,
      "isBuiltIn": true,
      "createdAt": "2024-12-01T00:00:00Z"
    },
    {
      "id": "tmpl_02HX...",
      "name": "Proposal Follow-Up Sequence",
      "description": "Follows up 2 days after a proposal is sent, with a second follow-up if not yet viewed.",
      "category": "sales_pipeline",
      "trigger": "proposal_status_changed",
      "stepCount": 5,
      "isBuiltIn": true,
      "createdAt": "2024-12-01T00:00:00Z"
    }
  ]
}

Get a Template

GET /api/automations/templates/{id}/
Authorization: Bearer <token>
Returns the full template definition including all steps and conditions. Response:
{
  "id": "tmpl_01HX...",
  "name": "New Lead Welcome Sequence",
  "description": "Sends a welcome email immediately and creates a follow-up task after 2 days.",
  "category": "lead_management",
  "trigger": "lead_created",
  "triggerConditions": [],
  "exitConditions": [
    { "field": "status", "operator": "eq", "value": "converted" }
  ],
  "steps": [
    {
      "type": "send_email",
      "order": 1,
      "label": "Send welcome email",
      "config": {
        "mode": "ai_generated",
        "prompt": "Write a friendly welcome email to {{lead.firstName}} introducing {{workspace.name}} and offering a 15-minute intro call."
      }
    },
    {
      "type": "wait",
      "order": 2,
      "config": { "duration": 2, "unit": "days" }
    },
    {
      "type": "create_task",
      "order": 3,
      "label": "Create follow-up task",
      "config": {
        "name": "Follow up with {{lead.firstName}} at {{lead.company}}",
        "assignTo": "assigned_user",
        "dueDays": 1
      }
    }
  ],
  "isBuiltIn": true,
  "installCount": 312
}

Install a Template

Installs a template into your workspace as a new, inactive automation rule. The installed rule is a full copy — you can modify it independently.
POST /api/automations/templates/{id}/install/
Authorization: Bearer <token>
Content-Type: application/json
Request body (optional — override the name):
{
  "name": "My Custom Welcome Sequence"
}
If no name is provided, the installed rule inherits the template name. Response: 201 Created — returns the new automation rule object.
{
  "id": "rul_05HX...",
  "name": "New Lead Welcome Sequence",
  "trigger": "lead_created",
  "isActive": false,
  "installedFromTemplateId": "tmpl_01HX...",
  "stepCount": 3,
  "createdAt": "2025-03-25T10:00:00Z"
}
After installing, configure the rule’s email templates and assigned users, then call the activate endpoint to start it.

Creating Custom Templates

To share an automation as a reusable template within your workspace, use the save-as-template endpoint on an existing rule:
POST /api/automations/rules/{id}/save-as-template/
Authorization: Bearer <token>
Content-Type: application/json
Request body:
{
  "name": "My Custom Nurture Sequence",
  "description": "A 3-email nurture sequence for mid-funnel leads.",
  "category": "lead_management"
}
Response: 201 Created with the new template object. Custom templates are only visible to your workspace and are not listed in the global gallery.