Skip to content
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. Through this API you manage automations and their metadata, save the visual graph through a dedicated endpoint, and read the run log with its step-by-step trace.

Metadata and the graph

Automation metadata (name, status) is updated via PATCH /automations/{id}, while the graph itself is saved through a dedicated PATCH /automations/{id}/builder endpoint. When saving the graph via PATCH /automations/{id}/builder, the nodes field is required (an array with at least 1 element).

Runs

Each execution is logged as a run with a step-by-step trace.

Bootstrap for the editor

GET /automations/bootstrap returns reference data for the editor (the action catalog, existing automations, versions, nodes, edges, triggers and templates).

Voice attachments

For voice messages sent from the whatsapp-send-message / telegram-send-message actions (when voice_mode=upload), the audio is uploaded ahead of time via POST /automations/media/voice — unlike the rest of the API, this endpoint returns its response without the data wrapper.

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

POST/v1/automations/media/voice

Upload a voice attachment (voice_mode=upload) for message-sending actions

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": []
  }
}

Bootstrap catalog for the visual editor

Request

bash
curl https://api.aisar.app/v1/automations/bootstrap \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response

json
{
  "data": {
    "automations": [],
    "versions": [],
    "nodes": [],
    "edges": [],
    "triggers": [],
    "triggerConditions": [],
    "triggerChannelPivots": [],
    "configs": [],
    "runs": [],
    "runSteps": [],
    "templateCategories": [],
    "templates": [],
    "templateDefinitions": {},
    "actionGroups": [],
    "applicationSources": [],
    "actionLibraryGroups": []
  }
}

Save the visual graph (nodes, edges, triggers)

Request

bash
curl -X PATCH https://api.aisar.app/v1/automations/b4a8e0d2-7f2f-4fef-9d53-c525f31b1930/builder \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nodes": [
      { "id": "n1", "type": "trigger", "position": { "x": 0, "y": 0 }, "actionId": null, "data": {} },
      { "id": "n2", "type": "action", "position": { "x": 240, "y": 0 }, "actionId": "whatsapp-send-message", "data": {} }
    ],
    "edges": [
      { "id": "e1", "source": "n1", "target": "n2", "label": null, "sourceHandle": null, "targetHandle": null, "data": {} }
    ],
    "triggers": [
      { "id": "t1", "channelType": "whatsapp", "channels": [7], "event": "message.created", "conditionsJoiner": "and", "conditions": [{ "type": "text_contains", "value": "hello" }] }
    ]
  }'

Upload a voice attachment for an automation

Request

bash
curl -X POST https://api.aisar.app/v1/automations/media/voice \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F "file=@greeting.ogg;type=audio/ogg"

Response

json
{
  "media_id": "med_01HZABCDEFGHIJKLMNOPQRSTUV",
  "type": "audio",
  "mime_type": "audio/ogg",
  "size": 24576,
  "duration": 7,
  "expires_at": "2026-07-11T10:30:00.000000Z"
}