Buyurtmalar
Buyurtma — bitta hujjatni tayyorlash so'rovi. U yaratiladi, fonda bajariladi va natijada bir yoki bir nechta fayl hosil bo'ladi.
Buyurtma obyekti
Noyob identifikator, ord_ bilan boshlanadi.
Xizmat kaliti: kurs_ishi, taqdimot va hokazo.
queued (navbatda), processing (tayyorlanmoqda), succeeded (tayyor), failed (xato, kredit qaytarilgan), canceled (bekor qilingan, kredit qaytarilgan).
Yechilgan kreditlar. Muvaffaqiyatsiz buyurtmada qaytariladi, lekin maydon o'zgarmaydi; qaytarilganini refunded ko'rsatadi.
Kredit qaytarilganmi.
Faqat succeeded holatida to'ladi. Ichida files massivi bor (Fayllar).
Faqat failed holatida: code va message.
O'zingiz yuborgan kalit-qiymat juftliklari. Webhook va javoblarda qaytadi.
ISO 8601, UTC.
Buyurtma yaratish
POST/v1/orders
Yangi buyurtma yaratadi va 1 kreditni yechadi. Javob 202 Accepted. Qayta yuborishdan himoyalanish uchun Idempotency-Key sarlavhasini yuboring.
Xizmat kaliti. Ro'yxat.
Xizmatga xos parametrlar. Har bir xizmat sahifasida tavsiflangan.
Eng ko'pi bilan 20 ta kalit, qiymat 500 belgigacha.
Faqat shu buyurtma uchun webhook manzili. Berilmasa, hisob sozlamasidagi manzil ishlatiladi.
curl https://api.osontopshir.uz/partner/v1/orders \
-H "Authorization: Bearer $OSONTOPSHIR_API_KEY" \
-H "Idempotency-Key: 1001-v1" \
-H "Content-Type: application/json" \
-d '{
"service": "kurs_ishi",
"params": {
"topic": "Korxonada xodimlarni boshqarish tizimi",
"subject": "Menejment",
"pages": "30-40",
"language": "uz"
},
"metadata": {"your_order_id": "1001"}
}'
requests.post(
"https://api.osontopshir.uz/partner/v1/orders",
headers={**H, "Idempotency-Key": "1001-v1"},
json={
"service": "kurs_ishi",
"params": {
"topic": "Korxonada xodimlarni boshqarish tizimi",
"subject": "Menejment",
"pages": "30-40",
"language": "uz",
},
"metadata": {"your_order_id": "1001"},
},
).json()
await (await fetch("https://api.osontopshir.uz/partner/v1/orders", {
method: "POST",
headers: { ...H, "Idempotency-Key": "1001-v1", "Content-Type": "application/json" },
body: JSON.stringify({
service: "kurs_ishi",
params: {
topic: "Korxonada xodimlarni boshqarish tizimi",
subject: "Menejment",
pages: "30-40",
language: "uz",
},
metadata: { your_order_id: "1001" },
}),
})).json();
{
"id": "ord_8f3a1c9e2b",
"object": "order",
"service": "kurs_ishi",
"status": "queued",
"credits_charged": 1,
"refunded": false,
"result": null,
"error": null,
"metadata": {"your_order_id": "1001"},
"created_at": "2026-10-14T09:30:00Z"
}
Buyurtmani olish
GET/v1/orders/{order_id}
Buyurtmaning joriy holatini qaytaradi. Tayyor bo'lsa, result.files to'ldirilgan bo'ladi.
curl https://api.osontopshir.uz/partner/v1/orders/ord_8f3a1c9e2b \ -H "Authorization: Bearer $OSONTOPSHIR_API_KEY"
requests.get(
"https://api.osontopshir.uz/partner/v1/orders/ord_8f3a1c9e2b", headers=H
).json()
await (await fetch(
"https://api.osontopshir.uz/partner/v1/orders/ord_8f3a1c9e2b", { headers: H }
)).json();
{
"id": "ord_8f3a1c9e2b",
"object": "order",
"service": "kurs_ishi",
"status": "succeeded",
"credits_charged": 1,
"refunded": false,
"result": {
"files": [
{
"id": "fil_77d0a1",
"name": "kurs_ishi.docx",
"content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"size": 412873,
"url": "https://api.osontopshir.uz/partner/v1/files/fil_77d0a1/content",
"expires_at": "2026-10-21T09:41:12Z"
}
]
},
"error": null,
"metadata": {"your_order_id": "1001"},
"created_at": "2026-10-14T09:30:00Z",
"completed_at": "2026-10-14T09:41:12Z"
}
Buyurtmalar ro'yxati
GET/v1/orders
Yangidan eskiga tartiblangan ro'yxat. Sahifalash kursor orqali.
1 dan 100 gacha, standart 20.
Oldingi sahifadagi oxirgi buyurtma idsi.
Holat bo'yicha filtr.
Xizmat bo'yicha filtr.
curl "https://api.osontopshir.uz/partner/v1/orders?limit=10&status=succeeded" \ -H "Authorization: Bearer $OSONTOPSHIR_API_KEY"
requests.get(
"https://api.osontopshir.uz/partner/v1/orders",
headers=H, params={"limit": 10, "status": "succeeded"},
).json()
await (await fetch(
"https://api.osontopshir.uz/partner/v1/orders?limit=10&status=succeeded",
{ headers: H }
)).json();
{
"object": "list",
"data": [ { "id": "ord_8f3a1c9e2b", "status": "succeeded" } ],
"has_more": false
}
Buyurtmani bekor qilish
POST/v1/orders/{order_id}/cancel
Faqat queued holatidagi buyurtmani bekor qilish mumkin. Kredit qaytariladi. Allaqachon processing bo'lsa, 409 order_not_cancelable qaytadi.
curl -X POST https://api.osontopshir.uz/partner/v1/orders/ord_8f3a1c9e2b/cancel \ -H "Authorization: Bearer $OSONTOPSHIR_API_KEY"
requests.post(
"https://api.osontopshir.uz/partner/v1/orders/ord_8f3a1c9e2b/cancel", headers=H
).json()
await (await fetch(
"https://api.osontopshir.uz/partner/v1/orders/ord_8f3a1c9e2b/cancel",
{ method: "POST", headers: H }
)).json();