Pipelines API
Stages
Every stage endpoint requires write:pipelines. Stage IDs are fenced by workspace.
POST /api/v1/pipelines/{id}/stages
Add a stage at the end of the pipeline.
{ "name": "Pilot", "won": false, "lost": false }Returns 201 with { "stage": {...} }. A stage can't be both won and lost.
POST /api/v1/pipelines/{id}/stages/reorder
Set the board order. stageIds must list every stage of the pipeline exactly once.
{ "stageIds": ["cmq5stg00alk34567890", "cmq5stg40alk34567890", "cmq5stg10alk34567890", "cmq5stg20alk34567890", "cmq5stg30alk34567890"] }Returns the pipeline in its new order. A missing, repeated or foreign stage ID returns 400 and changes nothing.
PATCH /api/v1/stages/{id}
Rename a stage, or change its won / lost flags. Send any of the three.
{ "name": "Closed won" }Returns { "stage": {...} }. Changing the flags affects how the stage is reported from now on; it does not rewrite deals already in it.
DELETE /api/v1/stages/{id}
Deletes a stage.
- A pipeline's last stage can't be deleted (
400). - If deals are in the stage, the request is refused with
409unless you passmoveDealsTo, another stage ID in any of your pipelines. Those deals are moved there first, each logged as a stage change and running your stage-change automations.
DELETE /api/v1/stages/cmq5stg40alk34567890?moveDealsTo=cmq5stg10alk34567890 HTTP/1.1
Host: agentlyleads.com
Authorization: Bearer alk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{ "deleted": 1, "id": "cmq5stg40alk34567890", "movedDeals": 3 }