Поиск адресов
POST /v1/addresses/search
Поиск адресов с фильтрами и авто-пагинацией. Аналогичен GET /v1/addresses, но параметры передаются в теле запроса — подходит для сложных фильтров с большим количеством условий и для программной сборки запросов.
Поля запроса (body)
| Параметр | Тип | По умолч. | Описание |
|---|---|---|---|
filter |
object | — | Фильтрация по полям GET /v1/addresses/fields.Синтаксис фильтрации. Пример: { "entityTypeId": 8, "entityId": 42 } |
limit |
number | 50 |
Количество записей (до 5000) |
offset |
number | 0 |
Пропустить N записей |
sort |
object | — | Сортировка: { "typeId": "asc" } |
Примеры
curl — личный ключ
curl -X POST "https://vibecode.bitrix24.tech/v1/addresses/search" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filter": { "entityTypeId": 1, "city": "Пермь" },
"limit": 20
}'
curl — OAuth-приложение
curl -X POST "https://vibecode.bitrix24.tech/v1/addresses/search" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"filter": { "entityTypeId": 1, "city": "Пермь" },
"limit": 20
}'
JavaScript — личный ключ
const res = await fetch('https://vibecode.bitrix24.tech/v1/addresses/search', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
filter: { entityTypeId: 1, city: 'Пермь' },
limit: 20,
}),
})
const { success, data } = await res.json()
console.log('Найдено:', data.length)
JavaScript — OAuth-приложение
const res = await fetch('https://vibecode.bitrix24.tech/v1/addresses/search', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
filter: { entityTypeId: 1, city: 'Пермь' },
limit: 20,
}),
})
const { success, data } = await res.json()
Другие сценарии
Все адреса одного реквизита:
{
"filter": { "entityTypeId": 8, "entityId": 42 }
}
Адреса определённого типа у лида:
{
"filter": { "entityTypeId": 1, "entityId": 1000755, "typeId": 1 }
}
Поля ответа
| Поле | Тип | Описание |
|---|---|---|
success |
boolean | Всегда true при успехе |
data |
array | Массив адресов (все поля — см. Поля адреса) |
meta.total |
number | Общее количество записей, соответствующих фильтру |
meta.hasMore |
boolean | Есть ли ещё записи за пределами limit |
Пример ответа
{
"success": true,
"data": [
{
"typeId": 1,
"entityTypeId": 1,
"entityId": 1000755,
"address1": "Монастырская улица, 5",
"address2": "Вокзал Пермь I",
"city": "Пермь",
"postalCode": "614000",
"region": "Пермский городской округ",
"province": "Пермский край",
"country": "Россия",
"countryCode": null,
"locAddrId": 483,
"anchorTypeId": 1,
"anchorId": 1000755
},
{
"typeId": 1,
"entityTypeId": 1,
"entityId": 1000759,
"address1": "улица Куйбышева, 97",
"address2": "каб. 5",
"city": "Пермь",
"postalCode": "614045",
"region": "Пермский городской округ",
"province": "Пермский край",
"country": "Россия",
"countryCode": null,
"locAddrId": 491,
"anchorTypeId": 1,
"anchorId": 1000759
}
],
"meta": {
"total": 107,
"hasMore": true
}
}
Пример ответа при ошибке
403 — нет скоупа:
{
"success": false,
"error": {
"code": "SCOPE_DENIED",
"message": "This endpoint requires 'crm' scope"
}
}
Ошибки
| HTTP | Код | Описание |
|---|---|---|
| 403 | SCOPE_DENIED |
API-ключ не имеет скоупа crm |
| 401 | TOKEN_MISSING |
API-ключ не имеет настроенных токенов |
| 400 | INVALID_FILTER |
Ошибка в синтаксисе фильтра |
Полный список общих ошибок API — Ошибки.
Известные особенности
Имена полей в фильтре — camelCase. Передавайте typeId, entityTypeId, entityId, city, postalCode, countryCode — те же имена, что отдаёт схема GET /v1/addresses/fields.