
## Get invoice

`GET /v1/invoices/:id`

Returns an invoice by ID with all fields, including user fields.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Invoice ID |
| `include` (query) | string | no | Related records: `contact`, `company`, `deal`. See the "Related data" section for what the response contains |
| `select` (query) | string | no | Field selection: `?select=id,title,stageId` |

## Examples

### curl — personal key

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/invoices/117" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/invoices/117" \
  -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/invoices/117', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

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

### JavaScript — OAuth application

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

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | The invoice in full. For every field see [Invoice fields](/docs/entities/invoices/fields) |

## Related data

The parameter accepts three values — `contact`, `company`, and `deal`:

```
GET /v1/invoices/117?include=contact,company,deal
```

The values are validated: any other value is rejected with `400 INVALID_INCLUDE`, and the error message lists the allowed values. When `contactId`, `companyId`, and `parentId2` are set, the response includes an `_included` block with the contact, company, and deal objects (or `null` if the corresponding reference is empty).

For a general description of the mechanism, see [Related data](/docs/includes).

## Response example

Key fields are shown. For the full record see [Invoice fields](/docs/entities/invoices/fields).

```json
{
  "success": true,
  "data": {
    "id": 117,
    "title": "Invoice for services",
    "stageId": "DT31_5:N",
    "categoryId": 5,
    "contactId": 485,
    "companyId": 73,
    "parentId2": 40,
    "opportunity": 1500,
    "currencyId": "USD",
    "assignedById": 1,
    "createdBy": 1,
    "createdTime": "2026-08-25T08:13:37.000Z",
    "updatedTime": "2026-08-25T08:13:37.000Z",
    "_included": {
      "contact": { "id": 485 },
      "company": { "id": 73 },
      "deal": { "id": 40 }
    }
  }
}
```

## Error response example

404 — invoice not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Item not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | Invoice with the specified ID not found |
| 400 | `INVALID_PARAMS` | The `id` in the URL is not a non-negative integer |
| 400 | `INVALID_INCLUDE` | `include` carries a name the invoice does not have. The error text lists the allowed ones |
| 403 | `SCOPE_DENIED` | API key lacks the `crm` scope |
| 401 | `TOKEN_MISSING` | API key has no configured tokens |

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

## See also

- [Working with files in CRM fields](/docs/recipes/crm-files)
- [List invoices](/docs/entities/invoices/list)
- [Update invoice](/docs/entities/invoices/update)
- [Contacts](/docs/entities/contacts)
- [Companies](/docs/entities/companies)
- [Entity API](/docs/entity-api)
