Skip to content
Markdown

Tag ​

Tags attachable to business entities

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 /tag/create ​

Create a new tag. Tags can be scoped to one or more entity types (customer, supplier, product, employee, crm_order). is_active defaults to true.

Kerakli ruxsat: tag_create · ruxsatlar qanday ishlaydi

So‘rov namunasi

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/tag/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "entity_scopes": [
    "customer"
  ]
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/tag/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "name": "string",
    "entity_scopes": [
      "customer"
    ]
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/tag/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "name": "string",
        "entity_scopes": [
            "customer",
        ],
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "name": "string",
  "entity_scopes": [
    "customer"
  ]
}
JSON;

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

So‘rov tanasi

MaydonTurMajburiyTavsif
namestringHaTag display name
entity_scopesstring[]HaEntity types this tag can be applied to — at least one required
colorstringYo‘qHex color code, format #RRGGBB (e.g. #FF5733)
is_activebooleanYo‘qWhether this tag is active. Defaults to true.
json
{
  "name": "string",
  "entity_scopes": [
    "customer"
  ],
  "color": "string",
  "is_active": false
}

Javob

MaydonTurTavsif
_idstringTag ObjectId
namestringTag display name
colorstringHex color code, format #RRGGBB (e.g. #FF5733)
entity_scopesstring[]Entity types this tag can be applied to
is_systembooleanSystem tags are created by Bito and cannot be deleted
is_activebooleanWhether this tag is active and available for use
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "name": "string",
    "color": "string",
    "entity_scopes": [
      "customer"
    ],
    "is_system": false,
    "is_active": false
  },
  "time": "2025-05-01T12:00:00Z"
}

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

Fetch a single tag by its ObjectId.

Kerakli ruxsat: tag · ruxsatlar qanday ishlaydi

So‘rov namunasi

bash
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/tag/get-by-id/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/tag/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/tag/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/tag/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);

Yo‘l parametrlari

ParametrTurMajburiyTavsif
idstringHaTag ObjectId

So‘rov tanasi

So‘rov tanasi talab qilinmaydi.

Javob

Javob tuzilishi quyidagi bilan bir xil: POST /tag/create.

POST /tag/get-paging ​

Paginated list of tags. Filter by entity_scopes and/or is_active.

Kerakli ruxsat: tag · ruxsatlar qanday ishlaydi

So‘rov namunasi

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/tag/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/tag/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/tag/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/tag/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
entity_scopesstring[]Yo‘qFilter by entity type(s)
is_activebooleanYo‘qFilter by active state. Omit to return all tags.
searchstringYo‘qFree-text search.
organization_idstringYo‘qOrganization ObjectId.
json
{
  "page": 1,
  "limit": 20,
  "entity_scopes": [
    "customer"
  ],
  "is_active": false,
  "search": "string",
  "organization_id": "64b7f4d9e2b3b6a0b7c5d7ff"
}

Javob

MaydonTurTavsif
totalnumber
listobject[]
list[]._idstringTag ObjectId
list[].namestringTag display name
list[].colorstringHex color code, format #RRGGBB (e.g. #FF5733)
list[].entity_scopesstring[]Entity types this tag can be applied to
list[].is_systembooleanSystem tags are created by Bito and cannot be deleted
list[].is_activebooleanWhether this tag is active and available for use
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "list": [
      {
        "_id": "string",
        "name": "string",
        "color": "string",
        "entity_scopes": [],
        "is_system": false,
        "is_active": false
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /tag/update/{id} ​

Update an existing tag by ObjectId. All fields are optional; only provided fields are updated. entity_scopes must have at least one value if provided.

Kerakli ruxsat: tag_update · ruxsatlar qanday ishlaydi

So‘rov namunasi

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/tag/update/6712f0a9c4d1e87b3a0f9911' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "entity_scopes": [
    "customer"
  ]
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/tag/update/6712f0a9c4d1e87b3a0f9911', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "entity_scopes": [
      "customer"
    ]
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/tag/update/6712f0a9c4d1e87b3a0f9911",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "entity_scopes": [
            "customer",
        ],
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "entity_scopes": [
    "customer"
  ]
}
JSON;

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

Yo‘l parametrlari

ParametrTurMajburiyTavsif
idstringHaTag ObjectId to update

So‘rov tanasi

MaydonTurMajburiyTavsif
namestringYo‘qUpdated tag display name
entity_scopesstring[]HaUpdated entity scopes — at least one required if provided
colorstringYo‘qUpdated hex color code, format #RRGGBB
is_activebooleanYo‘qToggle tag active state
json
{
  "name": "string",
  "entity_scopes": [
    "customer"
  ],
  "color": "string",
  "is_active": false
}

Javob

Javob tuzilishi quyidagi bilan bir xil: POST /tag/create.

DELETE /tag/delete/{id} ​

Soft-delete a tag by ObjectId (sets is_deleted=true). Returns 400 if the tag is a system tag (is_system=true) — system tags cannot be deleted.

Kerakli ruxsat: tag_delete · ruxsatlar qanday ishlaydi

So‘rov namunasi

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

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

Yo‘l parametrlari

ParametrTurMajburiyTavsif
idstringHaTag ObjectId to delete

So‘rov tanasi

So‘rov tanasi talab qilinmaydi.

Javob

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": "ok",
  "time": "2025-05-01T12:00:00Z"
}

Bu sahifa OpenAPI spetsifikatsiyasidan yaratilgan.

Bito 2.0 Integration API