{"openapi":"3.1.0","info":{"title":"Hesap SDK","description":"Mijozni ro'yxatdan o'tqazish, shablondan shartnoma tuzish va imzolash.\n\nOqim:\n0. POST /v1/auth/token — appId + appSecret evaziga 1 soatlik token oling.\n1. POST /v1/clients — mijozni ro'yxatdan o'tqazing (idempotent).\n2. POST /v1/contracts — shablondan shartnoma yarating.\n3. POST /v1/contracts/{id}/sign-sessions — imzolash sessiyasini oching.\n4. Javobdagi `url` ni o'z sahifangizda iframe'ga qo'ying.\n5. Natijani iframe `postMessage` yoki webhook orqali oling.\n\nAutentifikatsiya: `Authorization: Bearer <accessToken>`. appId va appSecret\nHesap administratori tomonidan beriladi.\n","version":"1.0"},"servers":[{"url":"https://sdk.hesap.uz","description":"Hesap SDK"}],"security":[{"sdkToken":[]}],"tags":[{"name":"Shartnomalar","description":"Shablondan shartnoma tuzish va imzoga chiqarish"},{"name":"Shablonlar","description":"Ilovaga ruxsat etilgan shartnoma shablonlari"},{"name":"Autentifikatsiya","description":"appId va appSecret bilan access token olish"},{"name":"SMS","description":"Qarshi tomonga taklif SMS'i"},{"name":"Mijozlar","description":"Mijozni ro'yxatdan o'tqazish va tekshirish"},{"name":"Pochta","description":"Talabnomani pochta orqali yuborish uchun spravochnik"},{"name":"Imzolash","description":"Imzolash sessiyalari"}],"paths":{"/v1/sms/invite":{"post":{"tags":["SMS"],"summary":"Taklif SMS'i yuborish","description":"Telefon raqami va tur kutiladi: PARTY — shartnoma tarafi bo'lishga, WITNESS — guvohlikka taklif. Matn Hesap tomonidan belgilanadi va ilova nomini o'z ichiga oladi; ixtiyoriy url (http/https) matn oxiriga qo'shiladi. Bitta raqamga 60 soniyada bir martadan ko'p yuborilmaydi (400).","operationId":"invite","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmsInviteRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/SmsInviteResponse"}}}}}}},"/v1/contracts":{"post":{"tags":["Shartnomalar"],"summary":"Shartnoma yaratish","operationId":"create","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContractRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CreatedDocumentResponse"}}}}}}},"/v1/contracts/{id}/witnesses":{"get":{"tags":["Shartnomalar"],"summary":"Shartnoma guvohlari va ularning holati","operationId":"witnesses","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WitnessResponse"}}}}}}},"post":{"tags":["Shartnomalar"],"summary":"Guvoh qo'shish","description":"Shartnoma hali tuzilmagan bo'lishi kerak. Guvoh va taraflar istalgan tartibda imzolaydi; yetarli guvoh imzolagani `POST /{id}/conclude` da tekshiriladi.","operationId":"addWitness","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WitnessRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK"}}}},"/v1/contracts/{id}/sign-sessions":{"post":{"tags":["Shartnomalar"],"summary":"Imzolash sessiyasini ochish","description":"Javobdagi `url` ni iframe'ga qo'ying. Sessiya bitta tarafni (yoki guvohni) bir marta imzolashga ruxsat beradi va `expiresAt` dan keyin yaroqsiz bo'ladi. `signerIn` — buyerIn/sellerIn yoki guvoh PINFL.","operationId":"createSignSession","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignSessionRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/SignSessionResponse"}}}}}}},"/v1/contracts/{id}/notices":{"get":{"tags":["Shartnomalar"],"summary":"Shartnoma talabnomalari","operationId":"notices","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/NoticeResponse"}}}}}}},"post":{"tags":["Shartnomalar"],"summary":"Talabnoma yuborish","description":"Faqat ACTIVE shartnomaga. `senderIn` — yuboruvchi taraf (buyerIn yoki sellerIn), bo'sh bo'lsa sotuvchi (sellerIn). Qarshi tarafga Hesap bildirishnomasi ketadi.","operationId":"createNotice","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoticeRequest"}}}},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/NoticeResponse"}}}}}}},"/v1/contracts/{id}/notices/{noticeId}/pochta":{"get":{"tags":["Shartnomalar"],"summary":"Talabnomaning pochta holati","operationId":"noticePochta","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"noticeId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/PochtaResponse"}}}}}},"post":{"tags":["Shartnomalar"],"summary":"Talabnomani pochta orqali yuborish","description":"hybrid.pochta.uz orqali qog'oz xat. Qabul qiluvchi — `senderIn` dan boshqa taraf (bo'sh bo'lsa xaridor), F.I.Sh. uning Hesap profilidan; address/regionId/areaId berilmasa ular ham profildan. Ilova egasining POCHTA paketidan 1 xat yechiladi. Takror chaqirilsa mavjud holat qaytadi. Xatolar (400): POCHTA_PACKAGE_REQUIRED, POCHTA_RECIPIENT_ADDRESS_MISSING, POCHTA_REGION_UNKNOWN.","operationId":"sendNoticePochta","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"noticeId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PochtaRequest"}}}},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/PochtaResponse"}}}}}}},"/v1/contracts/{id}/conclude":{"post":{"tags":["Shartnomalar"],"summary":"Shartnomani tuzish","description":"Ikkala taraf imzolagach chaqiriladi va shartnomani ACTIVE qiladi. Shu paytda imzolagan guvohlar soni shablondagi `witnessCount` dan kam bo'lmasligi tekshiriladi (kam bo'lsa 400, kod 1903). Tuzilgunga qadar guvoh ham, taraflar ham istalgan tartibda imzolaydi; tuzilgandan keyin imzo sessiyasi ochilmaydi.","operationId":"conclude","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/DocumentEnrichedResponse"}}}}}}},"/v1/clients":{"post":{"tags":["Mijozlar"],"summary":"Mijozni ro'yxatdan o'tqazish","description":"Idempotent: shu PINFL/STIR bilan mijoz bor bo'lsa yangisi ochilmaydi — mavjudining bo'sh maydonlari to'ldiriladi va o'sha mijoz qaytariladi.","operationId":"register","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ClientResponse"}}}}}}},"/v1/auth/token":{"post":{"tags":["Autentifikatsiya"],"summary":"Access token olish","description":"Token 1 soat amal qiladi. Muddati tugashidan oldin yangisini oling; 401 kelsa ham yangi token olib so'rovni takrorlang.","operationId":"token","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenRequest"}}},"required":true},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}}},"security":[]}},"/v1/templates":{"get":{"tags":["Shablonlar"],"summary":"Shablonlar ro'yxati","operationId":"getTemplates","responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateResponse"}}}}}}}},"/v1/templates/{templateId}/fields":{"get":{"tags":["Shablonlar"],"summary":"Shablon maydonlari — shartnoma `values` massivini to'ldirish uchun","operationId":"getFields","parameters":[{"name":"templateId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateFieldResponse"}}}}}}}},"/v1/sign-sessions/{id}":{"get":{"tags":["Imzolash"],"summary":"Sessiya holati: PENDING/SIGNED/REJECTED/EXPIRED","operationId":"getById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/SignSessionStatusResponse"}}}}}}},"/v1/pochta/regions":{"get":{"tags":["Pochta"],"summary":"Viloyatlar","operationId":"regions","responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PochtaPlace"}}}}}}}},"/v1/pochta/areas":{"get":{"tags":["Pochta"],"summary":"Tumanlar (regionId bo'yicha)","operationId":"areas","parameters":[{"name":"regionId","in":"query","required":false,"schema":{"type":"integer","format":"int32"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PochtaPlace"}}}}}}}},"/v1/contracts/{id}":{"get":{"tags":["Shartnomalar"],"summary":"Shartnoma holati","operationId":"getById_1","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/DocumentEnrichedResponse"}}}}}}},"/v1/contracts/{id}/pdf":{"get":{"tags":["Shartnomalar"],"summary":"Shartnoma PDF (application/pdf)","operationId":"pdf","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"lang","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK"}}}},"/v1/contracts/{id}/notices/{noticeId}/pdf":{"get":{"tags":["Shartnomalar"],"summary":"Talabnoma PDF (application/pdf)","operationId":"noticePdf","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"noticeId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK"}}}},"/v1/clients/{in}":{"get":{"tags":["Mijozlar"],"summary":"Mijoz ma'lumoti PINFL/STIR bo'yicha","operationId":"getByIn","parameters":[{"name":"in","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ClientResponse"}}}}}}},"/v1/contracts/{id}/witnesses/{witnessIn}":{"delete":{"tags":["Shartnomalar"],"summary":"Guvohni olib tashlash","description":"Imzolagan guvohni olib bo'lmaydi; rad etgan guvohni olib, boshqasini qo'yish mumkin.","operationId":"removeWitness","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"witnessIn","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"type":"object"}}}},"404":{"description":"Not Found","content":{"*/*":{"schema":{"type":"object"}}}},"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"type":"object"}}}},"503":{"description":"Service Unavailable","content":{"*/*":{"schema":{"type":"object"}}}},"400":{"description":"Bad Request","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"*/*":{"schema":{"type":"object"}}}},"200":{"description":"OK"}}}}},"components":{"schemas":{"SmsInviteRequest":{"type":"object","description":"Taklif SMS'i","properties":{"phoneNumber":{"type":"string","description":"Qabul qiluvchi telefon raqami (998XXXXXXXXX)","example":998901234567},"type":{"type":"string","description":"PARTY — shartnoma tarafi bo'lishga, WITNESS — guvohlikka taklif","enum":["PARTY","WITNESS"]},"url":{"type":"string","description":"Ixtiyoriy havola (http/https, 200 belgigacha) — SMS matni oxiriga qo'shiladi, masalan hamkor ilovasidagi shartnoma sahifasi","example":"https://birda.uz/contracts/123"}},"required":["phoneNumber","type"]},"SmsInviteResponse":{"type":"object","description":"Taklif SMS'i natijasi","properties":{"status":{"type":"string","description":"QUEUED — SMS yuborish navbatiga qo'yildi"},"phoneNumber":{"type":"string","description":"Normallashtirilgan raqam"},"type":{"type":"string","description":"PARTY / WITNESS"}}},"ContractProductRequest":{"type":"object","properties":{"name":{"type":"string"},"unit":{"type":"string","enum":["DONA","KG","LITR"]},"price":{"type":"number","format":"double"},"quantity":{"type":"number","format":"double"},"amount":{"type":"number","format":"double"},"deliveryAt":{"type":"string","format":"date-time"},"values":{"type":"object","additionalProperties":{}}}},"ContractRequest":{"type":"object","description":"Shablondan shartnoma yaratish","properties":{"templateId":{"type":"string","format":"uuid","description":"Shablon id — ilovaga ruxsat etilgan bo'lishi shart"},"buyerIn":{"type":"string","description":"Xaridor PINFL/STIR (bo'sh -> ilova egasi)"},"sellerIn":{"type":"string","description":"Sotuvchi PINFL/STIR (bo'sh -> ilova egasi)"},"price":{"type":"number","format":"double","description":"Shartnoma summasi, tiyinda (so'm × 100)"},"currency":{"type":"string","description":"Valyuta kodi: UZS/USD/RUB","enum":["UZS","USD","RUB"]},"initialPayment":{"type":"number","format":"double","description":"Boshlang'ich to'lov"},"deliveryAt":{"type":"string","format":"date-time","description":"Yetkazib berish sanasi"},"values":{"type":"array","description":"Shablon maydonlari qiymatlari","items":{"$ref":"#/components/schemas/DocumentValueRequest"}},"payments":{"type":"array","description":"To'lov jadvali","items":{"$ref":"#/components/schemas/PaymentItem"}},"witnessIns":{"type":"array","description":"Guvohlar PINFL'lari — POST /v1/clients bilan ro'yxatdan o'tgan bo'lishi kerak","items":{"type":"string"}},"witnessIds":{"type":"array","description":"Guvohlar (Hesap user id) — witnessIns bilan birga berilsa qo'shiladi","items":{"type":"string","format":"uuid"}},"products":{"type":"array","description":"Mahsulotlar","items":{"$ref":"#/components/schemas/ContractProductRequest"}}},"required":["templateId"]},"DocumentValueRequest":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"position":{"type":"integer","format":"int32"},"value":{"type":"string"},"templateId":{"type":"string","format":"uuid"},"templateFieldId":{"type":"string","format":"uuid"},"keyName":{"type":"string"}}},"PaymentItem":{"type":"object","description":"To'lov jadvali qatori","properties":{"amount":{"type":"number","format":"double"},"paymentDate":{"type":"string","format":"date-time"}}},"CreatedDocumentResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}}},"WitnessRequest":{"type":"object","description":"Guvoh qo'shish","properties":{"witnessIn":{"type":"string","description":"Guvoh PINFL"}},"required":["witnessIn"]},"SignSessionRequest":{"type":"object","description":"Imzolash sessiyasini ochish","properties":{"signerIn":{"type":"string","description":"Kim imzolaydi — buyerIn, sellerIn yoki shartnoma guvohining PINFL'i"},"lang":{"type":"string","description":"Iframe tili: uz (default) / ru / en"},"redirectUrl":{"type":"string","description":"Imzo qo'yilgach mijoz qaytariladigan manzil"},"parentOrigin":{"type":"string","description":"Iframe joylashgan sahifa origini, masalan https://hamkor.uz — berilsa faqat shu sahifa iframe'ga joylay oladi va postMessage shu manzilga boradi"}},"required":["signerIn"]},"SignSessionResponse":{"type":"object","description":"Imzolash sessiyasi","properties":{"id":{"type":"string","format":"uuid"},"url":{"type":"string","description":"Iframe src — sdk.hesap.uz/sign/{token}"},"method":{"type":"string","description":"Shu taraf uchun talab qilinadigan tasdiqlash turi"},"expiresAt":{"type":"string","format":"date-time","description":"Sessiya amal qilish muddati"},"status":{"type":"string","description":"PENDING/SIGNED/REJECTED/EXPIRED"}}},"NoticeRequest":{"type":"object","description":"Talabnoma yuborish","properties":{"senderIn":{"type":"string","description":"Talabnoma yuboruvchi taraf PINFL/STIR — buyerIn yoki sellerIn"}}},"NoticeResponse":{"type":"object","description":"Talabnoma","properties":{"id":{"type":"string","format":"uuid","description":"Talabnoma ID"},"contractId":{"type":"string","format":"uuid","description":"Shartnoma ID"},"number":{"type":"integer","format":"int32","description":"Shartnoma bo'yicha tartib raqami"},"name":{"type":"string","description":"Nomi (uz)"},"status":{"type":"string","description":"Holati"},"sellerIn":{"type":"string","description":"Sotuvchi PINFL/STIR"},"buyerIn":{"type":"string","description":"Xaridor PINFL/STIR"},"createdAt":{"type":"string","format":"date-time","description":"Yaratilgan vaqt"}}},"PochtaRequest":{"type":"object","description":"Talabnomani pochta orqali yuborish","properties":{"senderIn":{"type":"string","description":"Talabnoma yuboruvchi taraf (buyerIn/sellerIn); qabul qiluvchi — boshqa taraf. Bo'sh bo'lsa qabul qiluvchi — xaridor"},"address":{"type":"string","description":"Qabul qiluvchi manzili (ko'cha, uy)"},"regionId":{"type":"integer","format":"int32","description":"Viloyat ID — GET /v1/pochta/regions"},"areaId":{"type":"integer","format":"int32","description":"Tuman ID — GET /v1/pochta/areas?regionId="}}},"PochtaResponse":{"type":"object","description":"Talabnoma pochta holati","properties":{"status":{"type":"string","description":"NONE — so'ralmagan, PENDING — qabul qilindi (Hesap imzolab pochtaga yuboradi), SENT — pochtaga yuborildi, DELIVERED — qabul qiluvchiga topshirildi"},"receiver":{"type":"string","description":"Qabul qiluvchi F.I.Sh. / nomi"},"address":{"type":"string","description":"Qabul qiluvchi manzili"},"requestedAt":{"type":"string","format":"date-time","description":"So'rov vaqti"},"sentAt":{"type":"string","format":"date-time","description":"Pochtaga yuborilgan vaqt"},"result":{"type":"string","description":"Yetkazish natijasi (SuccessDelivered, NotAtHome, ...)"},"resultNote":{"type":"string","description":"Yetkazish izohi"},"resultAt":{"type":"string","format":"date-time","description":"Natija vaqti"},"receiptUrl":{"type":"string","description":"Kvitansiya PDF havolasi"}}},"ContractProductResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"unit":{"type":"string","enum":["DONA","KG","LITR"]},"price":{"type":"number","format":"double"},"quantity":{"type":"number","format":"double"},"amount":{"type":"number","format":"double"},"deliveryAt":{"type":"string","format":"date-time"},"values":{"type":"object","additionalProperties":{}}}},"DocumentEnrichedResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"buyerUserId":{"type":"string","format":"uuid"},"sellerUserId":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid"},"number":{"type":"string"},"status":{"type":"string","enum":["CREATED","SIGNED_BY_SELLER","SIGNED_BY_BUYER","ACTIVE","COMPLETED","REJECTED","CANCELLED"]},"purpose":{"type":"string","enum":["CONTRACT","TTN","AKT","FACTURA"]},"buyerStatus":{"type":"string","enum":["PENDING","ACCEPTED","REJECTED","CANCELLED"]},"sellerStatus":{"type":"string","enum":["PENDING","ACCEPTED","REJECTED","CANCELLED"]},"price":{"type":"number","format":"double"},"currency":{"type":"string","enum":["UZS","USD","RUB"]},"currencyId":{"type":"string","format":"uuid"},"initialPayment":{"type":"number","format":"double"},"deliveryAt":{"type":"string","format":"date-time"},"buyerIn":{"type":"string"},"sellerIn":{"type":"string"},"buyer":{"$ref":"#/components/schemas/UserBasicResponse"},"seller":{"$ref":"#/components/schemas/UserBasicResponse"},"template":{"$ref":"#/components/schemas/TemplateBasicResponse"},"values":{"type":"array","items":{"$ref":"#/components/schemas/DocumentValueResponse"}},"products":{"type":"array","items":{"$ref":"#/components/schemas/ContractProductResponse"}},"deleted":{"type":"boolean"},"creatorIn":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserBasicResponse"},"partnerId":{"type":"string","format":"uuid"},"didoxDocId":{"type":"string"},"createdDate":{"type":"string","format":"date-time"},"lastModifiedDate":{"type":"string","format":"date-time"},"version":{"type":"integer","format":"int64"}}},"DocumentValueResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"position":{"type":"integer","format":"int32"},"value":{"type":"string"},"documentId":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid"},"templateFieldId":{"type":"string","format":"uuid"},"keyName":{"type":"string"},"deleted":{"type":"boolean"},"createdDate":{"type":"string","format":"date-time"},"lastModifiedDate":{"type":"string","format":"date-time"}}},"TemplateBasicResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"$ref":"#/components/schemas/TextModel"},"sellerName":{"$ref":"#/components/schemas/TextModel"},"buyerName":{"$ref":"#/components/schemas/TextModel"},"exchangeMode":{"type":"string"}}},"TextModel":{"type":"object","properties":{"uz":{"type":"string"},"ru":{"type":"string"},"en":{"type":"string"}}},"UserBasicResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"firstName":{"type":"string"},"lastName":{"type":"string"},"phone":{"type":"string"},"legalName":{"type":"string"},"type":{"type":"string","enum":["SUPER_ADMIN","ADMIN","CLIENT","COMPANY"]}}},"ClientRequest":{"type":"object","description":"Mijozni ro'yxatdan o'tqazish","properties":{"in":{"type":"string","description":"Jismoniy shaxs uchun 14 xonali PINFL, yuridik uchun 9 xonali STIR (YaTT — 14 xonali JSHSHIR)"},"type":{"type":"string","description":"CLIENT (jismoniy, default) yoki COMPANY (yuridik)","enum":["SUPER_ADMIN","ADMIN","CLIENT","COMPANY"]},"firstName":{"type":"string","description":"Ism"},"lastName":{"type":"string","description":"Familiya"},"midName":{"type":"string","description":"Otasining ismi"},"phone":{"type":"string","description":"Telefon — imzolash SMS kodi shu raqamga boradi","example":998901234567},"email":{"type":"string","description":"Email"},"passport":{"type":"string","description":"Pasport seriya va raqami","example":"AA1234567"},"passportIssuedBy":{"type":"string","description":"Pasportni bergan organ"},"passportIssueDate":{"type":"string","description":"Berilgan sana (YYYY-MM-DD)"},"passportExpiryDate":{"type":"string","description":"Amal qilish muddati (YYYY-MM-DD)"},"birthday":{"type":"string","description":"Tug'ilgan sana (YYYY-MM-DD)"},"isMan":{"type":"boolean","description":"Jinsi: true — erkak"},"address":{"type":"string","description":"Manzil"},"legalName":{"type":"string","description":"Yuridik shaxs to'liq nomi (type=COMPANY bo'lsa shart)"}},"required":["in"]},"ClientResponse":{"type":"object","description":"Mijoz","properties":{"id":{"type":"string","format":"uuid","description":"Hesap ichidagi id"},"in":{"type":"string","description":"PINFL yoki STIR"},"firstName":{"type":"string"},"lastName":{"type":"string"},"midName":{"type":"string"},"legalName":{"type":"string","description":"Yuridik shaxs nomi"},"type":{"type":"string","description":"CLIENT yoki COMPANY"},"phone":{"type":"string","description":"Telefon"},"verified":{"type":"boolean","description":"Shaxsi OneID/MyID/E-IMZO orqali tasdiqlanganmi"}}},"TokenRequest":{"type":"object","properties":{"appId":{"type":"string"},"appSecret":{"type":"string"}}},"TokenResponse":{"type":"object","properties":{"accessToken":{"type":"string"},"tokenType":{"type":"string"},"expiresIn":{"type":"integer","format":"int64"}}},"TemplateResponse":{"type":"object","description":"Shartnoma shabloni","properties":{"id":{"type":"string","format":"uuid"},"nameUz":{"type":"string","description":"Nomi (uz)"},"nameRu":{"type":"string","description":"Nomi (ru)"},"nameEn":{"type":"string","description":"Nomi (en)"},"individualVerificationType":{"type":"string","description":"Jismoniy shaxs uchun tasdiqlash turi"},"legalVerificationType":{"type":"string","description":"Yuridik shaxs uchun tasdiqlash turi"},"productEnabled":{"type":"boolean","description":"Mahsulot bo'limi yoqilganmi"},"productRequired":{"type":"boolean","description":"Mahsulot majburiymi"},"paymentScheduleEnabled":{"type":"boolean","description":"To'lov jadvali yoqilganmi"},"witnessCount":{"type":"integer","format":"int32","description":"Talab qilinadigan guvohlar soni"}}},"TemplateFieldResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"parentKey":{"type":"string"},"templateId":{"type":"string","format":"uuid"},"nameUz":{"type":"string"},"nameRu":{"type":"string"},"nameEn":{"type":"string"},"keyName":{"type":"string"},"type":{"type":"string","enum":["LIST","SELECT","MULTISELECT","DATE","INTEGER","DOUBLE","STRING","CHECKBOX","RADIO","DOUBLE_INPUT_DATE","DOUBLE_INPUT_INTEGER","DOUBLE_INPUT_DOUBLE","DOUBLE_INPUT_STRING"]},"position":{"type":"string","enum":["BOTTOM","UNDER","LEFT","RIGHT"]},"productField":{"type":"boolean"},"deleted":{"type":"boolean"},"createdDate":{"type":"string","format":"date-time"},"lastModifiedDate":{"type":"string","format":"date-time"}}},"SignSessionStatusResponse":{"type":"object","description":"Sessiya holati","properties":{"id":{"type":"string","format":"uuid"},"contractId":{"type":"string","format":"uuid"},"signerIn":{"type":"string"},"signerRole":{"type":"string","description":"PARTY (taraf) yoki WITNESS (guvoh)"},"status":{"type":"string","description":"PENDING/SIGNED/REJECTED/EXPIRED"},"method":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"}}},"PochtaPlace":{"type":"object","description":"Pochta viloyati/tumani","properties":{"id":{"type":"integer","format":"int32","description":"ID"},"name":{"type":"string","description":"Nomi"},"regionId":{"type":"integer","format":"int32","description":"Tuman uchun — viloyat ID"}}},"WitnessResponse":{"type":"object","description":"Shartnoma guvohi","properties":{"in":{"type":"string","description":"Guvoh PINFL"},"fullName":{"type":"string","description":"F.I.Sh."},"status":{"type":"string","description":"PENDING (imzo kutilmoqda) / ACCEPTED (imzoladi) / REJECTED (rad etdi)"},"updatedAt":{"type":"string","format":"date-time","description":"Holat oxirgi o'zgargan vaqt"}}}},"securitySchemes":{"sdkToken":{"type":"http","description":"POST /v1/auth/token javobidagi accessToken","scheme":"bearer"}}}}