agentlyleads docs
Workflows API

API Reference

The reference below covers every endpoint in the Workflows API. Code examples are generated automatically; the live playground is disabled to prevent accidental writes to production from the docs site.

GET/api/v1/workflows

Authorization

BearerAuth
AuthorizationBearer <token>

Pass an API key issued from the agentlyleads workspace settings. Example: Authorization: Bearer alk_live_xxxxxxxxxxxx

In: header

Query Parameters

entity?string

Only workflows on this record type. Case-insensitive.

Value in

  • "LEAD"
  • "CONTACT"
  • "DEAL"
  • "EMAIL"
  • "TASK"
trigger?string

Value in

  • "CREATED"
  • "STATUS_CHANGED"
  • "STAGE_CHANGED"
  • "REPLY_RECEIVED"
  • "STALLED"
  • "TIME_IN_STAGE"
active?string

Value in

  • "true"
  • "false"

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/workflows"
{  "workflows": [    {      "id": "string",      "name": "string",      "entity": "LEAD",      "trigger": "CREATED",      "active": true,      "conditions": [        {          "field": "string",          "op": "eq",          "value": "string"        }      ],      "triggerConfig": {        "idleDays": 1,        "stage": "NEW",        "days": 1      },      "actions": [        {          "type": "CREATE_TASK"        }      ],      "runCount": 0,      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z"    }  ]}
{  "error": "products must not be empty."}
{  "error": "Invalid or missing API key."}
{  "error": "API key missing required scope: write:workflows."}
POST/api/v1/workflows

Authorization

BearerAuth
AuthorizationBearer <token>

Pass an API key issued from the agentlyleads workspace settings. Example: Authorization: Bearer alk_live_xxxxxxxxxxxx

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/workflows" \  -H "Content-Type: application/json" \  -d '{    "name": "Round-robin web leads",    "entity": "LEAD",    "trigger": "CREATED",    "conditions": [      {        "field": "source",        "op": "contains",        "value": "Web form"      }    ],    "actions": [      {        "type": "ASSIGN_ROUND_ROBIN"      },      {        "type": "CREATE_TASK",        "title": "Call within a day",        "dueInDays": 1,        "assignToOwner": true      }    ]  }'
{  "workflow": {    "id": "string",    "name": "string",    "entity": "LEAD",    "trigger": "CREATED",    "active": true,    "conditions": [      {        "field": "string",        "op": "eq",        "value": "string"      }    ],    "triggerConfig": {      "idleDays": 1,      "stage": "NEW",      "days": 1    },    "actions": [      {        "type": "CREATE_TASK"      }    ],    "runCount": 0,    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}
{  "error": "The REPLY_RECEIVED trigger only works on CONTACT workflows."}
{  "error": "Invalid or missing API key."}
{  "error": "API key missing required scope: write:workflows."}
GET/api/v1/workflows/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

Pass an API key issued from the agentlyleads workspace settings. Example: Authorization: Bearer alk_live_xxxxxxxxxxxx

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/workflows/string"
{  "workflow": {    "id": "string",    "name": "string",    "entity": "LEAD",    "trigger": "CREATED",    "active": true,    "conditions": [      {        "field": "string",        "op": "eq",        "value": "string"      }    ],    "triggerConfig": {      "idleDays": 1,      "stage": "NEW",      "days": 1    },    "actions": [      {        "type": "CREATE_TASK"      }    ],    "runCount": 0,    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}
{  "error": "Invalid or missing API key."}
{  "error": "API key missing required scope: write:workflows."}
{  "error": "Workflow not found."}
PATCH/api/v1/workflows/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

Pass an API key issued from the agentlyleads workspace settings. Example: Authorization: Bearer alk_live_xxxxxxxxxxxx

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/api/v1/workflows/string" \  -H "Content-Type: application/json" \  -d '{    "active": false  }'
{  "workflow": {    "id": "string",    "name": "string",    "entity": "LEAD",    "trigger": "CREATED",    "active": true,    "conditions": [      {        "field": "string",        "op": "eq",        "value": "string"      }    ],    "triggerConfig": {      "idleDays": 1,      "stage": "NEW",      "days": 1    },    "actions": [      {        "type": "CREATE_TASK"      }    ],    "runCount": 0,    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}
{  "error": "products must not be empty."}
{  "error": "Invalid or missing API key."}
{  "error": "API key missing required scope: write:workflows."}
{  "error": "Workflow not found."}
DELETE/api/v1/workflows/{id}

Authorization

BearerAuth
AuthorizationBearer <token>

Pass an API key issued from the agentlyleads workspace settings. Example: Authorization: Bearer alk_live_xxxxxxxxxxxx

In: header

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

curl -X DELETE "https://example.com/api/v1/workflows/string"
{  "deleted": 1,  "id": "string"}
{  "error": "Invalid or missing API key."}
{  "error": "API key missing required scope: write:workflows."}
{  "error": "Workflow not found."}
GET/api/v1/workflows/{id}/runs

Authorization

BearerAuth
AuthorizationBearer <token>

Pass an API key issued from the agentlyleads workspace settings. Example: Authorization: Bearer alk_live_xxxxxxxxxxxx

In: header

Path Parameters

id*string

Query Parameters

limit?integer
Range1 <= value <= 100
Default50
status?string

Value in

  • "OK"
  • "ERROR"
  • "SKIPPED"

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/api/v1/workflows/string/runs"
{  "runs": [    {      "id": "string",      "recordId": "string",      "status": "OK",      "detail": "string",      "at": "2019-08-24T14:15:22Z"    }  ]}
{  "error": "products must not be empty."}
{  "error": "Invalid or missing API key."}
{  "error": "API key missing required scope: write:workflows."}
{  "error": "Workflow not found."}