> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parsalink.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Automation Templates API

> REST endpoints for browsing and installing automation templates from the template gallery.

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "linear-gradient(90deg, #143D4E 0%, #1C758A 100%)",
color: "#FFFFFF",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
boxShadow: "0 8px 24px rgba(20, 61, 78, 0.18)"
}}
>
  Automation
</div>

## Endpoints

<div
  style={{
background: "linear-gradient(135deg, rgba(20, 61, 78, 0.04) 0%, rgba(28, 117, 138, 0.08) 100%)",
border: "1px solid #CDD1D3",
borderRadius: "18px",
padding: "8px 12px 2px 12px",
marginBottom: "22px",
boxShadow: "0 10px 30px rgba(20, 61, 78, 0.06)"
}}
>
  | Method | Path                                       | Description                      |
  | ------ | ------------------------------------------ | -------------------------------- |
  | `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 |
</div>

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "rgba(48, 200, 202, 0.12)",
color: "#1C758A",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
border: "1px solid rgba(48, 200, 202, 0.28)"
}}
>
  Template Gallery
</div>

## List Templates

```http theme={null}
GET /api/automations/templates/
Authorization: Bearer <token>
```

<div
  style={{
 border: "1px solid rgba(48, 200, 202, 0.22)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#2C768D",
boxShadow: "0 10px 26px rgba(28, 117, 138, 0.08)"
}}
  className="bg-white dark:bg-black dark:border-white/10 dark:text-white [&_*]:dark:text-white dark:shadow-none"
>
  Returns all templates available in the gallery — both built-in templates and any custom templates your workspace has created.
</div>

**Query Parameters:**

<div
  style={{
background: "#FFFFFF, #2C768D",
border: "1px solid #CDD1D3",
borderRadius: "18px",
padding: "8px 12px 2px 12px",
marginBottom: "22px",
boxShadow: "0 10px 30px rgba(20, 61, 78, 0.05)",
}}
  className="dark:!bg-black dark:!border-white/10"
>
  | Parameter  | Type   | Description                                                                                   |
  | ---------- | ------ | --------------------------------------------------------------------------------------------- |
  | `category` | string | Filter by category (e.g., `lead_management`, `sales_pipeline`, `customer_success`, `support`) |
  | `trigger`  | string | Filter by trigger type                                                                        |
  | `search`   | string | Search by name or description                                                                 |
</div>

**Response:**

```json theme={null}
{
  "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"
    }
  ]
}
```

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "rgba(255, 111, 97, 0.12)",
color: "#FF6F61",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
border: "1px solid rgba(255, 111, 97, 0.24)"
}}
>
  Template Details
</div>

## Get a Template

```http theme={null}
GET /api/automations/templates/{id}/
Authorization: Bearer <token>
```

<div
  style={{
border: "1px solid rgba(255, 111, 97, 0.18)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#212121 ,#FFFFFF",    
boxShadow: "0 10px 26px rgba(20, 61, 78, 0.07)"
}}
  className="bg-white dark:bg-black dark:border-white/10 dark:text-white"
>
  Returns the full template definition including all steps and conditions.
</div>

**Response:**

```json theme={null}
{
  "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
}
```

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "linear-gradient(90deg, #143D4E 0%, #1C758A 100%)",
color: "#FFFFFF",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
boxShadow: "0 8px 24px rgba(20, 61, 78, 0.18)"
}}
>
  Installation
</div>

## Install a Template

<div
  style={{
border: "1px solid rgba(28, 117, 138, 0.18)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#212121 ,#FFFFFF",              
boxShadow: "0 10px 26px rgba(20, 61, 78, 0.07)"
}}
  className="bg-white dark:bg-black dark:border-white/10 dark:text-white"
>
  Installs a template into your workspace as a new, inactive automation rule. The installed rule is a full copy — you can modify it independently.
</div>

```http theme={null}
POST /api/automations/templates/{id}/install/
Authorization: Bearer <token>
Content-Type: application/json
```

**Request body (optional — override the name):**

```json theme={null}
{
  "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.

```json theme={null}
{
  "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](/api-reference/automations/rules#activate--deactivate-a-rule) to start it.

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "rgba(48, 200, 202, 0.12)",
color: "#1C758A",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
border: "1px solid rgba(48, 200, 202, 0.28)"
}}
>
  Custom Templates
</div>

## Creating Custom Templates

```http theme={null}
POST /api/automations/rules/{id}/save-as-template/
Authorization: Bearer <token>
Content-Type: application/json
```

**Request body:**

```json theme={null}
{
  "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.
