Kitobchi Kitobchi Developer API
OpenAPI
Kitobchi API / Seller API (yozish)

Seller API (yozish)

Do‘konga bog‘langan kalit orqali o‘z zaxirangizni boshqaring — ISBN yoki shtrix-kod bo‘yicha.

Seller API — o‘z zaxirangizni boshqaring

Do‘konga bog‘langan kalit (App-ID/Secret + stock:write ruxsati) orqali o‘z tizimingizni Kitobchiga integratsiya qiling: ISBN yoki shtrix-kod bo‘yicha zaxirani yangilang. Kalit faqat o‘z do‘koningiz mahsulotlariga ta’sir qiladi.

Idempotentlik: har bir yozuvga Idempotency-Key header bering — tarmoq uzilib qayta yuborilsa ham zaxira 2 marta o‘zgarmaydi. Xavfsizlik uchun kalitga IP allowlist yoqing.
POST https://kitobchi.com/api/v1/client/products/stock/by-code stock:write

Zaxirani kod bo‘yicha yangilash

Do‘konga bog‘langan kalit orqali ISBN (kitob) yoki shtrix-kod (kanselyariya) bo‘yicha zaxirani o‘rnatadi (`stock`) yoki o‘zgartiradi (`delta`). `stock:write` ability va seller-scoped kalit talab qilinadi.

ParametrTuriJoyMajburiyIzoh
code string body ha ISBN yoki shtrix-kod.
type string body yo‘q book | stationery. Bo‘sh bo‘lsa avtomatik aniqlanadi.
stock integer body yo‘q Yangi mutlaq zaxira (>= 0).
delta integer body yo‘q Joriy zaxiraga qo‘shiladigan o‘zgarish (+/-).
So‘rov tanasi JSON
{
    "code": "9781847941831",
    "stock": 25
}
curl --request POST \
  --url 'https://kitobchi.com/api/v1/client/products/stock/by-code' \
  --header 'Accept: application/json' \
  --header 'X-App-ID: app_xxxxxxxxxxxx' \
  --header 'X-App-Secret: your-secret' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: unique-123' \
  --data '{"code":"9781847941831","stock":25}'
const res = await fetch("https://kitobchi.com/api/v1/client/products/stock/by-code", {
  method: "POST",
  headers: {
    "Accept": "application/json",
    "X-App-ID": "app_xxxxxxxxxxxx",
    "X-App-Secret": process.env.KITOBCHI_APP_SECRET,
    "Content-Type": "application/json",
    "Idempotency-Key": "unique-123",
  },
  body: JSON.stringify({
    "code": "9781847941831",
    "stock": 25
}),
});
const data = await res.json();
<?php
$ch = curl_init("https://kitobchi.com/api/v1/client/products/stock/by-code");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => '{"code":"9781847941831","stock":25}',
  CURLOPT_HTTPHEADER => [
    'Accept: application/json',
    'Content-Type: application/json',
    'X-App-ID: app_xxxxxxxxxxxx',
    'X-App-Secret: ' . getenv('KITOBCHI_APP_SECRET'),
    'Idempotency-Key: unique-123',
  ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
import os, requests

res = requests.request(
    "POST",
    "https://kitobchi.com/api/v1/client/products/stock/by-code",
    headers={
        "Accept": "application/json",
        "X-App-ID": "app_xxxxxxxxxxxx",
        "X-App-Secret": os.environ["KITOBCHI_APP_SECRET"],
        "Idempotency-Key": "unique-123",
    },
    json={
    "code": "9781847941831",
    "stock": 25
},
)
data = res.json()
Javob namunasi 200 OK
{
    "status": "success",
    "success": true,
    "type": "book",
    "id": 128,
    "name": "Atomic Habits",
    "stock": 25,
    "in_stock": true
}
GET https://kitobchi.com/api/v1/client/products/mine stock:write

Mening mahsulotlarim

Kalitga bog‘langan do‘konning mahsulotlari va zaxirasi (sahifalangan).

ParametrTuriJoyMajburiyIzoh
type string query yo‘q book (default) yoki stationery.
per_page integer query yo‘q Sahifadagi soni (1–100).
page integer query yo‘q Sahifa raqami.
curl --request GET \
  --url 'https://kitobchi.com/api/v1/client/products/mine?type=book&per_page=50&page=1' \
  --header 'Accept: application/json' \
  --header 'X-App-ID: app_xxxxxxxxxxxx' \
  --header 'X-App-Secret: your-secret'
const res = await fetch("https://kitobchi.com/api/v1/client/products/mine?type=book&per_page=50&page=1", {
  headers: {
    "Accept": "application/json",
    "X-App-ID": "app_xxxxxxxxxxxx",
    "X-App-Secret": process.env.KITOBCHI_APP_SECRET,
  },
});
const data = await res.json();
<?php
$ch = curl_init("https://kitobchi.com/api/v1/client/products/mine?type=book&per_page=50&page=1");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    'Accept: application/json',
    'X-App-ID: app_xxxxxxxxxxxx',
    'X-App-Secret: ' . getenv('KITOBCHI_APP_SECRET'),
  ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
import os, requests

res = requests.get(
    "https://kitobchi.com/api/v1/client/products/mine?type=book&per_page=50&page=1",
    headers={
        "Accept": "application/json",
        "X-App-ID": "app_xxxxxxxxxxxx",
        "X-App-Secret": os.environ["KITOBCHI_APP_SECRET"],
    },
)
data = res.json()
Javob namunasi 200 OK
{
    "status": "success",
    "data": [
        {
            "id": 128,
            "type": "book",
            "name": "Atomic Habits",
            "code": "9781847941831",
            "price": 89000,
            "stock": 25,
            "in_stock": true
        }
    ],
    "meta": {
        "page": 1,
        "per_page": 50,
        "total": 240
    }
}
Sinab ko‘rish