## Requisite preset countries

`GET /v1/requisite-presets/countries`

Returns the countries for which a requisite preset can be created in the Bitrix24 account. The country `id` is passed as the preset's `countryId` and is used to choose a preset for looking up requisites by number.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/requisite-presets/countries" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

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

const { data } = await res.json()
const usa = data.find((country) => country.code === 'US')
console.log(usa.id)
```

### JavaScript — OAuth application

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

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | `true` on success |
| `data` | array | Countries |
| `data[].id` | number | Country ID in Bitrix24. This is the value of the preset's `countryId` field, not the numeric ISO country code |
| `data[].code` | string | Two-letter country code, for example `US`, `DE`, `FR` |
| `data[].title` | string | Country name in the Bitrix24 account language |

## Response example

Three of the twelve countries are shown:

```json
{
  "success": true,
  "data": [
    { "id": 46, "code": "DE", "title": "Germany" },
    { "id": 122, "code": "US", "title": "USA" },
    { "id": 132, "code": "FR", "title": "France" }
  ]
}
```

## Error response example

401 — the key is not passed:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_API_KEY",
    "message": "API key required. Pass via X-Api-Key header."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied CRM access to the key's user |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the request. The error text is in `error.message` |
| 502 | `BITRIX_RESPONSE_INVALID` | Bitrix24 returned the directory in an unexpected format |
| 403 | `SCOPE_DENIED` | The key lacks the `crm` scope |
| 401 | `TOKEN_MISSING` | The key has no connection to Bitrix24 |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is not passed |

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

## Known specifics

**A read-only key is accepted.** This directory request changes nothing in the Bitrix24 account.

**The requisite search type depends on the country.** The built-in `Company` and `Person` presets of an international Bitrix24 account have `countryId` `122`, and lookup by number runs for them without a search type. Search by tax ID and bank code is available for `countryId` `1`, search in the register of self-regulatory organizations (SRO) for `countryId` `14`. Details — [Look up requisites by number](/docs/entities/requisites/lookup).

## See also

- [List requisite presets](/docs/entities/requisite-presets/list)
- [Create requisite preset](/docs/entities/requisite-presets/create)
- [Look up requisites by number](/docs/entities/requisites/lookup)
- [Requisite presets](/docs/entities/requisite-presets)
