Skip to content
Markdown

Purchase ​

INFO

Каждый ответ приходит в общем конверте — code, message, messages, status_code, time — а полезная нагрузка лежит в data. Таблицы ниже описывают содержимое data.

POST /purchase/create ​

This method allows adding purchase into the account.

Нужное разрешение: purchase_create · как работают разрешения

Пример запроса

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/purchase/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "state": "new",
  "date": "2023-10-01",
  "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "orders": [
    {
      "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "products": []
    }
  ],
  "additional_costs": [
    {
      "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "person_id": "64b7f4d9e2b3b6a0b7c5d80a"
    }
  ],
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/purchase/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
    "state": "new",
    "date": "2023-10-01",
    "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
    "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
    "orders": [
      {
        "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "products": []
      }
    ],
    "additional_costs": [
      {
        "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "amount": 10,
        "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "person_id": "64b7f4d9e2b3b6a0b7c5d80a"
      }
    ],
    "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/purchase/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "state": "new",
        "date": "2023-10-01",
        "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "orders": [
            {
                "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "products": [],
            },
        ],
        "additional_costs": [
            {
                "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "amount": 10,
                "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "person_id": "64b7f4d9e2b3b6a0b7c5d80a",
            },
        ],
        "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "state": "new",
  "date": "2023-10-01",
  "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "orders": [
    {
      "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "products": []
    }
  ],
  "additional_costs": [
    {
      "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "person_id": "64b7f4d9e2b3b6a0b7c5d80a"
    }
  ],
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/purchase/create');
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);

Тело запроса

ПолеТипОбязательноОписание
codestringНет
organization_idstringДа
statestringДаДопустимые значения: canceled, new, done, in_progress, draft
datestring (date)Да
income_datestring (date)Нет
responsible_idstringДа
supplier_idstringДа
supplier_assistant_idstringНет
warehouse_idstringНетRequired when is_auto_income is true.
currency_idstringДа
notestringНет
price_idstringНет
ordersobject[]Да
orders[].order_idstringНет
orders[].productsobject[]Да
orders[].products[].order_item_idstringНет
orders[].products[].product_idstringДа
orders[].products[].amountnumberДа
orders[].products[].box_countnumberНет
orders[].products[].box_itemnumberНет
orders[].products[].costnumberДа
orders[].products[].extra_costnumberНет
orders[].products[].extra_costsobject[]Нет
orders[].products[].marksstring[]Нет
orders[].products[].pricesobject[]Нет
orders[].products[].discountsobject[]Нет
orders[].products[].used_measureobjectНет
additional_costsobject[]Да
additional_costs[].cost_idstringДа
additional_costs[].amountnumberДа
additional_costs[].customer_idstringНет
additional_costs[].employee_idstringНет
additional_costs[].supplier_idstringНет
additional_costs[].person_idstringНет
is_auto_incomebooleanНет
contract_idstringНет
state_idstringНет
discountsobject[]Нет
discounts[].is_custombooleanНетПо умолчанию: true
discounts[].valuenumberДа
discounts[].apply_typestringДаДопустимые значения: percent, cash
json
{
  "code": "PR-001",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "state": "new",
  "date": "2023-10-01",
  "income_date": "2023-10-01",
  "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "supplier_assistant_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "note": "This is a note",
  "price_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "orders": [
    {
      "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "products": []
    }
  ],
  "additional_costs": [
    {
      "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "person_id": "64b7f4d9e2b3b6a0b7c5d80a"
    }
  ],
  "is_auto_income": true,
  "contract_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "state_id": "64b7f4d9e2b3b6a0b7c5d7ff",
  "discounts": [
    {
      "is_custom": true,
      "value": 0,
      "apply_type": "percent"
    }
  ]
}

Ответ

ПолеТипОписание
created_atstring (date-time)
updated_atstring (date-time)
codestring
numberstring
organization_idstring
organizationobject
organization._idstring
organization.namestring
statestring
datestring (date-time)
income_datestring (date-time)
responsible_idstring
responsibleobject
responsible._idstring
responsible.full_namestring
supplier_idstring
supplierobject
supplier._idstring
supplier.namestring
created_byobject
created_by._idstring
created_by.full_namestring
suplier_assistantobject
suplier_assistant._idstring
suplier_assistant.namestring
suplier_assistant.typestring
supplier_assistant_hierarchyobject[]
supplier_assistant_hierarchy[]._idstring
supplier_assistant_hierarchy[].namestring
supplier_assistant_hierarchy[].typestring
supplier_assistant_hierarchy[].first_namestring
supplier_assistant_hierarchy[].last_namestring
supplier_assistant_hierarchy[].middle_namestring
currency_idstring
currencyobject
currency._idstring
currency.namestring
currency.uuidnumber
currency.valuenumber
currency.symbolstring
currency.sidestring
notestring
total_amountnumber
total_costnumber
additional_costsobject[]
ordersobject[]
invoiceobject
is_fully_incomeboolean
total_incomenumber
total_refundednumber
is_auto_createboolean
is_fully_refundedboolean
incomesobject[]
purchase_returnsobject[]
total_extra_costnumber
contract_idstring
contractobject
contract._idstring
contract.namestring
contract.codestring
contract.numberstring
contract.currency_idstring
contract.organization_idstring
contract.amountnumber
contract.datestring (date-time)
contract.expire_datestring (date-time)
contract.person_idstring
contract.notestring
contract.is_activeboolean
contract.contract_numberstring
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z",
    "code": "string",
    "number": "string",
    "organization_id": "string",
    "organization": {
      "_id": "string",
      "name": "string"
    },
    "state": "string",
    "date": "2025-05-01T12:00:00Z",
    "income_date": "2025-05-01T12:00:00Z",
    "responsible_id": "string",
    "responsible": {
      "_id": "string",
      "full_name": "string"
    },
    "supplier_id": "string",
    "supplier": {
      "_id": "string",
      "name": "string"
    },
    "created_by": {
      "_id": "string",
      "full_name": "string"
    },
    "suplier_assistant": {
      "_id": "string",
      "name": "string",
      "type": "string"
    },
    "supplier_assistant_hierarchy": [
      {
        "_id": "string",
        "name": "string",
        "type": "string",
        "first_name": "string",
        "last_name": "string",
        "middle_name": "string"
      }
    ],
    "currency_id": "string",
    "currency": {
      "_id": "string",
      "name": "string",
      "uuid": 0,
      "value": 0,
      "symbol": "string",
      "side": "string"
    },
    "note": "string",
    "total_amount": 0,
    "total_cost": 0,
    "additional_costs": [
      {}
    ],
    "orders": [
      {}
    ],
    "invoice": {},
    "is_fully_income": false,
    "total_income": 0,
    "total_refunded": 0,
    "is_auto_create": false,
    "is_fully_refunded": false,
    "incomes": [
      {}
    ],
    "purchase_returns": [
      {}
    ],
    "total_extra_cost": 0,
    "contract_id": "string",
    "contract": {
      "_id": "string",
      "name": "string",
      "code": "string",
      "number": "string",
      "currency_id": "string",
      "organization_id": "string",
      "amount": 0,
      "date": "2025-05-01T12:00:00Z",
      "expire_date": "2025-05-01T12:00:00Z",
      "person_id": "string",
      "note": "string",
      "is_active": false,
      "contract_number": "string"
    }
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /purchase/update ​

This method allows updating purchase in the account.

Нужное разрешение: purchase_update · как работают разрешения

Пример запроса

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/purchase/update' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "date": "2023-10-01",
  "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "orders": [
    {
      "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "products": []
    }
  ],
  "additional_costs": [
    {
      "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "person_id": "64b7f4d9e2b3b6a0b7c5d80a"
    }
  ],
  "_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/purchase/update', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
    "date": "2023-10-01",
    "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
    "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
    "orders": [
      {
        "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "products": []
      }
    ],
    "additional_costs": [
      {
        "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "amount": 10,
        "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "person_id": "64b7f4d9e2b3b6a0b7c5d80a"
      }
    ],
    "_id": "64b7f4d9e2b3b6a0b7c5d80a",
    "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/purchase/update",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "date": "2023-10-01",
        "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "orders": [
            {
                "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "products": [],
            },
        ],
        "additional_costs": [
            {
                "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "amount": 10,
                "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
                "person_id": "64b7f4d9e2b3b6a0b7c5d80a",
            },
        ],
        "_id": "64b7f4d9e2b3b6a0b7c5d80a",
        "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "date": "2023-10-01",
  "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "orders": [
    {
      "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "products": []
    }
  ],
  "additional_costs": [
    {
      "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "person_id": "64b7f4d9e2b3b6a0b7c5d80a"
    }
  ],
  "_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/purchase/update');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    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);

Тело запроса

ПолеТипОбязательноОписание
_idstringДа
codestringНет
organization_idstringДа
datestring (date)Да
income_datestring (date)Нет
responsible_idstringДа
supplier_idstringДа
supplier_assistant_idstringНет
warehouse_idstringНетRequired when is_auto_income is true.
currency_idstringДа
notestringНет
ordersobject[]Да
orders[].order_idstringНет
orders[].productsobject[]Да
orders[].products[].order_item_idstringНет
orders[].products[].product_idstringДа
orders[].products[].amountnumberДа
orders[].products[].box_countnumberНет
orders[].products[].box_itemnumberНет
orders[].products[].costnumberДа
orders[].products[].extra_costnumberНет
orders[].products[].extra_costsobject[]Нет
orders[].products[].pricesobject[]Нет
orders[].products[].discountsobject[]Нет
orders[].products[].marksany[]Нет
orders[].products[].used_measureobjectНет
additional_costsobject[]Да
additional_costs[].cost_idstringДа
additional_costs[].amountnumberДа
additional_costs[].customer_idstringНет
additional_costs[].employee_idstringНет
additional_costs[].supplier_idstringНет
additional_costs[].person_idstringНет
is_auto_incomebooleanНет
contract_idstringНет
discountsobject[]Нет
discounts[].is_custombooleanНетПо умолчанию: true
discounts[].valuenumberДа
discounts[].apply_typestringДаДопустимые значения: percent, cash
json
{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "code": "PR-001",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "date": "2023-10-01",
  "income_date": "2023-10-01",
  "responsible_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "supplier_assistant_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "warehouse_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "currency_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "note": "This is a note",
  "orders": [
    {
      "order_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "products": []
    }
  ],
  "additional_costs": [
    {
      "cost_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "amount": 10,
      "customer_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "employee_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "supplier_id": "64b7f4d9e2b3b6a0b7c5d80a",
      "person_id": "64b7f4d9e2b3b6a0b7c5d80a"
    }
  ],
  "is_auto_income": true,
  "contract_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "discounts": [
    {
      "is_custom": true,
      "value": 0,
      "apply_type": "percent"
    }
  ]
}

Ответ

Структура ответа совпадает с POST /purchase/create.

POST /purchase/get-paging ​

Get purchase by paging

Нужное разрешение: purchase · как работают разрешения

Пример запроса

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/purchase/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/purchase/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/purchase/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/purchase/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);

Тело запроса

ПолеТипОбязательноОписание
pagenumberДаПо умолчанию: 1
limitnumberДаПо умолчанию: 20
searchstringНетsearch string to filter by code or name
statesstring[]Нетlist of states to filter by state
organization_idstringНетorganization id to filter by organization
responsible_idstringНетresponsible id to filter by responsible
date_fromstring (date-time)Нетdate from to filter by date
date_tostring (date-time)Нетdate to to filter by date
is_fully_incomebooleanНетis fully income to filter by fully income
is_fully_refundedbooleanНетis fully refunded to filter by fully refunded
has_any_incomebooleanНетhas any income to filter by any income
contract_idstringНетcontract id to filter by contract
income_statesstring[]Нетlist of states to filter by income state
refund_statesstring[]Нетlist of states to filter by refunded state
currency_idstringНетcurrency id to filter by currency
updated_atstring (date-time)Нетupdated at from to filter by updated at
total_fromnumberНетtotal from to filter by total
total_tonumberНетtotal to to filter by total
is_auto_createbooleanНетis auto created to filter by auto created
supplier_idstringНет
json
{
  "page": 1,
  "limit": 20,
  "search": "string",
  "states": [
    "canceled"
  ],
  "organization_id": "string",
  "responsible_id": "string",
  "date_from": "2025-05-01T12:00:00Z",
  "date_to": "2025-05-01T12:00:00Z",
  "is_fully_income": false,
  "is_fully_refunded": false,
  "has_any_income": false,
  "contract_id": "string",
  "income_states": [
    "zero"
  ],
  "refund_states": [
    "zero"
  ],
  "currency_id": "string",
  "updated_at": "2025-05-01T12:00:00Z",
  "total_from": 0,
  "total_to": 0,
  "is_auto_create": false,
  "supplier_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}

Ответ

ПолеТипОписание
codestring
messagestring
status_codenumberstatus code of response. По умолчанию: 200
messagesobject
messages.uzstring
messages.rustring
messages.enstring
timestring (date-time)time of response
created_atstring (date-time)
updated_atstring (date-time)
numberstring
organization_idstring
organizationobject
organization._idstring
organization.namestring
statestring
datestring (date-time)
income_datestring (date-time)
responsible_idstring
responsibleobject
responsible._idstring
responsible.full_namestring
supplier_idstring
supplierobject
supplier._idstring
supplier.namestring
currency_idstring
total_amountnumber
total_costnumber
is_fully_incomeboolean
total_incomenumber
total_refundednumber
is_fully_refundedboolean
contractobject
contract._idstring
contract.namestring
contract.codestring
contract.numberstring
contract.currency_idstring
contract.organization_idstring
contract.amountnumber
contract.datestring (date-time)
contract.expire_datestring (date-time)
contract.person_idstring
contract.notestring
contract.is_activeboolean
contract.contract_numberstring
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "code": "string",
    "message": "Success",
    "status_code": 200,
    "messages": {
      "uz": "Muvaffaqiyatli",
      "ru": "Успешно",
      "en": "Successful"
    },
    "time": "2025-05-01T12:00:00Z",
    "created_at": "2025-05-01T12:00:00Z",
    "updated_at": "2025-05-01T12:00:00Z",
    "number": "string",
    "organization_id": "string",
    "organization": {
      "_id": "string",
      "name": "string"
    },
    "state": "string",
    "date": "2025-05-01T12:00:00Z",
    "income_date": "2025-05-01T12:00:00Z",
    "responsible_id": "string",
    "responsible": {
      "_id": "string",
      "full_name": "string"
    },
    "supplier_id": "string",
    "supplier": {
      "_id": "string",
      "name": "string"
    },
    "currency_id": "string",
    "total_amount": 0,
    "total_cost": 0,
    "is_fully_income": false,
    "total_income": 0,
    "total_refunded": 0,
    "is_fully_refunded": false,
    "contract": {
      "_id": "string",
      "name": "string",
      "code": "string",
      "number": "string",
      "currency_id": "string",
      "organization_id": "string",
      "amount": 0,
      "date": "2025-05-01T12:00:00Z",
      "expire_date": "2025-05-01T12:00:00Z",
      "person_id": "string",
      "note": "string",
      "is_active": false,
      "contract_number": "string"
    }
  },
  "time": "2025-05-01T12:00:00Z"
}

GET /purchase/get-by-id/{id} ​

Get purchase using its _id

Нужное разрешение: purchase · как работают разрешения

Пример запроса

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

res = requests.request(
    "GET",
    "https://api.bito.uz/integration-api/integration/api/v2/purchase/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/purchase/get-by-id/6712f0a9c4d1e87b3a0f9911');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => ['api-key: ' . getenv('BITO_API_KEY')],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Параметры пути

ПараметрТипОбязательноОписание
idstringДа

Тело запроса

Тело запроса не требуется.

Ответ

Структура ответа совпадает с POST /purchase/create.

PUT /purchase/set-state ​

setState purchase

Нужное разрешение: purchase_update · как работают разрешения

Приложению, которое отменяет документ, стоит запросить и purchase_cancel.

Пример запроса

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/purchase/set-state' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "state": "new",
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/purchase/set-state', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "state": "new",
    "_id": "64b7f4d9e2b3b6a0b7c5d80a"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/purchase/set-state",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "state": "new",
        "_id": "64b7f4d9e2b3b6a0b7c5d80a",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "state": "new",
  "_id": "64b7f4d9e2b3b6a0b7c5d80a"
}
JSON;

$ch = curl_init('https://api.bito.uz/integration-api/integration/api/v2/purchase/set-state');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    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);

Тело запроса

ПолеТипОбязательноОписание
_idstringДа
statestringДаДопустимые значения: canceled, new, done, in_progress, draft
cancel_extra_costbooleanНетcancel extra costs when canceling the purchase. По умолчанию: false
with_transactionsbooleanНетcancel transactions when canceling the purchase. По умолчанию: false
state_idstringНет
json
{
  "_id": "64b7f4d9e2b3b6a0b7c5d80a",
  "state": "new",
  "cancel_extra_cost": false,
  "with_transactions": false,
  "state_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}

Ответ

Структура ответа совпадает с POST /purchase/create.


Эта страница сгенерирована из спецификации OpenAPI.

Bito 2.0 Integration API