AISARAISAR
REST API

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

MethodPath
GET/v1/deals

List deals (filters: funnel_id, status, contact_id, responsible_user_id)

POST/v1/deals

Create a deal

GET/v1/deals/{deal}

Get a deal

POST/v1/deals/{deal}

Update a deal

DELETE/v1/deals/{deal}

Delete a deal (soft delete)

POST/v1/deals/{deal}/restore

Restore a soft-deleted deal

GET/v1/deals/{deal}/activities

Deal activity feed (timeline)

POST/v1/deals/{deal}/notes

Add a note to the deal timeline

GET/v1/deals/{deal}/tasks

Tasks attached to a deal

GET/v1/deal-tasks

List company tasks (filters: status, assigned_user_id, deal_id, overdue, mine)

POST/v1/deal-tasks

Create a task

PATCH/v1/deal-tasks/{task}

Update or close a task

DELETE/v1/deal-tasks/{task}

Delete a task

GET/v1/deal-types

List deal types

POST/v1/deal-types

Create a deal type

PATCH/v1/deal-types/{dealType}

Update a deal type

DELETE/v1/deal-types/{dealType}

Delete a deal type

GET/v1/lost-reasons

List lost reasons

POST/v1/lost-reasons

Create a lost reason

PATCH/v1/lost-reasons/{lostReason}

Update a lost reason

DELETE/v1/lost-reasons/{lostReason}

Delete a lost reason

Examples

Create a deal

Request

bash
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

json
{
  "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

bash
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

json
{
  "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"
  }
}