Skip to content
Markdown

Person ​

INFO

Har bir javob umumiy konvertda qaytadi — code, message, messages, status_code, time — foydali yuk esa data ichida. Quyidagi jadvallar faqat data ichini tavsiflaydi.

POST /person/get-by-id/{id} ​

Fetch a single person by ObjectId. Legal and natural persons are both stored as persons; the response is the aggregated legal- or natural-person record depending on the stored type.

Kerakli ruxsat: legal_person · ruxsatlar qanday ishlaydi

So‘rov namunasi

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/person/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/person/get-by-id/6712f0a9c4d1e87b3a0f9911', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY },
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/person/get-by-id/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
)
print(res.json())
php
<?php
$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/person/get-by-id/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Yo‘l parametrlari

ParametrTurMajburiyTavsif
idstringHa

So‘rov tanasi

So‘rov tanasi talab qilinmaydi.

Javob

MaydonTurTavsif
numbernumber
typestring
namestring
short_namestring
statusstringMumkin qiymatlar: active, inactive
phone_numberstring
telegram_linkstring
emailstring
web_sitestring
addressstring
codestring
postal_codestring
innstring
imagestring
locationobject
is_customerboolean
is_supplierboolean
is_defaultboolean
updated_by_userobject
updated_by_user._idstring
updated_by_user.full_namestring
created_by_userobject
created_by_user._idstring
created_by_user.full_namestring
ownerobject
owner._idstring
owner.namestring
owner.short_namestring
managerobject
manager._idstring
manager.first_namestring
manager.last_namestring
created_atstring (date-time)
updated_atstring (date-time)
balancenumber
balance_listobject[]
total_balancenumber
customerobject
customer._idstring
customer.namestring
employeeobject
employee._idstring
employee.namestring
supplierobject
supplier._idstring
supplier.namestring
delivery_addressstring
responsible_idstring
responsibleobject
responsible._idstring
responsible.full_namestring
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "number": 0,
    "type": "string",
    "name": "string",
    "short_name": "string",
    "status": "active",
    "phone_number": "string",
    "telegram_link": "string",
    "email": "string",
    "web_site": "string",
    "address": "string",
    "code": "string",
    "postal_code": "string",
    "inn": "string",
    "image": "string",
    "location": {},
    "is_customer": false,
    "is_supplier": false,
    "is_default": false,
    "updated_by_user": {
      "_id": "string",
      "full_name": "string"
    },
    "created_by_user": {
      "_id": "string",
      "full_name": "string"
    },
    "owner": {
      "_id": "string",
      "name": "string",
      "short_name": "string"
    },
    "manager": {
      "_id": "string",
      "first_name": "string",
      "last_name": "string"
    },
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z",
    "balance": 0,
    "balance_list": [
      {}
    ],
    "total_balance": 0,
    "customer": {
      "_id": "string",
      "name": "string"
    },
    "employee": {
      "_id": "string",
      "name": "string"
    },
    "supplier": {
      "_id": "string",
      "name": "string"
    },
    "delivery_address": "string",
    "responsible_id": "string",
    "responsible": {
      "_id": "string",
      "full_name": "string"
    }
  },
  "time": "2025-05-01T12:00:00Z"
}

POST /person/balance/get-paging ​

Paginated list of persons WITH their balances per organization and currency. Filter by type, status, organization_id and balance_type. Use /person/get-paging for a plain list without balance aggregation — it is considerably cheaper.

Kerakli ruxsat: legal_person · ruxsatlar qanday ishlaydi

So‘rov namunasi

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/person/balance/get-paging' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 1,
  "limit": 20
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/person/balance/get-paging', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 1,
    "limit": 20
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/person/balance/get-paging",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 1,
        "limit": 20,
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "page": 1,
  "limit": 20
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/person/balance/get-paging');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

So‘rov tanasi

MaydonTurMajburiyTavsif
pagenumberHaStandart: 1
limitnumberHaStandart: 20
typestringYo‘qMumkin qiymatlar: legal, natural
statusstringYo‘qMumkin qiymatlar: active, inactive
organization_idstringYo‘q
balance_typestringYo‘qFilter by balance state.. Mumkin qiymatlar: debt, credit, zero, not_zero
organization_idsstring[]Yo‘qOrganization ObjectIds.
balance_atstring (date-time)Yo‘q
is_customerbooleanYo‘q
is_supplierbooleanYo‘q
searchstringYo‘qFree-text search.
updated_atstring (date-time)Yo‘qOnly records updated at or after this time.
json
{
  "page": 1,
  "limit": 20,
  "type": "legal",
  "status": "active",
  "organization_id": "63f8b0c4e4b0d3a2f8e4b0c4",
  "balance_type": "not_zero",
  "organization_ids": [
    "64b7f4d9e2b3b6a0b7c5d7ff"
  ],
  "balance_at": "2025-05-01T12:00:00Z",
  "is_customer": false,
  "is_supplier": false,
  "search": "string",
  "updated_at": "2025-05-01T12:00:00Z"
}

Javob

data.total — jami yozuvlar soni, data.data[] — joriy sahifadagi yozuvlar. Quyidagi jadval bitta yozuvni tavsiflaydi.

MaydonTurTavsif
_idstring
namestring
last_namestring
first_namestring
typeboolean
person_idstring
phone_numberstring
statusstringMumkin qiymatlar: active, inactive
codestring
balance_listobject[]
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "data": [
      {
        "_id": "string",
        "name": "string",
        "last_name": "string",
        "first_name": "string",
        "type": false,
        "person_id": "string",
        "phone_number": "string",
        "status": "active",
        "code": "string",
        "balance_list": [
          {}
        ]
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

POST /person/get-paging ​

Paginated list of persons — the shared identity record behind customers, suppliers and employees. Returns a light projection (_id, name, first_name, last_name, type, phone_number, status, code). Filter by type, status, organization_id/organization_ids, is_customer, is_supplier, or free-text search. Use /person/balance/get-paging when balances are needed.

Kerakli ruxsat: legal_person · ruxsatlar qanday ishlaydi

So‘rov namunasi

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/person/get-paging' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "page": 1,
  "limit": 20
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/person/get-paging', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "page": 1,
    "limit": 20
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/person/get-paging",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "page": 1,
        "limit": 20,
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "page": 1,
  "limit": 20
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/person/get-paging');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY'), 'Content-Type: application/json'],
    CURLOPT_POSTFIELDS => $body,
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

So‘rov tanasi

MaydonTurMajburiyTavsif
pagenumberHaStandart: 1
limitnumberHaStandart: 20
searchstringYo‘qFree-text search over name / phone number / code.
typestringYo‘qFilter by person type.. Mumkin qiymatlar: legal, natural
statusstringYo‘qFilter by person status.. Mumkin qiymatlar: active, inactive
organization_idstringYo‘qRestrict to persons attached to this organization.
organization_idsstring[]Yo‘qRestrict to persons attached to any of these organizations.
is_customerbooleanYo‘qKeep only persons that are also customers.
is_supplierbooleanYo‘qKeep only persons that are also suppliers.
phone_numberstringYo‘q
updated_atstring (date-time)Yo‘qOnly records updated at or after this time.
json
{
  "page": 1,
  "limit": 20,
  "search": "string",
  "type": "natural",
  "status": "active",
  "organization_id": "63f8b0c4e4b0d3a2f8e4b0c4",
  "organization_ids": [
    "63f8b0c4e4b0d3a2f8e4b0c4"
  ],
  "is_customer": false,
  "is_supplier": false,
  "phone_number": "string",
  "updated_at": "2025-05-01T12:00:00Z"
}

Javob

data.total — jami yozuvlar soni, data.data[] — joriy sahifadagi yozuvlar. Quyidagi jadval bitta yozuvni tavsiflaydi.

MaydonTurTavsif
_idstring
namestringDisplay name. For legal persons this is the company name; for natural persons the assembled full name.
first_namestring
last_namestring
typestringMumkin qiymatlar: legal, natural
phone_numberstring
statusstringMumkin qiymatlar: active, inactive
codestring
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "data": [
      {
        "_id": "string",
        "name": "string",
        "first_name": "string",
        "last_name": "string",
        "type": "legal",
        "phone_number": "string",
        "status": "active",
        "code": "string"
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.

Bito 2.0 Integration API