{"openapi":"3.1.0","info":{"title":"Invora API","summary":"Некастодиальный криптоплатёжный шлюз для Telegram-ботов","description":"Создавайте инвойсы и получайте подписанные вебхуки о подтверждённых платежах. Invora не хранит приватные ключи и не принимает средства: платежи идут напрямую в кошелёк мерчанта.","version":"0.1.0"},"paths":{"/healthz":{"get":{"tags":["service"],"summary":"Процесс жив","operationId":"healthz_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Healthz Healthz Get"}}}}}}},"/version":{"get":{"tags":["service"],"summary":"Какая версия кода работает","description":"Отпечаток кода и номер коммита, если он задан окружением.\n\nНужен ровно для одного вопроса: «на сервере точно тот код, который\nя отправил?». На него нельзя ответить по панели хостинга — она знает\nпро сборку, а не про её содержимое. Отпечаток считается по файлам,\nпоэтому его можно посчитать и в своей рабочей копии, и сравнить.","operationId":"version_version_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Version Version Get"}}}}}}},"/readyz":{"get":{"tags":["service"],"summary":"Готов принимать трафик","description":"Проверяет и БД, не только факт запуска процесса.\n\nВ ответе — ПРИЧИНА, а не пустая строка: 23.10.2026 база Amvera\nперестала отвечать, и `/readyz` отдавал `\"database\": \"\"`, потому что\nу сетевого исключения пустой текст. Дежурному нужен тип ошибки,\nчтобы отличить «база упала» от «сломался запрос».","operationId":"readyz_readyz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/invoices":{"post":{"tags":["invoices"],"summary":"Create Invoice Endpoint","description":"Создать инвойс.\n\nСумма в ответе содержит уникальный хвост — платить нужно ровно её,\nиначе платёж не будет сопоставлен автоматически.","operationId":"create_invoice_endpoint_v1_invoices_post","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["invoices"],"summary":"List Invoices Endpoint","operationId":"list_invoices_endpoint_v1_invoices_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/invoices/{public_id}":{"get":{"tags":["invoices"],"summary":"Get Invoice Endpoint","operationId":"get_invoice_endpoint_v1_invoices__public_id__get","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/invoices/{public_id}/cancel":{"post":{"tags":["invoices"],"summary":"Cancel Invoice Endpoint","description":"Отменить счёт: он перестаёт ждать оплату, а занятая сумма освобождается.\n\nЗАЧЕМ ЭТО В API, А НЕ ТОЛЬКО В БОТЕ. Ошибку в сумме заказа замечает\nсервер бота — он же и создавал счёт. Заставлять владельца бота идти\nв панель и нажимать кнопку значит оставить в интеграции дыру: счёт\nс ошибочной суммой продолжал бы занимать уникальный хвост до истечения\nсрока. Повторная отмена отвечает 200: клиент, у которого оборвалась\nсвязь на ответе, повторит запрос, и 409 за собственное действие был бы\nстранным ответом.","operationId":"cancel_invoice_endpoint_v1_invoices__public_id__cancel_post","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/stars/payments":{"post":{"tags":["stars"],"summary":"Учесть платёж в звёздах","description":"Принять `successful_payment` из бота мерчанта.\n\nИдемпотентно по `telegram_payment_charge_id`: повторная отправка того же\nсобытия не создаёт второй записи и не задваивает выручку. Признак указан\nв поле `created` — статус ответа намеренно всегда 200, чтобы повтор\nне выглядел для вызывающего как ошибка.","operationId":"record_payment_endpoint_v1_stars_payments_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StarsPaymentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StarsPaymentCreated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["stars"],"summary":"Список учтённых платежей в звёздах","operationId":"list_payments_endpoint_v1_stars_payments_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StarsPaymentList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/stars/refunds":{"post":{"tags":["stars"],"summary":"Отметить возврат звёзд","description":"Отметить возврат.\n\nTelegram умеет возвращать звёзды, поэтому возврат — штатное событие.\nБез его учёта выручка в статистике осталась бы завышенной.","operationId":"refund_endpoint_v1_stars_refunds_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StarsRefundRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StarsPaymentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/deliveries":{"get":{"tags":["webhooks"],"summary":"История доставки вебхуков","operationId":"list_deliveries_endpoint_v1_webhooks_deliveries_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/deliveries/{delivery_id}/resend":{"post":{"tags":["webhooks"],"summary":"Повторить проваленную доставку","description":"Поставить проваленное событие в очередь заново.\n\nПовторяется та же строка, а не создаётся новая: уникальный индекс по\n`(merchant_id, dedup_key)` не дал бы вставить вторую, и событие потерялось\nбы. Доставленное повторять нельзя — получатель увидел бы дубль.","operationId":"resend_delivery_endpoint_v1_webhooks_deliveries__delivery_id__resend_post","parameters":[{"name":"delivery_id","in":"path","required":true,"schema":{"type":"integer","title":"Delivery Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryResendResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"DeliveryList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DeliveryResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"failed":{"type":"integer","title":"Failed"}},"type":"object","required":["items","total","failed"],"title":"DeliveryList"},"DeliveryResendResponse":{"properties":{"delivery":{"$ref":"#/components/schemas/DeliveryResponse"},"message":{"type":"string","title":"Message"}},"type":"object","required":["delivery","message"],"title":"DeliveryResendResponse"},"DeliveryResponse":{"properties":{"id":{"type":"integer","title":"Id"},"event_type":{"type":"string","title":"Event Type"},"url":{"type":"string","title":"Url"},"status":{"type":"string","title":"Status"},"attempt":{"type":"integer","title":"Attempt"},"status_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status Code"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"next_attempt_at":{"type":"string","format":"date-time","title":"Next Attempt At"},"delivered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Delivered At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"}},"type":"object","required":["id","event_type","url","status","attempt","next_attempt_at","created_at","payload"],"title":"DeliveryResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"InvoiceCreateRequest":{"properties":{"network":{"type":"string","title":"Network","default":"tron","examples":["tron"]},"asset":{"type":"string","title":"Asset","default":"USDT","examples":["USDT"]},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string"}],"title":"Amount","examples":["10.50"]},"currency_fiat":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}],"title":"Currency Fiat","examples":["RUB"]},"amount_fiat":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string"},{"type":"null"}],"title":"Amount Fiat"},"ttl_seconds":{"anyOf":[{"type":"integer","maximum":86400.0,"minimum":60.0},{"type":"null"}],"title":"Ttl Seconds"},"tolerance_bps":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":0.0},{"type":"null"}],"title":"Tolerance Bps"},"description":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Description"}},"type":"object","required":["amount"],"title":"InvoiceCreateRequest"},"InvoiceListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/InvoiceResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"InvoiceListResponse"},"InvoiceResponse":{"properties":{"public_id":{"type":"string","title":"Public Id"},"status":{"type":"string","title":"Status"},"network":{"type":"string","title":"Network"},"asset":{"type":"string","title":"Asset"},"address":{"type":"string","title":"Address"},"amount":{"type":"string","title":"Amount"},"amount_raw":{"type":"integer","title":"Amount Raw"},"decimals":{"type":"integer","title":"Decimals"},"amount_base":{"type":"string","title":"Amount Base"},"received":{"type":"string","title":"Received"},"overpaid":{"type":"string","title":"Overpaid"},"confirmations_required":{"type":"integer","title":"Confirmations Required"},"tolerance_bps":{"type":"integer","title":"Tolerance Bps"},"currency_fiat":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency Fiat"},"amount_fiat":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Amount Fiat"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"paid_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paid At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"links":{"additionalProperties":{"type":"string"},"type":"object","title":"Links","default":{}},"links_go":{"additionalProperties":{"type":"string"},"type":"object","title":"Links Go","default":{}}},"type":"object","required":["public_id","status","network","asset","address","amount","amount_raw","decimals","amount_base","received","overpaid","confirmations_required","tolerance_bps","expires_at","created_at"],"title":"InvoiceResponse","description":"Ответ по инвойсу. Все суммы — строки, чтобы не терять точность в JSON."},"StarsPaymentCreated":{"properties":{"created":{"type":"boolean","title":"Created"},"payment":{"$ref":"#/components/schemas/StarsPaymentResponse"}},"type":"object","required":["created","payment"],"title":"StarsPaymentCreated","description":"Ответ на приём платежа.\n\n`created=false` означает, что платёж уже был учтён: бот мерчанта может\nповторять отправку, и это не ошибка."},"StarsPaymentList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/StarsPaymentResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"net_stars":{"type":"integer","title":"Net Stars"},"gross_stars":{"type":"integer","title":"Gross Stars"},"refunded_stars":{"type":"integer","title":"Refunded Stars"}},"type":"object","required":["items","total","net_stars","gross_stars","refunded_stars"],"title":"StarsPaymentList"},"StarsPaymentRequest":{"properties":{"telegram_payment_charge_id":{"type":"string","maxLength":255,"minLength":1,"title":"Telegram Payment Charge Id"},"amount":{"type":"integer","maximum":1000000.0,"exclusiveMinimum":0.0,"title":"Amount","examples":[100]},"currency":{"type":"string","maxLength":8,"title":"Currency","default":"XTR"},"provider_payment_charge_id":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Provider Payment Charge Id"},"payload":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Payload"},"telegram_user_id":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Telegram User Id"},"paid_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paid At"}},"type":"object","required":["telegram_payment_charge_id","amount"],"title":"StarsPaymentRequest","description":"Событие `successful_payment` от бота мерчанта."},"StarsPaymentResponse":{"properties":{"id":{"type":"integer","title":"Id"},"telegram_payment_charge_id":{"type":"string","title":"Telegram Payment Charge Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"payload":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payload"},"invoice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Id"},"telegram_user_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Telegram User Id"},"refunded":{"type":"boolean","title":"Refunded"},"paid_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paid At"},"refunded_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Refunded At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","telegram_payment_charge_id","amount","currency","refunded","created_at"],"title":"StarsPaymentResponse"},"StarsRefundRequest":{"properties":{"telegram_payment_charge_id":{"type":"string","maxLength":255,"minLength":1,"title":"Telegram Payment Charge Id"}},"type":"object","required":["telegram_payment_charge_id"],"title":"StarsRefundRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}