Skip to content
View as Markdown

Discount ​

INFO

Every response arrives in the shared envelope — code, message, messages, status_code, time — with the payload in data. The tables below describe what is inside data.

POST /discount/create ​

This method allows adding discount into the account.

Required permission: discount_create · how permissions work

Example request

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/discount/create' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "organization_ids": [
    "string"
  ],
  "is_manual": false,
  "auto_attach": false,
  "apply_type": "percent",
  "live_type": "forever",
  "assign_type": "all",
  "value": 0,
  "is_all_categories": false
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/discount/create', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "name": "string",
    "organization_ids": [
      "string"
    ],
    "is_manual": false,
    "auto_attach": false,
    "apply_type": "percent",
    "live_type": "forever",
    "assign_type": "all",
    "value": 0,
    "is_all_categories": false
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/discount/create",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "name": "string",
        "organization_ids": [
            "string",
        ],
        "is_manual": False,
        "auto_attach": False,
        "apply_type": "percent",
        "live_type": "forever",
        "assign_type": "all",
        "value": 0,
        "is_all_categories": False,
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "name": "string",
  "organization_ids": [
    "string"
  ],
  "is_manual": false,
  "auto_attach": false,
  "apply_type": "percent",
  "live_type": "forever",
  "assign_type": "all",
  "value": 0,
  "is_all_categories": false
}
JSON;

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

Request body

FieldTypeRequiredDescription
namestringYes
organization_idsstring[]Yes
auto_attachbooleanYes
is_manualbooleanYes
live_typestringYesOne of: forever, duration
assign_typestringYesOne of: all, specific
apply_typestringYesOne of: percent, cash
valuenumberYes
currency_idstringNoRequired when apply_type is cash.
starting_datestringNoRequired when live_type is duration.
ending_datestringNoRequired when live_type is duration.
is_all_categoriesbooleanYes
category_idsstring[]No
item_added_idsstring[]NoProduct ids
json
{
  "name": "string",
  "organization_ids": [
    "string"
  ],
  "auto_attach": false,
  "is_manual": false,
  "live_type": "forever",
  "assign_type": "all",
  "apply_type": "percent",
  "value": 0,
  "currency_id": "string",
  "starting_date": "string",
  "ending_date": "string",
  "is_all_categories": false,
  "category_ids": [
    "string"
  ],
  "item_added_ids": [
    "string"
  ]
}

Response

FieldTypeDescription
_idstringid of discount
namestring
organization_idsstring[]
auto_attachboolean
is_manualboolean
statestringOne of: not_started, active, expired
live_typestringOne of: forever, duration
assign_typestringOne of: all, specific
apply_typestringOne of: percent, cash
valuenumber
currency_idstring
starting_datestring
ending_datestring
is_all_categoriesboolean
category_idsstring[]
nested_category_idsstring[]
item_added_idsstring[]
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "_id": "string",
    "name": "string",
    "organization_ids": [
      "string"
    ],
    "auto_attach": false,
    "is_manual": false,
    "state": "not_started",
    "live_type": "forever",
    "assign_type": "all",
    "apply_type": "percent",
    "value": 0,
    "currency_id": "string",
    "starting_date": "string",
    "ending_date": "string",
    "is_all_categories": false,
    "category_ids": [
      "string"
    ],
    "nested_category_ids": [
      "string"
    ],
    "item_added_ids": [
      "string"
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

PUT /discount/update ​

This method allows updating discount in the account.

Required permission: discount_update · how permissions work

Example request

bash
curl -X PUT 'https://api.bito.uz/integration-api/integration/api/v2/discount/update' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "organization_ids": [
    "string"
  ],
  "is_manual": false,
  "auto_attach": false,
  "apply_type": "percent",
  "live_type": "forever",
  "assign_type": "all",
  "value": 0,
  "is_all_categories": false,
  "_id": "string"
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/discount/update', {
  method: 'PUT',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "name": "string",
    "organization_ids": [
      "string"
    ],
    "is_manual": false,
    "auto_attach": false,
    "apply_type": "percent",
    "live_type": "forever",
    "assign_type": "all",
    "value": 0,
    "is_all_categories": false,
    "_id": "string"
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "PUT",
    "https://api.bito.uz/integration-api/integration/api/v2/discount/update",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "name": "string",
        "organization_ids": [
            "string",
        ],
        "is_manual": False,
        "auto_attach": False,
        "apply_type": "percent",
        "live_type": "forever",
        "assign_type": "all",
        "value": 0,
        "is_all_categories": False,
        "_id": "string",
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "name": "string",
  "organization_ids": [
    "string"
  ],
  "is_manual": false,
  "auto_attach": false,
  "apply_type": "percent",
  "live_type": "forever",
  "assign_type": "all",
  "value": 0,
  "is_all_categories": false,
  "_id": "string"
}
JSON;

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

Request body

FieldTypeRequiredDescription
namestringYes
organization_idsstring[]Yes
auto_attachbooleanYes
is_manualbooleanYes
live_typestringYesOne of: forever, duration
assign_typestringYesOne of: all, specific
apply_typestringYesOne of: percent, cash
valuenumberYes
currency_idstringNoRequired when apply_type is cash.
starting_datestringNoRequired when live_type is duration.
ending_datestringNoRequired when live_type is duration.
is_all_categoriesbooleanYes
category_idsstring[]No
item_added_idsstring[]NoProduct ids
_idstringYesid of customer
json
{
  "name": "string",
  "organization_ids": [
    "string"
  ],
  "auto_attach": false,
  "is_manual": false,
  "live_type": "forever",
  "assign_type": "all",
  "apply_type": "percent",
  "value": 0,
  "currency_id": "string",
  "starting_date": "string",
  "ending_date": "string",
  "is_all_categories": false,
  "category_ids": [
    "string"
  ],
  "item_added_ids": [
    "string"
  ],
  "_id": "string"
}

Response

Same response shape as POST /discount/create.

DELETE /discount/delete/{id} ​

Delete a discount

Required permission: discount_delete · how permissions work

Example request

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

Path parameters

ParameterTypeRequiredDescription
idstringYes

Request body

No request body.

Response

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

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

Get discount using its _id

Required permission: discount · how permissions work

Example request

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

Path parameters

ParameterTypeRequiredDescription
idstringYes

Request body

No request body.

Response

Same response shape as POST /discount/create.

POST /discount/get-paging ​

Get discounts by paging

Required permission: discount · how permissions work

Example request

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

Request body

FieldTypeRequiredDescription
pagenumberYesDefault: 1
limitnumberYesDefault: 20
apply_typestringNo
statesstringNo
searchstringNo
currency_idstringNo
is_expiredbooleanNo
organization_idsstring[]No
json
{
  "page": 1,
  "limit": 20,
  "apply_type": "string",
  "states": "string",
  "search": "string",
  "currency_id": "string",
  "is_expired": false,
  "organization_ids": [
    "string"
  ]
}

Response

data.total is the total number of records and data.data[] holds the current page. The table below describes one record.

FieldTypeDescription
_idstringid of discount
namestring
organization_idsstring[]
auto_attachboolean
is_manualboolean
statestringOne of: not_started, active, expired
live_typestringOne of: forever, duration
assign_typestringOne of: all, specific
apply_typestringOne of: percent, cash
valuenumber
currency_idstring
starting_datestring
ending_datestring
is_all_categoriesboolean
category_idsstring[]
nested_category_idsstring[]
item_added_idsstring[]
json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": {
    "total": 0,
    "data": [
      {
        "_id": "string",
        "name": "string",
        "organization_ids": [
          "string"
        ],
        "auto_attach": false,
        "is_manual": false,
        "state": "not_started",
        "live_type": "forever",
        "assign_type": "all",
        "apply_type": "percent",
        "value": 0,
        "currency_id": "string",
        "starting_date": "string",
        "ending_date": "string",
        "is_all_categories": false,
        "category_ids": [
          "string"
        ],
        "nested_category_ids": [
          "string"
        ],
        "item_added_ids": [
          "string"
        ]
      }
    ]
  },
  "time": "2025-05-01T12:00:00Z"
}

POST /discount/get-all ​

Get all discounts

Required permission: discount · how permissions work

Example request

bash
curl -X POST 'https://api.bito.uz/integration-api/integration/api/v2/discount/get-all' \
  -H "api-key: $BITO_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "apply_type": "percent",
  "currency_id": "64e5b499189503e999999999",
  "organization_ids": [
    "64e5b499189503e999999999"
  ],
  "is_expired": false,
  "states": [
    "active"
  ]
}'
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/discount/get-all', {
  method: 'POST',
  headers: { 'api-key': process.env.BITO_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "apply_type": "percent",
    "currency_id": "64e5b499189503e999999999",
    "organization_ids": [
      "64e5b499189503e999999999"
    ],
    "is_expired": false,
    "states": [
      "active"
    ]
  }),
})
const { code, data } = await res.json()
python
import os
import requests

res = requests.request(
    "POST",
    "https://api.bito.uz/integration-api/integration/api/v2/discount/get-all",
    headers={"api-key": os.environ["BITO_API_KEY"]},
    json={
        "apply_type": "percent",
        "currency_id": "64e5b499189503e999999999",
        "organization_ids": [
            "64e5b499189503e999999999",
        ],
        "is_expired": False,
        "states": [
            "active",
        ],
    },
)
print(res.json())
php
<?php
$body = <<<'JSON'
{
  "apply_type": "percent",
  "currency_id": "64e5b499189503e999999999",
  "organization_ids": [
    "64e5b499189503e999999999"
  ],
  "is_expired": false,
  "states": [
    "active"
  ]
}
JSON;

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

Request body

FieldTypeRequiredDescription
apply_typestringNoOne of: percent, cash
currency_idstringNo
organization_idsstring[]No
is_expiredbooleanNo
statesstring[]No
json
{
  "apply_type": "percent",
  "currency_id": "64e5b499189503e999999999",
  "organization_ids": [
    "64e5b499189503e999999999"
  ],
  "is_expired": false,
  "states": [
    "active"
  ]
}

Response

json
{
  "code": 0,
  "message": "Success",
  "status_code": 200,
  "data": [
    {
      "_id": "string",
      "name": "string",
      "organization_ids": [
        "string"
      ],
      "auto_attach": false,
      "is_manual": false,
      "state": "not_started",
      "live_type": "forever",
      "assign_type": "all",
      "apply_type": "percent",
      "value": 0,
      "currency_id": "string",
      "starting_date": "string",
      "ending_date": "string",
      "is_all_categories": false,
      "category_ids": [
        "string"
      ],
      "nested_category_ids": [
        "string"
      ],
      "item_added_ids": [
        "string"
      ]
    }
  ],
  "time": "2025-05-01T12:00:00Z"
}

GET /discount/get-deleted ​

Get deleted discount ids

Required permission: discount · how permissions work

Example request

bash
curl -X GET 'https://api.bito.uz/integration-api/integration/api/v2/discount/get-deleted?deleted_at=DELETED_AT' \
  -H "api-key: $BITO_API_KEY"
js
const res = await fetch('https://api.bito.uz/integration-api/integration/api/v2/discount/get-deleted?deleted_at=DELETED_AT', {
  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/discount/get-deleted?deleted_at=DELETED_AT",
    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/discount/get-deleted?deleted_at=DELETED_AT');
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);

Query parameters

ParameterTypeRequiredDescription
deleted_atstringYes

Request body

No request body.

Response

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

This page is generated from the OpenAPI spec.

Bito 2.0 Integration API