Agent workflows
These sequences show how to chain API v2 calls for typical automation tasks. All requests require thex-api-key header. See ID prefixes for ID formats.
Create a deal in a pipeline
- List pipelines — get
dpl_anddps_IDs:
id and an ACTIVE stage id from stages (check type is ACTIVE).
- Resolve the client — search contacts or companies, or create one:
- Optional: custom fields — discover valid
cf_*keys:
- Create the deal:
stageId is optional; if omitted, the first ACTIVE stage in the pipeline is used.
Close a deal (won or lost)
Option A — update stage (recommended when matching your pipeline):type WON or LOST from GET /pipelines.
Option B — set status directly:
Create a follow-up task on a deal
entity and entityId must be sent together. List users with GET /users for assignee IDs.
Create a quotation
- List quotation document templates (layout presets for quotations, not project templates) — get a
tpl_ID:
-
Optional: template custom fields —
GET /document-templates/{id}forcustomFieldskeys to send ascf_*on create. - Create the quotation — see Document templates and API v2 overview — Quotations.
List open deals in a pipeline
Passfilters as a JSON-encoded query string (recommended for agents and curl):
cursor from meta.nextCursor. See Listing & filters.
Delete a contact
Deletion fails with400 if the contact has linked deals, invoices, or quotations:
Error handling
All errors use{ "error": { "code", "message", "details?" } }. Validation failures include details.issues with field and message. See Errors. Retry 429 after the rate limit window; do not retry 400 without changing the request.