AISARAISAR
REST API

Automations

Visual workflow automations: a trigger (event/channel/conditions) fires a graph of nodes and edges — sending messages, moving a deal stage, HTTP calls, conditional branches. Automation metadata (`name`, `status`) is updated via `PATCH /automations/{id}`, while the graph itself is saved through a dedicated `PATCH /automations/{id}/builder` endpoint. Each execution is logged as a `run` with a step-by-step trace.

Endpoints

MethodPath
GET/v1/automations/bootstrap

Bootstrap data for the visual editor

GET/v1/automations

List automations

GET/v1/automations/{automation}

Get an automation

POST/v1/automations

Create an automation

PATCH/v1/automations/{automation}

Update automation metadata

PATCH/v1/automations/{automation}/builder

Save the visual graph (nodes, edges, triggers)

DELETE/v1/automations/{automation}

Delete an automation

GET/v1/automations/{automation}/runs

List automation runs

GET/v1/automations/{automation}/runs/{run}

Get a specific run with its steps

Examples

Create an automation

Request

bash
curl -X POST https://api.aisar.app/v1/automations \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome automation",
    "description": "Sends a greeting on the first inbound message",
    "status": "draft"
  }'

Response

json
{
  "data": {
    "id": "b4a8e0d2-7f2f-4fef-9d53-c525f31b1930",
    "companyId": "1",
    "name": "Welcome automation",
    "description": "Sends a greeting on the first inbound message",
    "status": "draft",
    "healthStatus": "ok",
    "activeVersionId": null,
    "latestVersionId": null,
    "templateId": null,
    "executionsCount": 0,
    "lastRunAt": null,
    "createdAt": "2026-03-15T10:00:00.000000Z",
    "updatedAt": "2026-03-15T10:00:00.000000Z",
    "createdBy": "5",
    "updatedBy": "5"
  }
}

Get an automation run

Request

bash
curl https://api.aisar.app/v1/automations/b4a8e0d2-7f2f-4fef-9d53-c525f31b1930/runs/9001 \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response

json
{
  "data": {
    "id": 9001,
    "automation_id": "b4a8e0d2-7f2f-4fef-9d53-c525f31b1930",
    "version_id": "v3",
    "status": "completed",
    "trigger_payload": { "event": "message.created", "channel_id": 7 },
    "started_at": "2026-03-15T10:00:00+00:00",
    "finished_at": "2026-03-15T10:00:02+00:00",
    "duration_ms": 1840,
    "pii_redacted": false,
    "total_cost_usd": 0.000412,
    "total_tokens": 210,
    "steps": []
  }
}