
## Create deal

`POST /v1/deals`

Creates a new deal in CRM.

## Request fields (body)

| Parameter | Type | Required | Description |
|----------|-----|-------|---------|
| `title` | string | no | Deal title |
| `amount` | number | no | Amount |
| `currency` | string | no | Currency. List: `GET /v1/currencies` |
| `stageId` | string | no | Pipeline stage. Standard stages: `NEW`, `PREPARATION`, `PREPAYMENT_INVOICE`, `EXECUTING`, `FINAL_INVOICE`, `WON`, `LOSE`. A Bitrix24 account can define its own stages; list them with `GET /v1/statuses?filter[entityId]=DEAL_STAGE` (for another pipeline — `DEAL_STAGE_{categoryId}`, stages there carry the `C{categoryId}:` prefix). Before writing, the value is matched exactly against the stage dictionary — a stage that is not in the pipeline is rejected with `UNKNOWN_STAGE`, and no record is created. An empty value is not checked: the deal is placed in the default stage |
| `categoryId` | number | no | Pipeline ID (0 = main). List: `GET /v1/deal-categories` |
| `companyId` | number | no | Company ID. Search: `GET /v1/companies` |
| `contactId` | number | no | Primary contact ID. Search: `GET /v1/contacts` |
| `assignedById` | number | no | Assigned person ID. Employee list: `GET /v1/users` |
| `sourceId` | string | no | Source. List: `GET /v1/statuses?filter[entityId]=SOURCE` |
| `sourceDescription` | string | no | Source description |
| `comments` | string | no | Comment |
| `opened` | boolean | no | Available to everyone |
| `closedAt` | datetime | no | Closing date |
| `probability` | number | no | Probability of success (%) |
| `observers` | number[] | no | Array of observer IDs. Employee list: `GET /v1/users` |
| `ufCrm*` | per field schema | no | A user field of the Bitrix24 account, for example `ufCrmProjectCode`. The actual name and type are in the schema [`GET /v1/deals/fields`](/docs/entities/deals/fields), and the value format for each type is in [User fields (UF)](/docs/entity-api#user-fields-uf). An `enumeration` field takes the option `ID` from the field's `items` array in the schema, and a multiple field takes an array of such `ID`s. If you send the option label `VALUE` instead of the `ID`, the value is lost: a single-value field gets `0`. A number that is not among the options is stored as is. Neither the label nor a non-existent `ID` raises an error, and the request returns `201`, so map the label to its `ID` on your side and check the stored value of this field in the response `data` |

No field is required, but the body must contain at least one field.

Full list of fields: [GET /v1/deals/fields](/docs/entities/deals/fields).

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/deals \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Equipment delivery",
    "amount": 50000,
    "currency": "USD",
    "stageId": "NEW",
    "categoryId": 0,
    "assignedById": 1
  }'
```

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/deals \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Equipment delivery",
    "amount": 50000,
    "currency": "USD",
    "stageId": "NEW",
    "categoryId": 0,
    "assignedById": 1
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/deals', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Equipment delivery',
    amount: 50000,
    currency: 'USD',
    stageId: 'NEW',
    categoryId: 0,
    assignedById: 1,
  }),
})

const { success, data } = await res.json()
console.log('Deal ID:', data.id)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/deals', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Equipment delivery',
    amount: 50000,
    currency: 'USD',
    stageId: 'NEW',
    categoryId: 0,
    assignedById: 1,
  }),
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | `true` when the deal is created |
| `data` | object | The created deal with all fields, including user fields (`ufCrm*`). All fields — [Deal fields](/docs/entities/deals/fields) |
| `data.id` | number | ID of the created deal |
| `data.title` | string | Title |
| `data.amount` | number | Amount |
| `data.currency` | string | Currency |
| `data.stageId` | string | Stage |
| `data.categoryId` | number | Pipeline ID |
| `data.assignedById` | number | Assigned person |
| `data.createdBy` | number | Creator |
| `data.createdAt` | datetime | Creation date |
| `data.updatedAt` | datetime | Modification date |

The main `data` fields are shown above.

The deal card URL in Bitrix24 is built from `id`:

```
https://<portal>.bitrix24.com/crm/deal/details/<id>/
```

`<portal>` — the Bitrix24 portal domain. Access is restricted by the employee's permissions in Bitrix24.

## Response example

```json
{
  "success": true,
  "data": {
    "id": 7689,
    "title": "Equipment delivery",
    "amount": 50000,
    "currency": "USD",
    "stageId": "NEW",
    "categoryId": 0,
    "assignedById": 1,
    "createdBy": 1,
    "createdAt": "2026-04-14T08:43:59.000Z",
    "updatedAt": "2026-04-14T08:43:59.000Z",
    "companyId": 0,
    "contactId": 0,
    "opened": true,
    "closed": false,
    "typeId": "SALE",
    "observers": [],
    "contactIds": []
  }
}
```

## Error response example

403 — no scope:

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'crm' scope"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 403 | `SCOPE_DENIED` | API key lacks the `crm` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](/docs/access-rights) |
| 401 | `TOKEN_MISSING` | API key has no configured tokens |
| 400 | `EMPTY_CREATE_BODY` | The request body is empty — pass at least one field |
| 400 | `INVALID_PARAMS` | A field value has the wrong type or format |
| 400 | `READONLY_FIELD` | The request body contains a read-only field, such as `isWon`. Such fields are marked in the RO column of [Deal fields](/docs/entities/deals/fields) |
| 400 | `UNKNOWN_STAGE` | `stageId` is not in the stage dictionary of pipeline `categoryId` (the main pipeline if `categoryId` is omitted): a typo, wrong letter case, or another pipeline's stage sent without its `categoryId`. No record is created; `message` suggests the exact spelling or the `categoryId` to pass, and `details.knownStages` lists the dictionary's stages |

Full list of common API errors — [Errors](/docs/errors).

## See also

- [Working with files in CRM fields](/docs/recipes/crm-files)
- [List deals](/docs/entities/deals/list)
- [Deal fields](/docs/entities/deals/fields)
- [Entity API](/docs/entity-api)
- [Filtering syntax](/docs/filtering)
- [Batch](/docs/batch)
- [Limits and optimization](/docs/optimization)
