Přeskočit na hlavní obsah

Journeys API

Auth: Clerk session.

CRUD

GET /v1/journeys?cursor=&limit=50 — paginated. GET /v1/journeys/:id — single, includes graph. POST /v1/journeys PATCH /v1/journeys/:id (renames + graph + trigger updates) DELETE /v1/journeys/:id — soft delete.

// Create:
{
"name": "Welcome series",
"trigger": {
"kind": "event",
"event": "signup",
"where": { ... } // optional property filter
},
"graph": {
"start_node_id": "n1",
"nodes": [
{ "id": "n1", "type": "wait", "duration_ms": 86400000, "next": "n2" },
{ "id": "n2", "type": "send_message", "template_id": "...", "provider_id": "...", "next": "n3" },
{ "id": "n3", "type": "end" }
]
}
}

Validates graph: max 50 nodes, unique ids, start_node_id exists, no cycles.

Activate / Pause

POST /v1/journeys/:id/activate — status draftactive. The trigger now matches incoming events. POST /v1/journeys/:id/pause — status activepaused. New triggers skipped; in-flight runs continue.

Manual trigger (test / admin)

POST /v1/journeys/:id/trigger

{
"player_id": "uuid",
"context": { ... } // optional — accessible as {{journey.context}}
}

Forces a journey run for one player without waiting for an event. Useful for testing or one-off VIP onboarding.

Runs

GET /v1/journeys/:id/runs?cursor=&limit=50&status=running

{
"data": [
{
"run_id": "uuid",
"journey_id": "...",
"player_id": "...",
"status": "running", // running | completed | failed | cancelled
"current_node_id": "n2",
"started_at": "...",
"completed_at": null,
"context": { "trigger_payload": { ... } }
}
]
}

GET /v1/journeys/:id/runs/:runId — single run with full step history.

POST /v1/journeys/:id/runs/:runId/cancel — admin cancellation.

Node types reference

See Journeys feature for the full node taxonomy + JSON shapes.