Skip to content

Flows

List flows and start flow runs.

List flows

GET/v1/flows/
automations:write
Response fields (200)
FieldTypeNotes
datarequiredobject[]—
data[].channelstringread-only
data[].created_atstring (date-time)read-only
data[].idstringread-only
data[].is_activebooleanread-only
data[].namestringread-only
data[].step_countintegerread-only
data[].updated_atstring (date-time)read-only
next_cursorrequiredstring | null—

Responses

  • 200Success
  • 400The 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/v1/flows/
automations:writeIdempotency-Key required

Parameters

NameInTypeNotes
Idempotency-Keyrequiredheaderstring (uuid)UUID4 identifying one intended write. Reuse it only when retrying that same write.

Request body

FieldTypeNotes
channelstringone of INSTAGRAM, WHATSAPP, MESSENGER
is_activerequiredboolean—
namerequiredstringmax length 255
stepsrequiredany | 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)
FieldTypeNotes
channelstringread-only
created_atstring (date-time)read-only
idstringread-only
is_activebooleanread-only
namestringread-only
step_countintegerread-only
updated_atstring (date-time)read-only

Responses

  • 201Success
  • 400The 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/v1/flows/runs/{run_id}/
automations:write

Parameters

NameInTypeNotes
run_idrequiredpathinteger—
Response fields (200)
FieldTypeNotes
created_atstring (date-time)read-only
current_stepstringread-only
event_countsobjectread-only
event_counts.claimedintegerread-only
event_counts.failedintegerread-only
event_counts.pausedintegerread-only
event_counts.succeededintegerread-only
finished_atstring (date-time) | nullread-only
flow_idstringread-only
lead_idstringread-only
next_wake_atstring (date-time) | nullread-only
run_idstringread-only
statestringread-only
updated_atstring (date-time)read-only

Responses

  • 200Success
  • 400The 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/v1/flows/{flow_id}/
automations:write

Parameters

NameInTypeNotes
flow_idrequiredpathinteger—
Response fields (200)
FieldTypeNotes
channelstringread-only
created_atstring (date-time)read-only
idstringread-only
is_activebooleanread-only
namestringread-only
step_countintegerread-only
updated_atstring (date-time)read-only

Responses

  • 200Success
  • 400The 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/v1/flows/{flow_id}/runs/
automations:writeIdempotency-Key required

Parameters

NameInTypeNotes
flow_idrequiredpathinteger—
Idempotency-Keyrequiredheaderstring (uuid)UUID4 identifying one intended write. Reuse it only when retrying that same write.

Request body

FieldTypeNotes
lead_idrequiredinteger—
Response fields (201)
FieldTypeNotes
created_atstring (date-time)read-only
current_stepstringread-only
event_countsobjectread-only
event_counts.claimedintegerread-only
event_counts.failedintegerread-only
event_counts.pausedintegerread-only
event_counts.succeededintegerread-only
finished_atstring (date-time) | nullread-only
flow_idstringread-only
lead_idstringread-only
next_wake_atstring (date-time) | nullread-only
run_idstringread-only
statestringread-only
updated_atstring (date-time)read-only

Responses

  • 201Success
  • 400The 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}'