Deals API
A deal is one sales opportunity on your Sales Pipeline board: a title, a value, the stage it sits in, and optionally the contact it belongs to and the team member it is assigned to. A pipeline is the board itself, with its stages as columns. This guide covers both over the API.
- Base URL:
https://api.dmchamp.com/v1 - Authentication: your API key (see Authentication)
- Errors & paging: see Errors & Pagination
The API Reference lists every field, parameter and response for each endpoint. This page explains how deals and pipelines fit together and what to watch out for.
How deals and pipelines fit together
- A deal always sits in one stage.
stageis the id of a stage on one of your pipelines. Read your stage ids withGET /pipelines(see Pipelines below). - Stage ids are unique across all your pipelines, so a stage tells you which board a deal is on. That is why
pipeline_idon a deal is read-only: it is derived from the stage.defaultis your main pipeline, andpipeline_idisnullwhen the deal’s stage no longer exists. - A deal stores only its own fields. Any other field you send on a create or update is refused with a
400that names it, so nothing you send is silently lost. Keep extra data on the linked contact’s custom fields. - Read fields are safe to send back.
id,pipeline_idand the timestamps are ignored on a write, so you can send a deal you read straight back with your changes. - Timestamps are ISO 8601. Changing a deal’s stage restarts
stage_entered_at.
Endpoints
| Task | Method + path | Explorer |
|---|---|---|
| List deals | GET /deals |
Open in API Reference |
| Get a deal | GET /deals/{dealId} |
Open in API Reference |
| Create a deal | POST /deals |
Open in API Reference |
| Update a deal | PUT /deals/{dealId} |
Open in API Reference |
| Move a deal to another stage or position | POST /deals/{dealId}/move |
Open in API Reference |
| Set the order of the deals in one stage | POST /deals/reorder |
Open in API Reference |
| Delete a deal | DELETE /deals/{dealId} |
Open in API Reference |
| List pipelines and their stages | GET /pipelines |
Open in API Reference |
| Create a pipeline | POST /pipelines |
Open in API Reference |
| Update a pipeline | PUT /pipelines/{pipelineId} |
Open in API Reference |
| Delete a pipeline | DELETE /pipelines/{pipelineId} |
Open in API Reference |
Agencies: every endpoint takes sub_account_id to act on a client account instead of your own.
List deals
Deals come back newest first. Narrow the list with stage, pipeline_id or contact_id, and page with limit (up to 200) and the next_cursor of the previous page.
curl "https://api.dmchamp.com/v1/deals?apiKey=YOUR_API_KEY&stage=stage-2&limit=50"
A deal that does not exist, or belongs to another account, returns 404 on GET /deals/{dealId}.
Create a deal
title and stage are required, and stage must be one of your pipeline’s stage ids. The new card lands at the top of its stage.
curl -X POST "https://api.dmchamp.com/v1/deals?apiKey=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "title": "Annual plan, Jane'"'"'s Clinic", "stage": "stage-1", "value": 4800, "contact_id": "ctc_9f8e7d" }'
Response (201): { "success": true, "deal_id": "deal_abc123" }
Updating a deal
PUT /deals/{dealId} changes only the fields you send. value must be a number. Changing stage here does not reorder the other cards in the column; use the move endpoint when position matters.
Move a deal to another stage
This works like dragging the card on the board. Position 0 puts the card at the top of the column, and the other cards in both columns are renumbered for you. Send the deal’s current stage to move it within the same column.
curl -X POST "https://api.dmchamp.com/v1/deals/deal_abc123/move?apiKey=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "new_stage_id": "stage-3", "new_position": 0 }'
Response (200): { "success": true, "deal_id": "deal_abc123", "stage": "stage-3", "position": 0 }
Deleting a deal (DELETE /deals/{dealId}) cannot be undone.
Pipelines
Every account has a main pipeline (id: "default"); you can add up to nine more, each with its own stages.
- Stage ids and trigger tags must be unique across all pipelines on the account. A stage id or trigger tag already used by another pipeline is a
400naming that pipeline; a pipeline id that already exists is a409. - Each pipeline can mark one stage as its
wonoutcome and one as itslostoutcome. - A stage takes the same fields as the Stages dialog:
id,name,color,position, and optionallytrigger_tags(up to 10 tag paths,users/{uid}/tags/{tagId}, the first one is the tag added when a deal is dragged in;trigger_tagstill returns that first one),default_value,auto_move_after_dayswithauto_move_to_stage(a stage of the same pipeline), andoutcome. - Updating replaces the whole stage list, like the Stages dialog. Use
defaultas the id of the main pipeline. The pipeline id itself cannot be changed. - The main pipeline cannot be deleted. Deleting an extra pipeline that still holds deals answers
409withdeal_count; add?delete_deals=trueto delete those deals together with the pipeline. This cannot be undone.
Create a pipeline
Leave id out to have one generated.
curl -X POST "https://api.dmchamp.com/v1/pipelines?apiKey=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "reviews",
"name": "Review requests",
"stages": [
{ "id": "rv_asked", "name": "Asked", "color": "#3B82F6", "position": 0 },
{ "id": "rv_done", "name": "Review posted", "color": "#10B981", "position": 1, "outcome": "won" }
]
}'
GET /pipelines returns every pipeline, the main one first, each with its stages sorted by position.
Next steps
- Sales Pipeline: how stages, stage tags, several pipelines and the board work.
- Tasks API: tasks can be linked to a deal with
deal_id. - Automations: the Find deals and Find deal steps read the same data inside a workflow.