Flows
List flows and start flow runs.
GET
/v1/flows/List flowsPOST/v1/flows/Create flowGET/v1/flows/runs/{run_id}/Get flow runGET/v1/flows/{flow_id}/Get flowPOST/v1/flows/{flow_id}/runs/Create flow runList flows
GET
automations:write/v1/flows/Response fields (200)
| Field | Type | Notes |
|---|---|---|
datarequired | object[] | — |
data[].channel | string | read-only |
data[].created_at | string (date-time) | read-only |
data[].id | string | read-only |
data[].is_active | boolean | read-only |
data[].name | string | read-only |
data[].step_count | integer | read-only |
data[].updated_at | string (date-time) | read-only |
next_cursorrequired | string | null | — |
Responses
200Success400The request is invalid.401Authentication is missing, invalid, or revoked.403The authenticated identity lacks the required scope or capability.404The resource is unavailable or not visible to this organization.429The request-rate budget is exhausted.
Example request
curl
curl -X GET "https://api.themochi.app/v1/flows/" \
-H "Authorization: Bearer $MOCHI_API_KEY"Create flow
POST
automations:writeIdempotency-Key required/v1/flows/Parameters
| Name | In | Type | Notes |
|---|---|---|---|
Idempotency-Keyrequired | header | string (uuid) | UUID4 identifying one intended write. Reuse it only when retrying that same write. |
Request body
| Field | Type | Notes |
|---|---|---|
channel | string | one of INSTAGRAM, WHATSAPP, MESSENGER |
is_activerequired | boolean | — |
namerequired | string | max length 255 |
stepsrequired | any | any | object | object | object | object | object | object | object | object | object[] | A bounded DAG: maximum depth 3 and at most 10 send steps. Step ids and targets form the graph. · max 20 items · min 1 items |
Response fields (201)
| Field | Type | Notes |
|---|---|---|
channel | string | read-only |
created_at | string (date-time) | read-only |
id | string | read-only |
is_active | boolean | read-only |
name | string | read-only |
step_count | integer | read-only |
updated_at | string (date-time) | read-only |
Responses
201Success400The request is invalid.401Authentication is missing, invalid, or revoked.403The authenticated identity lacks the required scope or capability.404The resource is unavailable or not visible to this organization.409The write conflicts with current state or an identical request is still running.422The write contains fields outside its closed input schema.429The request-rate budget is exhausted.
Example request
curl
curl -X POST "https://api.themochi.app/v1/flows/" \
-H "Authorization: Bearer $MOCHI_API_KEY" \
-H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
-H "Content-Type: application/json" \
-d '{"is_active":true,"name":"string","steps":["string"]}'Get flow run
GET
automations:write/v1/flows/runs/{run_id}/Parameters
| Name | In | Type | Notes |
|---|---|---|---|
run_idrequired | path | integer | — |
Response fields (200)
| Field | Type | Notes |
|---|---|---|
created_at | string (date-time) | read-only |
current_step | string | read-only |
event_counts | object | read-only |
event_counts.claimed | integer | read-only |
event_counts.failed | integer | read-only |
event_counts.paused | integer | read-only |
event_counts.succeeded | integer | read-only |
finished_at | string (date-time) | null | read-only |
flow_id | string | read-only |
lead_id | string | read-only |
next_wake_at | string (date-time) | null | read-only |
run_id | string | read-only |
state | string | read-only |
updated_at | string (date-time) | read-only |
Responses
200Success400The request is invalid.401Authentication is missing, invalid, or revoked.403The authenticated identity lacks the required scope or capability.404The resource is unavailable or not visible to this organization.429The request-rate budget is exhausted.
Example request
curl
curl -X GET "https://api.themochi.app/v1/flows/runs/<run_id>/" \
-H "Authorization: Bearer $MOCHI_API_KEY"Get flow
GET
automations:write/v1/flows/{flow_id}/Parameters
| Name | In | Type | Notes |
|---|---|---|---|
flow_idrequired | path | integer | — |
Response fields (200)
| Field | Type | Notes |
|---|---|---|
channel | string | read-only |
created_at | string (date-time) | read-only |
id | string | read-only |
is_active | boolean | read-only |
name | string | read-only |
step_count | integer | read-only |
updated_at | string (date-time) | read-only |
Responses
200Success400The request is invalid.401Authentication is missing, invalid, or revoked.403The authenticated identity lacks the required scope or capability.404The resource is unavailable or not visible to this organization.429The request-rate budget is exhausted.
Example request
curl
curl -X GET "https://api.themochi.app/v1/flows/<flow_id>/" \
-H "Authorization: Bearer $MOCHI_API_KEY"Create flow run
POST
automations:writeIdempotency-Key required/v1/flows/{flow_id}/runs/Parameters
| Name | In | Type | Notes |
|---|---|---|---|
flow_idrequired | path | integer | — |
Idempotency-Keyrequired | header | string (uuid) | UUID4 identifying one intended write. Reuse it only when retrying that same write. |
Request body
| Field | Type | Notes |
|---|---|---|
lead_idrequired | integer | — |
Response fields (201)
| Field | Type | Notes |
|---|---|---|
created_at | string (date-time) | read-only |
current_step | string | read-only |
event_counts | object | read-only |
event_counts.claimed | integer | read-only |
event_counts.failed | integer | read-only |
event_counts.paused | integer | read-only |
event_counts.succeeded | integer | read-only |
finished_at | string (date-time) | null | read-only |
flow_id | string | read-only |
lead_id | string | read-only |
next_wake_at | string (date-time) | null | read-only |
run_id | string | read-only |
state | string | read-only |
updated_at | string (date-time) | read-only |
Responses
201Success400The request is invalid.401Authentication is missing, invalid, or revoked.403The authenticated identity lacks the required scope or capability.404The resource is unavailable or not visible to this organization.409The write conflicts with current state or an identical request is still running.422The write contains fields outside its closed input schema.429The request-rate budget is exhausted.
Example request
curl
curl -X POST "https://api.themochi.app/v1/flows/<flow_id>/runs/" \
-H "Authorization: Bearer $MOCHI_API_KEY" \
-H "Idempotency-Key: $(uuidgen | tr A-Z a-z)" \
-H "Content-Type: application/json" \
-d '{"lead_id":1}'