Advance a deal
Pipelines and stages, creation with product lines, stage change, generated ERP quote, win and loss.
A deal moves stage by stage through a pipeline, until it is won or lost; along the way, it generates the ERP quote. This guide follows that path with a key carrying crm:write (and sales:write for the quote).
1. Read pipelines and their stages
curl 'https://quosuite.com/api/public/v1/quosuite/crm/pipelines' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"The default pipeline comes first (isDefault: true); its stages are ordered (position 0, 1, 2…), each with its probability. Keep the stage identifiers: they are used to move deals. A workspace that never opened the CRM gets, on the first call, a five-stage “Sales” pipeline.
2. Create the deal
POST/crm/deals
# One key per operation, reused as is on every retry.
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/crm/deals' \
-H "Authorization: Bearer $QUOSUITE_API_KEY" \
-H 'Idempotency-Key: 3f1c2a9e-5b7d-4e8a-9c1f-2d6b8e4a7c30' \
-H 'Content-Type: application/json' \
-d '{
"title": "BTP Horizon workshop equipment",
"accountId": "3f2a6c1e-8b7d-4e21-9a55-0c1d2e3f4a5b",
"expectedCloseDate": "2026-12-20",
"currency": "TND",
"lines": [
{
"articleId": "7d1e2f3a-4b5c-4d6e-8f90-a1b2c3d4e5f6",
"quantity": 6
},
{
"label": "Safety training (half day)",
"quantity": 2,
"unitPrice": 450,
"vatRate": 19
}
]
}'Without pipelineId / stageId, it enters the first stage of the default pipeline, with its probability. With lines, the amount is their total excl. tax: a line on a product takes its description, sale price and VAT. A currency other than the workspace’s requires the multi-currency option (402 FEATURE_NOT_INCLUDED).
3. Move it forward
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/crm/deals/aac39e3a-0c40-44b2-8697-b597f357c5a9/stage' \
-H "Authorization: Bearer $QUOSUITE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"stageId": "b4c5d6e7-f8a9-4b0c-9d1e-2f3a4b5c6d7e"
}'- The probability becomes the stage’s; the history records the change; the “deal enters a stage” automations run (follow-up task…); the
crm_deal.stage_changedevent is sent, withprevious.stageId. - The write is conditioned on the stage read: if a salesperson moves the card at the same moment, one of the two gets 409
CONFLICT— read the deal again and decide. - A stage from another pipeline: 422,
detail.rule=CRM_STAGE_PIPELINE_MISMATCH. To change pipeline, also sendpipelineId.
4. Generate the quote
# One key per operation, reused as is on every retry.
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/crm/deals/aac39e3a-0c40-44b2-8697-b597f357c5a9/quote' \
-H "Authorization: Bearer $QUOSUITE_API_KEY" \
-H 'Idempotency-Key: 3f1c2a9e-5b7d-4e8a-9c1f-2d6b8e4a7c30' \
-H 'Content-Type: application/json' \
-d '{
"validUntil": "2026-12-31",
"createClient": true
}'A draft quote is created in sales, for the account’s customer (created with createClient: true if it does not exist yet), with the deal’s lines: ERP numbering, customer price list and taxes. data.quote.documentId is then read with GET /sales/quotes/{id} — and follows its own lifecycle (sending, acceptance, conversion into an invoice).
5. Win or lose
curl -X POST 'https://quosuite.com/api/public/v1/quosuite/crm/deals/aac39e3a-0c40-44b2-8697-b597f357c5a9/won' \
-H "Authorization: Bearer $QUOSUITE_API_KEY"Won: status: WON, probability 100%, closedAt set, crm_deal.won event. Lost: POST /crm/deals/{id}/lost with a reason (feeds the dashboard’s loss reasons), crm_deal.lost event. POST /crm/deals/{id}/reopen restarts it.
- GET
/crm/pipelinesList pipelines and their stages - GET
/crm/dealsList deals - POST
/crm/dealsCreate a deal - GET
/crm/deals/{id}Get a deal - PATCH
/crm/deals/{id}Update a deal - POST
/crm/deals/{id}/stageAdvance a deal (change stage) - POST
/crm/deals/{id}/quoteGenerate a deal’s quote - POST
/crm/deals/{id}/wonMark a deal won - POST
/crm/deals/{id}/lostMark a deal lost - POST
/crm/deals/{id}/reopenReopen a closed deal - POST
/crm/activitiesSchedule an activity