Deals
The CRM layer of AISAR: deals attached to funnels and stages, deal tasks (calls, meetings, follow-ups), and per-company reference lists of deal types and lost reasons. Ownership of a deal or task is always checked by company_id — touching another company's record returns 404, not 403. Every endpoint requires an active subscription and the plan's deals feature.
Endpoints
| Method | Path | Summary |
|---|---|---|
| GET | /v1/dealsList deals (filters: funnel_id, status, contact_id, responsible_user_id) | List deals (filters: funnel_id, status, contact_id, responsible_user_id) |
| POST | /v1/dealsCreate a deal | Create a deal |
| GET | /v1/deals/{deal}Get a deal | Get a deal |
| POST | /v1/deals/{deal}Update a deal | Update a deal |
| DELETE | /v1/deals/{deal}Delete a deal (soft delete) | Delete a deal (soft delete) |
| POST | /v1/deals/{deal}/restoreRestore a soft-deleted deal | Restore a soft-deleted deal |
| GET | /v1/deals/{deal}/activitiesDeal activity feed (timeline) | Deal activity feed (timeline) |
| POST | /v1/deals/{deal}/notesAdd a note to the deal timeline | Add a note to the deal timeline |
| GET | /v1/deals/{deal}/tasksTasks attached to a deal | Tasks attached to a deal |
| GET | /v1/deal-tasksList company tasks (filters: status, assigned_user_id, deal_id, overdue, mine) | List company tasks (filters: status, assigned_user_id, deal_id, overdue, mine) |
| POST | /v1/deal-tasksCreate a task | Create a task |
| PATCH | /v1/deal-tasks/{task}Update or close a task | Update or close a task |
| DELETE | /v1/deal-tasks/{task}Delete a task | Delete a task |
| GET | /v1/deal-typesList deal types | List deal types |
| POST | /v1/deal-typesCreate a deal type | Create a deal type |
| PATCH | /v1/deal-types/{dealType}Update a deal type | Update a deal type |
| DELETE | /v1/deal-types/{dealType}Delete a deal type | Delete a deal type |
| GET | /v1/lost-reasonsList lost reasons | List lost reasons |
| POST | /v1/lost-reasonsCreate a lost reason | Create a lost reason |
| PATCH | /v1/lost-reasons/{lostReason}Update a lost reason | Update a lost reason |
| DELETE | /v1/lost-reasons/{lostReason}Delete a lost reason | Delete a lost reason |
Examples
Create a deal
Request
curl -X POST https://api.aisar.app/v1/deals \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"contact_id": 123,
"funnel_id": 1,
"funnel_stage_id": 3,
"title": "Office renovation",
"amount": "5000.00",
"currency": "KZT",
"source": "api",
"responsible_user_id": 5
}'Response
{
"data": {
"id": 501,
"company_id": 1,
"contact_id": 123,
"funnel_id": 1,
"funnel_stage_id": 3,
"title": "Office renovation",
"amount": "5000.00",
"currency": "KZT",
"status": "open",
"type_id": null,
"source": "api",
"utm_source": null,
"utm_medium": null,
"utm_campaign": null,
"probability": null,
"comments": null,
"begin_date": null,
"responsible_user_id": 5,
"expected_close_date": null,
"closed_at": null,
"lost_reason": null,
"lost_reason_id": null,
"closed_amount": null,
"closed_currency": null,
"stage_changed_at": "2026-03-15T10:00:00.000000Z",
"channel": null,
"custom_fields": null,
"created_at": "2026-03-15T10:00:00.000000Z",
"updated_at": "2026-03-15T10:00:00.000000Z"
}
}Mark a deal as lost
Request
curl -X POST https://api.aisar.app/v1/deals/501 \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "lost",
"lost_reason_id": 3
}'Response
{
"data": {
"id": 501,
"status": "lost",
"lost_reason_id": 3,
"lost_reason": null,
"closed_amount": "5000.00",
"closed_currency": "KZT",
"closed_at": "2026-03-17T09:00:00.000000Z",
"stage_changed_at": "2026-03-17T09:00:00.000000Z",
"updated_at": "2026-03-17T09:00:00.000000Z"
}
}