Layero Support API
The support API from Layero — 13 operation(s) for support.
The support API from Layero — 13 operation(s) for support.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/layero-ru:layero-ru-support-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Layero Support API
version: 0.1.0
tags:
- name: Support
paths:
/api/support/attachments:
post:
tags:
- Support
summary: Upload Attachment
description: 'Залить картинку ДО отправки сообщения.
Двухшаговость (аплоад → отправка с `attachment_ids`) нужна для UX:
пока юзер дописывает текст, файл уже уезжает, и отправка мгновенная.
Побочный эффект — осиротевшие загрузки, если вкладку закрыли; их
подметает retention (V160).
Соединение из пула НЕ держим на время заливки в S3 (нет
Depends(get_conn)): внешний I/O под захваченным коннектом — ровно тот
сценарий, которым 2026-06-30 выложило пул и уронило resolve.'
operationId: upload_attachment_api_support_attachments_post
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/Body_upload_attachment_api_support_attachments_post'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/AttachmentOut'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/tickets/active:
get:
tags:
- Support
summary: Get Active Ticket
description: Вернуть текущий активный тикет юзера, либо null.
operationId: get_active_ticket_api_support_tickets_active_get
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/TicketOut'
- type: 'null'
title: Response Get Active Ticket Api Support Tickets Active Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/tickets:
post:
tags:
- Support
summary: Create Ticket
operationId: create_ticket_api_support_tickets_post
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateTicketIn'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/TicketOut'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/tickets/{ticket_id}/messages:
post:
tags:
- Support
summary: Send Message
operationId: send_message_api_support_tickets__ticket_id__messages_post
parameters:
- name: ticket_id
in: path
required: true
schema:
type: string
format: uuid
title: Ticket Id
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SendMessageIn'
responses:
'202':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Send Message Api Support Tickets Ticket Id Messages Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
get:
tags:
- Support
summary: List Ticket Messages
description: История сообщений тикета (V067). Виджет грузит при открытии.
operationId: list_ticket_messages_api_support_tickets__ticket_id__messages_get
parameters:
- name: ticket_id
in: path
required: true
schema:
type: string
format: uuid
title: Ticket Id
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/MessageOut'
title: Response List Ticket Messages Api Support Tickets Ticket Id Messages Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/history:
get:
tags:
- Support
summary: Get Full History
description: 'Полная история всех сообщений юзера через все его тикеты — для
виджета (правка #1: пользователь видит свои прошлые обращения).'
operationId: get_full_history_api_support_history_get
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/HistoryMessageOut'
title: Response Get Full History Api Support History Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/notification-thread/activity:
get:
tags:
- Support
summary: Get Notification Thread Activity
description: 'Latest activity timestamp of the user''s notification thread.
FE polls this to trigger widget auto-open when a fresh system
message arrives — the regular `tickets/active` query returns only
kind=''support'' so it can''t detect notification activity itself.'
operationId: get_notification_thread_activity_api_support_notification_thread_activity_get
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Get Notification Thread Activity Api Support Notification Thread Activity Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/tickets/{ticket_id}/close:
post:
tags:
- Support
summary: Close Ticket
operationId: close_ticket_api_support_tickets__ticket_id__close_post
parameters:
- name: ticket_id
in: path
required: true
schema:
type: string
format: uuid
title: Ticket Id
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/TicketOut'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/tickets/{ticket_id}/events:
get:
tags:
- Support
summary: Long Poll Events
description: 'Long-polling — заменяет SSE-стрим. YC API Gateway буферизует
response целиком и не пропускает text/event-stream → SSE не доходит
до браузера. Long-poll работает потому что каждый запрос завершается
коротким HTTP-ответом, который API Gateway forward''ит как обычно.
Логика:
1. Сразу проверяем — есть ли новые сообщения (id > since)?
→ если да, возвращаем сразу.
2. Иначе подписываемся на in-process pubsub (тот же что был у SSE)
и ждём событие до 25s.
→ если событие пришло → выгружаем фresh сообщения из БД.
→ если timeout → возвращаем пусто, клиент дёрнет снова.
25s выбрано меньше read-timeout YC API Gateway (300s) с запасом.
🚨 `Depends(get_conn)` здесь НЕТ намеренно: он пиннил пул-коннект на ВЕСЬ
запрос, включая 25-секундное ожидание. Виджет поддержки висит на каждой
открытой вкладке панели и перезапрашивает эту ручку встык, то есть коннект
был занят практически постоянно. При `max_size=10` и ~6 слотах, вечно
занятых LISTEN''ами и advisory-локом лидера, у лидер-воркера оставалось ~4
свободных — несколько вкладок выпивали пул досуха, а `pool.acquire()` без
таймаута ждёт ВЕЧНО, поэтому все прочие запросы к этому воркеру висели до
504. Это ровно тот футган, что уронил /probe и лог-лонг-полл (INCIDENT
2026-06-30); там его закрыли, а виджет поддержки пропустили — он и
обвалил панель 11.08.2026. БД трогаем короткими `connection()`-блоками,
на время ожидания коннект НЕ удерживается.'
operationId: long_poll_events_api_support_tickets__ticket_id__events_get
parameters:
- name: ticket_id
in: path
required: true
schema:
type: string
format: uuid
title: Ticket Id
- name: since
in: query
required: false
schema:
type: integer
default: 0
title: Since
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/EventsOut'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/tickets/{ticket_id}/stream:
get:
tags:
- Support
summary: Stream Events
description: 'SSE-стрим событий тикета (operator_message, status_changed).
Виджет подписывается при открытии активного чата. Закрытие соединения
(юзер закрыл вкладку / переход на др страницу) → автоматически
отписывает Queue из pubsub.
🚨 `Depends(get_conn)` убран по той же причине, что и в long_poll_events
выше, но здесь было хуже: стрим живёт, пока открыта вкладка, то есть
пул-коннект удерживался НЕОГРАНИЧЕННО долго. Проверку доступа делаем
коротким коннектом, дальше поток идёт из in-process pubsub без БД.'
operationId: stream_events_api_support_tickets__ticket_id__stream_get
parameters:
- name: ticket_id
in: path
required: true
schema:
type: string
format: uuid
title: Ticket Id
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/telegram-link/status:
get:
tags:
- Support
summary: Get Telegram Link Status
description: 'True если у юзера уже есть привязанный TG-аккаунт. Виджет
использует это чтобы скрыть UI-привязки когда уже залинковано.'
operationId: get_telegram_link_status_api_support_telegram_link_status_get
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Get Telegram Link Status Api Support Telegram Link Status Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/telegram-link:
delete:
tags:
- Support
summary: Delete Telegram Link
description: 'Отвязать Telegram-аккаунт. После этого ответы операторов перестанут
приходить в личку и линк нужно будет привязать заново через виджет.'
operationId: delete_telegram_link_api_support_telegram_link_delete
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/telegram-link/verify:
post:
tags:
- Support
summary: Verify Telegram Login
description: 'Verify Telegram Login Widget callback и связать TG-аккаунт с
Layero-юзером. Single-click flow без копи-паста.
Validation per https://core.telegram.org/widgets/login#checking-authorization
1. secret_key = SHA-256(bot_token)
2. data_check_string = ''\n''.join(sorted "k=v") без hash
3. HMAC-SHA-256(secret_key, data_check_string) == hash
4. auth_date в пределах 24 часов'
operationId: verify_telegram_login_api_support_telegram_link_verify_post
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TelegramAuthIn'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties: true
title: Response Verify Telegram Login Api Support Telegram Link Verify Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/support/telegram-link/init:
post:
tags:
- Support
summary: Init Telegram Link
description: 'Сгенерить короткий код для привязки TG-аккаунта.
Юзер копирует команду `/link 123456`, шлёт боту обычным сообщением.
Code TTL 10 минут.
Старая схема (JWT deep-link через /start link_) сломана о
особенности Telegram-клиентов (см. V068 NOTICE). Код через обычное
сообщение работает в любом TG-клиенте.'
operationId: init_telegram_link_api_support_telegram_link_init_post
parameters:
- name: authorization
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Authorization
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/LinkInitOut'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
SendMessageIn:
properties:
text:
type: string
maxLength: 4000
title: Text
default: ''
attachment_ids:
items:
type: string
format: uuid
type: array
title: Attachment Ids
type: object
title: SendMessageIn
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
TelegramAuthIn:
properties:
id:
type: integer
title: Id
first_name:
anyOf:
- type: string
- type: 'null'
title: First Name
last_name:
anyOf:
- type: string
- type: 'null'
title: Last Name
username:
anyOf:
- type: string
- type: 'null'
title: Username
photo_url:
anyOf:
- type: string
- type: 'null'
title: Photo Url
auth_date:
type: integer
title: Auth Date
hash:
type: string
title: Hash
type: object
required:
- id
- auth_date
- hash
title: TelegramAuthIn
description: 'Payload от Telegram Login Widget после успешной авторизации.
https://core.telegram.org/widgets/login#receiving-authorization-data'
AttachmentOut:
properties:
id:
type: string
format: uuid
title: Id
url:
type: string
title: Url
content_type:
type: string
title: Content Type
size_bytes:
type: integer
title: Size Bytes
width:
anyOf:
- type: integer
- type: 'null'
title: Width
height:
anyOf:
- type: integer
- type: 'null'
title: Height
file_name:
anyOf:
- type: string
- type: 'null'
title: File Name
type: object
required:
- id
- url
- content_type
- size_bytes
title: AttachmentOut
description: 'Картинка в сообщении. `url` — presigned-GET на час (V160):
постоянной публичной ссылки у скриншота из поддержки быть не должно.'
HistoryMessageOut:
properties:
id:
type: integer
title: Id
direction:
type: string
title: Direction
text:
type: string
title: Text
at:
type: string
title: At
attachments:
items:
$ref: '#/components/schemas/AttachmentOut'
type: array
title: Attachments
ticket_id:
type: string
format: uuid
title: Ticket Id
ticket_seq:
type: integer
title: Ticket Seq
ticket_status:
type: string
title: Ticket Status
ticket_kind:
type: string
title: Ticket Kind
default: support
ticket_closed_at:
anyOf:
- type: string
- type: 'null'
title: Ticket Closed At
type: object
required:
- id
- direction
- text
- at
- ticket_id
- ticket_seq
- ticket_status
- ticket_closed_at
title: HistoryMessageOut
description: Message + ticket-attribution для отрисовки boundary-разделителей.
TicketOut:
properties:
id:
type: string
format: uuid
title: Id
seq:
type: integer
title: Seq
status:
type: string
title: Status
subject:
anyOf:
- type: string
- type: 'null'
title: Subject
project_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Project Id
created_at:
type: string
title: Created At
last_activity_at:
type: string
title: Last Activity At
closed_at:
anyOf:
- type: string
- type: 'null'
title: Closed At
ready:
type: boolean
title: Ready
type: object
required:
- id
- seq
- status
- subject
- project_id
- created_at
- last_activity_at
- closed_at
- ready
title: TicketOut
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
Body_upload_attachment_api_support_attachments_post:
properties:
file:
type: string
contentMediaType: application/octet-stream
title: File
type: object
required:
- file
title: Body_upload_attachment_api_support_attachments_post
EventsOut:
properties:
messages:
items:
$ref: '#/components/schemas/MessageOut'
type: array
title: Messages
ticket_status:
type: string
title: Ticket Status
ticket_ready:
type: boolean
title: Ticket Ready
next_since:
type: integer
title: Next Since
type: object
required:
- messages
- ticket_status
- ticket_ready
- next_since
title: EventsOut
description: 'Long-poll events response. Клиент держит `next_since` и шлёт его
обратно в следующем запросе.'
LinkInitOut:
properties:
tg_deep_link:
type: string
title: Tg Deep Link
https_link:
type: string
title: Https Link
start_command:
type: string
title: Start Command
expires_at:
type: string
title: Expires At
type: object
required:
- tg_deep_link
- https_link
- start_command
- expires_at
title: LinkInitOut
CreateTicketIn:
properties:
message:
type: string
maxLength: 4000
title: Message
default: ''
project_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Project Id
organization_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Organization Id
attachment_ids:
items:
type: string
format: uuid
type: array
title: Attachment Ids
type: object
title: CreateTicketIn
MessageOut:
properties:
id:
type: integer
title: Id
direction:
type: string
title: Direction
text:
type: string
title: Text
at:
type: string
title: At
attachments:
items:
$ref: '#/components/schemas/AttachmentOut'
type: array
title: Attachments
type: object
required:
- id
- direction
- text
- at
title: MessageOut