
## List CRM payment line items

`GET /v1/crm-payments/:id/products`

Returns the line items of a CRM payment: how many units of each product the payment includes. Use it to get a line item `id` before changing the quantity or deleting the line item.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Payment ID. Payments of a CRM item: [`GET /v1/crm-payments`](/docs/entities/crm-payments/list) |

There are no query string parameters: all line items arrive at once, without pagination or filters.

The generic `filter` parameter is not applied by this endpoint. By default, the API preserves the previous HTTP 200 response and data, adds `Warning: 299 - "filter is not supported on this endpoint and was ignored"`, and records unsupported-filter use in the server log.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/crm-payments/573/products" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/crm-payments/573/products" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-payments/573/products', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { data, meta } = await res.json()
console.log(`Line items in the payment: ${meta.total}`)
for (const item of data) {
  console.log(`Line item ${item.id}: ${item.quantity} pcs`)
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-payments/573/products', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | `true` on success |
| `data` | array | Payment line items. An empty array for a payment without line items |
| `data[].id` | number | Payment line item ID. Passed as `itemId` to [`PATCH /v1/crm-payments/:id/products/:itemId`](/docs/entities/crm-payments/products-update) and [`DELETE /v1/crm-payments/:id/products/:itemId`](/docs/entities/crm-payments/products-delete) |
| `data[].paymentId` | number | Payment ID |
| `data[].quantity` | number | Number of product units in the line item |
| `data[].entityId` | number | ID of the basket item in the linked order. List: [`GET /v1/basket-items`](/docs/entities/basket-items/list) with `filter[orderId]` set to the order ID from the payment's `orderId` field in [`GET /v1/payments/:id`](/docs/entities/payments/get) |
| `meta.total` | number | Number of line items in the payment |

## Response example

```json
{
  "success": true,
  "data": [
    {
      "id": 445,
      "paymentId": 573,
      "quantity": 2,
      "entityId": 1391
    }
  ],
  "meta": {
    "total": 1
  }
}
```

## Error response example

404 — no payment with this ID:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Payment has not been found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | No payment with this `id` |
| 200 | `Warning: 299` | The filter is ignored by default; previous data is preserved and the warning is sent in the `Warning` header. |
| 400 (strict mode only) | `UNSUPPORTED_FILTER` | The server mode is disabled by default; until it is enabled, the endpoint preserves HTTP 200 and the previous data. |
| 400 | `INVALID_ID` | `id` is not a positive integer |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the request. The reason is in `error.message` |
| 403 | `BITRIX_ACCESS_DENIED` | The key's user has no access to the CRM item or the payment in Bitrix24 |
| 403 | `SCOPE_DENIED` | The API key does not have the `crm` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 401 | `MISSING_API_KEY` | `X-Api-Key` is not provided |

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

## Known specifics

**A line item does not contain the deal product row ID.** `entityId` points to the basket item of the order, not to the deal product row that was passed as `rowId` when [adding the line item](/docs/entities/crm-payments/products-add). To get the line item's name, price and product, look up the basket item by `entityId`.

## See also

- [Add a line item to a payment](/docs/entities/crm-payments/products-add)
- [Change the quantity in a line item](/docs/entities/crm-payments/products-update)
- [Delete a line item from a payment](/docs/entities/crm-payments/products-delete)
- [Get a CRM payment](/docs/entities/crm-payments/get)
- [Basket items](/docs/entities/basket-items)
- [CRM payments](/docs/entities/crm-payments)
