openapi: 3.2.0
info:
  title: Generated Stack API
  version: 1.1.0
  summary: Modular OpenAPI contract for the generated stack
  description: |
    Source-of-truth API contract.
    Generated bundle is served by docs endpoints.
  license:
    name: MIT
    identifier: MIT
servers:
  - url: https://api.example.test
    description: Production
  - url: https://staging-api.example.test
    description: Staging
security: []
tags:
  - name: auth
    summary: Authentication and session lifecycle
    description: Registration, login, session lifecycle, OAuth, native exchange.
  - name: company
    summary: Company context and switching
    description: Company listing, creation, and active company switching.
  - name: clients
    summary: Clients, services and payments
    description: Client workspace, client services, payment actions and idempotent payment events.
  - name: docs
    summary: API documentation and testing assets
    description: Bundled OpenAPI artifacts, endpoint catalog, and testing collection metadata.
  - name: catalog
    summary: Конструктор workflow — типы действий и зависимостей
    description: |
      Каталог поддерживаемых типов узлов графа (action_types) и типов секретов/подключений проекта
      (action_dependency_types).
  - name: runs
    summary: Запуски workflow и наблюдение исполнения
    description: |
      Обзор выполнения workflow_run и по шагам — записи исполнений действий (action_runs) и события.
  - name: site_chat
    summary: Чат на сайте, посетители и webvisor-lite
    description: Lightweight widget, visitor/session analytics, monitoring commands and chat conversations.
  - name: ai
    summary: AI-сотрудник проекта и model providers
    description: Project-scoped AI employee, model provider catalog, chat sessions, prompt proposals and model cache.
paths:
  /site-chat/widget.js:
    get:
      tags:
        - site_chat
      summary: Lightweight site chat widget bootstrap
      operationId: siteChatWidgetScript
      responses:
        '200':
          description: JavaScript bootstrap
          content:
            application/javascript:
              schema:
                type: string
  /api/v1/auth/register:
    post:
      tags:
        - auth
      summary: Register account
      operationId: authRegister
      description: Create inactive account and issue activation flow.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
                - password
              properties:
                email:
                  type: string
                  format: email
                password:
                  type: string
                  minLength: 12
            examples:
              owner:
                value:
                  email: owner@example.test
                  password: example-password-only
              admin:
                value:
                  email: admin@example.test
                  password: example-password-only
      responses:
        '201':
          description: Registration accepted
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                properties:
                  status:
                    type: string
                    example: activation_required
              examples:
                created:
                  value:
                    status: activation_required
        '422':
          description: Validation error
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid_email:
                  value:
                    status: fix_required
                    title: Validation required
                    detail: Исправьте email и повторите запрос.
                    action: Проверьте validate email
                    validate: email
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/register \
              -H 'Content-Type: application/json' \
              -d '{"email":"owner@example.test","password":"example-password-only"}'
  /api/v1/auth/activate:
    post:
      tags:
        - auth
      summary: Activate account
      operationId: authActivate
      x-runtime-status: preview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - token
              properties:
                token:
                  type: string
            examples:
              activation:
                value:
                  token: act_6d2f8e0a4f
      responses:
        '200':
          description: Activated
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                properties:
                  status:
                    type: string
                    example: activated
              examples:
                ok:
                  value:
                    status: activated
        '400':
          description: Bad token
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid:
                  value:
                    status: fix_required
                    title: Activation validate required
                    detail: Проверьте activation token и повторите запрос.
                    action: Проверьте validate token
                    validate: token
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/activate \
              -H 'Content-Type: application/json' \
              -d '{"token":"act_6d2f8e0a4f"}'
  /api/v1/auth/login:
    post:
      tags:
        - auth
      summary: Login with email/password
      operationId: authLogin
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
                - password
              properties:
                email:
                  type: string
                  format: email
                password:
                  type: string
            examples:
              primary:
                value:
                  email: owner@example.test
                  password: example-password-only
              secondary:
                value:
                  email: admin@example.test
                  password: example-password-only
      responses:
        '200':
          description: Authenticated. Browser clients also receive HttpOnly `rp_access`, HttpOnly `rp_refresh`, and readable `rp_csrf` cookies.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - access_token
                  - token_type
                  - expires_in
                  - csrf_token
                  - access_expires_at
                  - refresh_expires_at
                properties:
                  access_token:
                    type: string
                  token_type:
                    type: string
                    example: Bearer
                  expires_in:
                    type: integer
                    example: 900
                  csrf_token:
                    type: string
                    description: Double-submit token mirrored in the `rp_csrf` cookie for unsafe browser cookie requests.
                  access_expires_at:
                    type: string
                    format: date-time
                  refresh_expires_at:
                    type: string
                    format: date-time
              examples:
                success:
                  value:
                    access_token: eyJhbGciOi...
                    token_type: Bearer
                    expires_in: 900
                    csrf_token: csrf_opaque_token
                    access_expires_at: '2026-06-25T12:15:00Z'
                    refresh_expires_at: '2026-07-25T12:00:00Z'
        '401':
          description: Invalid credentials
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                wrong_password:
                  value:
                    status: fix_required
                    title: Sign-in validate required
                    detail: Исправьте email или password и повторите вход.
                    action: Проверьте validate email,password
                    validate: email,password
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/login \
              -H 'Content-Type: application/json' \
              -d '{"email":"owner@example.test","password":"example-password-only"}'
  /api/v1/auth/logout:
    post:
      tags:
        - auth
      summary: Logout current session
      operationId: authLogout
      security:
        - bearerAuth: []
      responses:
        '204':
          description: Session revoked
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                unauthorized:
                  value:
                    status: fix_required
                    title: Session validate required
                    detail: Выполните вход и повторите запрос.
                    action: Проверьте validate access_token
                    validate: access_token
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/logout \
              -H 'Authorization: Bearer <access_token>'
  /api/v1/auth/refresh:
    post:
      tags:
        - auth
      summary: Refresh access token
      operationId: authRefresh
      description: Uses the HttpOnly `rp_refresh` cookie and rotates access, refresh, and CSRF tokens. Browser clients must send `X-CSRF-Token` matching the readable `rp_csrf` cookie.
      parameters:
        - name: X-CSRF-Token
          in: header
          required: false
          schema:
            type: string
          description: Required for browser cookie refresh requests.
      responses:
        '200':
          description: Token refreshed. A reused old refresh token revokes the session family.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - access_token
                  - token_type
                  - expires_in
                  - csrf_token
                  - access_expires_at
                  - refresh_expires_at
                properties:
                  access_token:
                    type: string
                  token_type:
                    type: string
                  expires_in:
                    type: integer
                  csrf_token:
                    type: string
                  access_expires_at:
                    type: string
                    format: date-time
                  refresh_expires_at:
                    type: string
                    format: date-time
              examples:
                refreshed:
                  value:
                    access_token: eyJhbGciOi...
                    token_type: Bearer
                    expires_in: 900
                    csrf_token: csrf_opaque_token
                    access_expires_at: '2026-06-25T12:15:00Z'
                    refresh_expires_at: '2026-07-25T12:00:00Z'
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                unauthorized:
                  value:
                    status: fix_required
                    title: Session validate required
                    detail: Выполните вход и повторите запрос.
                    action: Проверьте validate access_token
                    validate: access_token
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
        '403':
          description: Missing or mismatched CSRF token for a browser cookie refresh request.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/refresh \
              -H 'X-CSRF-Token: <rp_csrf>' \
              --cookie 'rp_refresh=<refresh_cookie>; rp_csrf=<rp_csrf>'
  /api/v1/auth/refresh/csrf:
    get:
      tags:
        - auth
      summary: Renew browser CSRF token from refresh cookie
      operationId: authRefreshCSRF
      description: Issues a fresh readable `rp_csrf` cookie when the browser still has a valid refresh cookie but the short access cookie or readable CSRF cookie is missing. This endpoint does not rotate the refresh token and does not return an access token.
      security: []
      responses:
        '200':
          description: CSRF token renewed from refresh cookie.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - csrf_token
                properties:
                  csrf_token:
                    type: string
                    description: Double-submit token mirrored in the `rp_csrf` cookie.
              examples:
                renewed:
                  value:
                    csrf_token: csrf_opaque_token
        '401':
          description: Missing or invalid refresh cookie.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/auth/refresh/csrf \
              --cookie 'rp_refresh=<refresh_cookie>'
  /api/v1/auth/csrf:
    get:
      tags:
        - auth
      summary: Renew browser CSRF token
      operationId: authCSRF
      description: Issues a fresh readable `rp_csrf` cookie for an already authenticated browser session. Used by same-origin clients to recover from a missing or stale CSRF cookie before retrying unsafe cookie-authenticated requests.
      security:
        - bearerAuth: []
      responses:
        '200':
          description: CSRF token renewed.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - csrf_token
                properties:
                  csrf_token:
                    type: string
                    description: Double-submit token mirrored in the `rp_csrf` cookie.
              examples:
                renewed:
                  value:
                    csrf_token: csrf_opaque_token
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/auth/csrf \
              --cookie 'rp_access=<access_cookie>'
  /api/v1/auth/me:
    get:
      tags:
        - auth
      summary: Current user profile
      operationId: authMe
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Current authenticated user
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserMe'
              examples:
                me:
                  value:
                    user_id: e2f0d908-03d7-4ba0-9c76-f0d1553f7428
                    email: owner@example.test
                    current_company_id: b98772dd-7cf7-455d-a750-9ef142546b37
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                unauthorized:
                  value:
                    status: fix_required
                    title: Session validate required
                    detail: Выполните вход и повторите запрос.
                    action: Проверьте validate access_token
                    validate: access_token
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/auth/me \
              -H 'Authorization: Bearer <access_token>'
  /api/v1/auth/workspace-context:
    get:
      tags:
        - auth
      summary: Get persisted workspace context
      operationId: authWorkspaceContextGet
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Persisted active company and project for this user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceContext'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
    put:
      tags:
        - auth
      summary: Persist active company and project context
      operationId: authWorkspaceContextPut
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkspaceContextPatch'
      responses:
        '200':
          description: Updated workspace context
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceContext'
        '403':
          description: Company or project is not available to the user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
  /api/v1/auth/oauth/{provider}/start:
    get:
      tags:
        - auth
      summary: OAuth start
      operationId: authOauthStart
      x-runtime-status: preview
      parameters:
        - name: provider
          in: path
          required: true
          schema:
            type: string
            enum:
              - google
              - yandex
              - vk
      responses:
        '200':
          description: OAuth start metadata
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - auth_url
                  - state
                properties:
                  auth_url:
                    type: string
                  state:
                    type: string
              examples:
                metadata:
                  value:
                    auth_url: https://accounts.google.com/o/oauth2/v2/auth?...
                    state: state_47f...
        '302':
          description: Redirect to provider auth page
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
        '400':
          description: Unsupported provider
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                bad_provider:
                  value:
                    status: fix_required
                    title: OAuth provider validate required
                    detail: Исправьте provider и повторите запрос.
                    action: Проверьте validate provider
                    validate: provider
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L 'https://api.example.test/api/v1/auth/oauth/google/start'
  /api/v1/auth/oauth/{provider}/callback:
    get:
      tags:
        - auth
      summary: OAuth callback
      operationId: authOauthCallback
      x-runtime-status: preview
      parameters:
        - name: provider
          in: path
          required: true
          schema:
            type: string
            enum:
              - google
              - yandex
              - vk
        - name: code
          in: query
          required: false
          schema:
            type: string
        - name: state
          in: query
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Callback processed
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                properties:
                  status:
                    type: string
                    example: callback_processed
              examples:
                processed:
                  value:
                    status: callback_processed
        '302':
          description: Redirect to app/deep-link after identity mapping
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
        '400':
          description: Invalid callback payload
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid:
                  value:
                    status: fix_required
                    title: OAuth callback validate required
                    detail: Проверьте validate code,state и повторите запрос.
                    action: Проверьте validate code,state
                    validate: code,state
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L 'https://api.example.test/api/v1/auth/oauth/google/callback?code=abc&state=state_47f'
  /api/v1/auth/telegram/miniapp:
    post:
      tags:
        - auth
      summary: Telegram Mini App sign-in
      operationId: authTelegramMiniApp
      x-runtime-status: preview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - init_data
              properties:
                init_data:
                  type: string
            examples:
              tg:
                value:
                  init_data: query_id=AAE...&user=%7B...%7D&hash=...
      responses:
        '200':
          description: Authenticated via Telegram
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - access_token
                  - token_type
                  - expires_in
                properties:
                  access_token:
                    type: string
                  token_type:
                    type: string
                  expires_in:
                    type: integer
              examples:
                success:
                  value:
                    access_token: eyJhbGciOi...
                    token_type: Bearer
                    expires_in: 900
        '400':
          description: Invalid Telegram init data
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid_tg_data:
                  value:
                    status: fix_required
                    title: Telegram payload validate required
                    detail: Проверьте init_data и повторите запрос.
                    action: Проверьте validate init_data
                    validate: init_data
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/telegram/miniapp \
              -H 'Content-Type: application/json' \
              -d '{"init_data":"query_id=AAE...&user=%7B...%7D&hash=..."}'
  /api/v1/auth/native/exchange:
    post:
      tags:
        - auth
      summary: Native code exchange (Qt/Android)
      operationId: authNativeExchange
      x-runtime-status: preview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - code
                - code_verifier
                - state
              properties:
                code:
                  type: string
                code_verifier:
                  type: string
                state:
                  type: string
            examples:
              qt:
                value:
                  code: oauth_code_abc
                  code_verifier: qJ4...k3
                  state: state_47f...
      responses:
        '200':
          description: Session created for native app
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - access_token
                  - token_type
                  - expires_in
                  - device_credential
                properties:
                  access_token:
                    type: string
                  token_type:
                    type: string
                  expires_in:
                    type: integer
                  device_credential:
                    type: string
              examples:
                success:
                  value:
                    access_token: eyJhbGciOi...
                    token_type: Bearer
                    expires_in: 900
                    device_credential: dcred_932...
        '400':
          description: Invalid exchange payload
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid_exchange:
                  value:
                    status: fix_required
                    title: Native exchange validate required
                    detail: Проверьте code, code_verifier и state, затем повторите запрос.
                    action: Проверьте validate code,code_verifier,state
                    validate: code,code_verifier,state
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/native/exchange \
              -H 'Content-Type: application/json' \
              -d '{"code":"oauth_code_abc","code_verifier":"qJ4...k3","state":"state_47f..."}'
  /api/v1/auth/sessions:
    get:
      tags:
        - auth
      summary: List user sessions
      operationId: authSessionList
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Sessions list
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SessionView'
              examples:
                list:
                  value:
                    - session_id: 9d660b52-2e4e-4b0c-8ab0-ce0df8a3e550
                      client_type: web
                      device_label: Chrome on macOS
                      ip_address: 203.0.113.10
                      created_at: '2026-03-02T10:00:00Z'
                      last_seen_at: '2026-03-02T10:15:00Z'
                      is_current: true
                    - session_id: 3d3d35f7-1502-449b-a756-ec2f8d3d7cb0
                      client_type: qt-linux
                      device_label: Qt App on Ubuntu
                      ip_address: 203.0.113.11
                      created_at: '2026-03-01T12:00:00Z'
                      last_seen_at: '2026-03-02T09:55:00Z'
                      is_current: false
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                unauthorized:
                  value:
                    status: fix_required
                    title: Session validate required
                    detail: Выполните вход и повторите запрос.
                    action: Проверьте validate access_token
                    validate: access_token
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/auth/sessions \
              -H 'Authorization: Bearer <access_token>'
  /api/v1/auth/sessions/{session_id}:
    delete:
      tags:
        - auth
      summary: Revoke one session
      operationId: authSessionDelete
      security:
        - bearerAuth: []
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Session revoked
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: revoked
              examples:
                revoked:
                  value:
                    status: revoked
        '404':
          description: Session not found
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                session_missing:
                  value:
                    status: fix_required
                    title: Session validate required
                    detail: Проверьте session_id и повторите запрос.
                    action: Проверьте validate session_id
                    validate: session_id
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X DELETE https://api.example.test/api/v1/auth/sessions/9d660b52-2e4e-4b0c-8ab0-ce0df8a3e550 \
              -H 'Authorization: Bearer <access_token>'
  /api/v1/auth/sessions/revoke-others:
    post:
      tags:
        - auth
      summary: Revoke all sessions except current
      operationId: authSessionsRevokeOthers
      x-runtime-status: preview
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Other sessions revoked
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - revoked_count
                properties:
                  status:
                    type: string
                    example: revoked_others
                  revoked_count:
                    type: integer
                    example: 2
              examples:
                done:
                  value:
                    status: revoked_others
                    revoked_count: 2
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                unauthorized:
                  value:
                    status: fix_required
                    title: Session validate required
                    detail: Выполните вход и повторите запрос.
                    action: Проверьте validate access_token
                    validate: access_token
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/sessions/revoke-others \
              -H 'Authorization: Bearer <access_token>'
  /api/v1/auth/password-reset/request:
    post:
      tags:
        - auth
      summary: Request password reset
      operationId: authPasswordResetRequest
      x-runtime-status: preview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
              properties:
                email:
                  type: string
                  format: email
            examples:
              request:
                value:
                  email: owner@example.test
      responses:
        '200':
          description: Reset flow accepted
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: reset_requested
              examples:
                accepted:
                  value:
                    status: reset_requested
        '422':
          description: Email validation required
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid_email:
                  value:
                    status: fix_required
                    title: Email validate required
                    detail: Исправьте email и повторите запрос.
                    action: Проверьте validate email
                    validate: email
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/password-reset/request \
              -H 'Content-Type: application/json' \
              -d '{"email":"owner@example.test"}'
  /api/v1/auth/password-reset/confirm:
    post:
      tags:
        - auth
      summary: Confirm password reset
      operationId: authPasswordResetConfirm
      x-runtime-status: preview
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - token
                - new_password
              properties:
                token:
                  type: string
                new_password:
                  type: string
                  minLength: 12
            examples:
              confirm:
                value:
                  token: rst_320ab...
                  new_password: example-password-only
      responses:
        '200':
          description: Password changed
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: password_updated
              examples:
                done:
                  value:
                    status: password_updated
        '400':
          description: Reset token validation required
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid_token:
                  value:
                    status: fix_required
                    title: Reset token validate required
                    detail: Проверьте token и повторите запрос.
                    action: Проверьте validate token,new_password
                    validate: token,new_password
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/auth/password-reset/confirm \
              -H 'Content-Type: application/json' \
              -d '{"token":"rst_320ab...","new_password":"example-password-only"}'
  /api/v1/companies:
    get:
      tags:
        - company
      summary: List user companies
      operationId: companyList
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Companies list
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CompanyView'
              examples:
                list:
                  value:
                    - company_id: b98772dd-7cf7-455d-a750-9ef142546b37
                      slug: example-core
                      name: Example Core
                      role: owner
                    - company_id: 4e8b9d61-5f51-49e6-a9f6-7f95f5141525
                      slug: example-labs
                      name: Example Labs
                      role: admin
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                unauthorized:
                  value:
                    status: fix_required
                    title: Session validate required
                    detail: Выполните вход и повторите запрос.
                    action: Проверьте validate access_token
                    validate: access_token
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/companies \
              -H 'Authorization: Bearer <access_token>'
    post:
      tags:
        - company
      summary: Create company
      operationId: companyCreate
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - slug
              properties:
                name:
                  type: string
                slug:
                  type: string
            examples:
              create:
                value:
                  name: Example Logistics
                  slug: example-logistics
      responses:
        '201':
          description: Company created
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyView'
              examples:
                created:
                  value:
                    company_id: d48c9e93-d699-45be-94f0-8040f67f487a
                    slug: example-logistics
                    name: Example Logistics
                    role: owner
        '409':
          description: Slug conflict
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                conflict:
                  value:
                    status: fix_required
                    title: Company slug validate required
                    detail: Исправьте slug и повторите запрос.
                    action: Проверьте validate slug
                    validate: slug
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/companies \
              -H 'Authorization: Bearer <access_token>' \
              -H 'Content-Type: application/json' \
              -d '{"name":"Example Logistics","slug":"example-logistics"}'
  /api/v1/companies/{company_id}/switch:
    post:
      tags:
        - company
      summary: Switch active company
      operationId: companySwitch
      security:
        - bearerAuth: []
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Active company switched
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - current_company_id
                properties:
                  status:
                    type: string
                    example: switched
                  current_company_id:
                    type: string
                    format: uuid
              examples:
                switched:
                  value:
                    status: switched
                    current_company_id: b98772dd-7cf7-455d-a750-9ef142546b37
        '403':
          description: No membership
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                forbidden:
                  value:
                    status: fix_required
                    title: Membership validate required
                    detail: Проверьте membership в выбранной компании.
                    action: Проверьте validate company_id,membership
                    validate: company_id,membership
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -X POST https://api.example.test/api/v1/companies/b98772dd-7cf7-455d-a750-9ef142546b37/switch \
              -H 'Authorization: Bearer <access_token>'
  /api/v1/client-service-types:
    get:
      tags:
        - clients
      summary: List default client service types
      operationId: clientServiceTypeList
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Default and shared client service types
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ClientServiceTypeView'
  /api/v1/clients/{client_id}:
    get:
      tags:
        - clients
      summary: Get client workspace root by client_id
      operationId: clientGet
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_id'
      responses:
        '200':
          description: Client
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientView'
        '404':
          $ref: '#/components/responses/problem'
    patch:
      tags:
        - clients
      summary: Update client
      operationId: clientPatch
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: Updated
        '404':
          $ref: '#/components/responses/problem'
    delete:
      tags:
        - clients
      summary: Archive client
      operationId: clientDelete
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_id'
      responses:
        '204':
          description: Archived
        '404':
          $ref: '#/components/responses/problem'
  /api/v1/clients/{client_id}/services:
    get:
      tags:
        - clients
      summary: List services inside client workspace
      operationId: clientServiceList
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_id'
        - name: project_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Client services
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ClientServiceView'
    post:
      tags:
        - clients
      summary: Create client service
      operationId: clientServiceCreate
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientServiceInput'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                required:
                  - client_service_id
                properties:
                  client_service_id:
                    type: string
                    format: uuid
  /api/v1/client-services/{client_service_id}:
    get:
      tags:
        - clients
      summary: Get client service by client_service_id
      operationId: clientServiceGet
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_service_id'
      responses:
        '200':
          description: Service
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientServiceView'
    patch:
      tags:
        - clients
      summary: Update client service by client_service_id
      operationId: clientServicePatch
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_service_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientServicePatch'
      responses:
        '204':
          description: Updated
        '404':
          $ref: '#/components/responses/problem'
    delete:
      tags:
        - clients
      summary: Archive client service by client_service_id
      operationId: clientServiceDelete
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_service_id'
      responses:
        '204':
          description: Archived
  /api/v1/clients/{client_id}/payment-actions:
    get:
      tags:
        - clients
      summary: List client payments/accruals inside client workspace
      operationId: clientPaymentActionList
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_id'
        - name: project_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Payment actions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PaymentActionView'
  /api/v1/clients/{client_id}/payments/manual:
    post:
      tags:
        - clients
      summary: Record received money manually and emit payment event
      operationId: clientManualPaymentRecord
      description: |
        Command endpoint for the client workspace. It creates or reuses a payment action for the
        service period, records a payment fact, stores an idempotent payment event, and lets the
        workflow payment_due action rebuild the full project snapshot.
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/client_id'
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManualPaymentRecordRequest'
      responses:
        '200':
          description: Duplicate idempotency key; existing event returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManualPaymentRecordResponse'
        '201':
          description: Payment event processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManualPaymentRecordResponse'
        '409':
          $ref: '#/components/responses/problem'
  /api/v1/payment-actions/{payment_action_id}:
    get:
      tags:
        - clients
      summary: Get payment action by payment_action_id
      operationId: paymentActionGet
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/payment_action_id'
      responses:
        '200':
          description: Payment action
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentActionView'
        '404':
          $ref: '#/components/responses/problem'
  /api/v1/payment-actions/{payment_action_id}/confirm:
    post:
      tags:
        - clients
      summary: Confirm received money for an existing payment action
      operationId: paymentActionConfirm
      description: |
        Command endpoint for existing accrual/payment actions. It records the payment fact,
        stores source and payment method, optionally overrides the next service due date,
        and lets connected payment_due workflows rebuild the full project snapshot.
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/payment_action_id'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentActionConfirmRequest'
      responses:
        '204':
          description: Confirmed
        '404':
          $ref: '#/components/responses/problem'
        '409':
          $ref: '#/components/responses/problem'
  /api/v1/payment-actions/{payment_action_id}/snooze:
    post:
      tags:
        - clients
      summary: Snooze payment action reminder
      operationId: paymentActionSnooze
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/payment_action_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentActionSnoozeRequest'
      responses:
        '204':
          description: Snoozed
        '404':
          $ref: '#/components/responses/problem'
  /api/v1/public/site-chat/widgets/{public_key}/config:
    get:
      tags:
        - site_chat
      summary: Public widget config by public_key
      operationId: siteChatPublicConfig
      parameters:
        - $ref: '#/components/parameters/public_key'
      responses:
        '200':
          description: Widget config
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatPublicConfig'
        '404':
          $ref: '#/components/responses/problem'
  /api/v1/public/site-chat/ws:
    get:
      tags:
        - site_chat
      summary: Public visitor Live Assist WebSocket
      operationId: siteChatPublicWebSocket
      parameters:
        - name: public_key
          in: query
          required: true
          schema:
            type: string
        - name: visitor_id
          in: query
          required: true
          schema:
            type: string
            format: uuid
        - name: visit_session_id
          in: query
          required: true
          schema:
            type: string
            format: uuid
        - name: conversation_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
      responses:
        '101':
          description: WebSocket upgraded. Uses SiteChatWSEnvelope frames.
        '400':
          $ref: '#/components/responses/problem'
  /api/v1/public/site-chat/presence:
    post:
      tags:
        - site_chat
      summary: Create/update visitor and visit session
      operationId: siteChatPresence
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatPresenceRequest'
      responses:
        '200':
          description: Presence accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatPresenceResponse'
        '400':
          $ref: '#/components/responses/problem'
  /api/v1/public/site-chat/events:
    post:
      tags:
        - site_chat
      summary: Accept throttled/batched lightweight visitor events
      operationId: siteChatEvents
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatEventBatch'
      responses:
        '202':
          description: Accepted
        '400':
          $ref: '#/components/responses/problem'
  /api/v1/public/site-chat/conversations:
    post:
      tags:
        - site_chat
      summary: Public visitor starts chat conversation
      operationId: siteChatPublicConversationCreate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatMessageInput'
      responses:
        '201':
          description: Conversation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatConversation'
  /api/v1/public/site-chat/messages:
    post:
      tags:
        - site_chat
      summary: Public visitor sends chat message
      operationId: siteChatPublicMessageCreate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatMessageInput'
      responses:
        '201':
          description: Message id
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                  - message_id
                properties:
                  message_id:
                    type: string
                    format: uuid
  /api/v1/public/site-chat/conversations/{conversation_id}/messages:
    get:
      tags:
        - site_chat
      summary: Public visitor reads chat messages
      operationId: siteChatPublicMessageList
      parameters:
        - $ref: '#/components/parameters/conversation_id'
        - name: public_key
          in: query
          required: true
          schema:
            type: string
        - name: visitor_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Messages
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SiteChatMessage'
  /api/v1/public/site-chat/calls/request:
    post:
      tags:
        - site_chat
      summary: Visitor requests a call from Pulse operator
      operationId: siteChatPublicCallRequest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatCallInput'
      responses:
        '201':
          description: Call session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatCallSession'
  /api/v1/public/site-chat/calls/{call_session_id}/accept:
    post:
      tags:
        - site_chat
      summary: Visitor accepts offered call after privacy/recording consent
      operationId: siteChatPublicCallAccept
      parameters:
        - $ref: '#/components/parameters/call_session_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatCallInput'
      responses:
        '200':
          description: Call session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatCallSession'
  /api/v1/public/site-chat/calls/{call_session_id}/reject:
    post:
      tags:
        - site_chat
      summary: Visitor rejects offered call
      operationId: siteChatPublicCallReject
      parameters:
        - $ref: '#/components/parameters/call_session_id'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatCallInput'
      responses:
        '200':
          description: Call session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatCallSession'
  /api/v1/public/site-chat/calls/{call_session_id}/end:
    post:
      tags:
        - site_chat
      summary: Visitor ends active call
      operationId: siteChatPublicCallEnd
      parameters:
        - $ref: '#/components/parameters/call_session_id'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatCallInput'
      responses:
        '200':
          description: Call session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatCallSession'
  /api/v1/projects/{project_id}/site-chat-widgets:
    get:
      tags:
        - site_chat
      summary: List project site chat widgets
      operationId: siteChatWidgetList
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      responses:
        '200':
          description: Widgets
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SiteChatWidget'
    post:
      tags:
        - site_chat
      summary: Create project site chat widget
      operationId: siteChatWidgetCreate
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatWidgetInput'
      responses:
        '201':
          description: Widget id
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                  - chat_widget_id
                properties:
                  chat_widget_id:
                    type: string
                    format: uuid
  /api/v1/site-chat-widgets/{chat_widget_id}:
    patch:
      tags:
        - site_chat
      summary: Update site chat widget
      operationId: siteChatWidgetPatch
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/chat_widget_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatWidgetPatch'
      responses:
        '204':
          description: Updated
        '404':
          $ref: '#/components/responses/problem'
  /api/v1/projects/{project_id}/site-visitors/active:
    get:
      tags:
        - site_chat
      summary: List active visitors with derived visitor_state_snapshot
      operationId: siteChatActiveVisitors
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      responses:
        '200':
          description: Active visitors
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SiteVisitorSession'
  /api/v1/site-visit-sessions/{visit_session_id}/monitoring/start:
    post:
      tags:
        - site_chat
      summary: Start heavier live monitoring for a visit session
      operationId: siteChatMonitoringStart
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/visit_session_id'
      responses:
        '204':
          description: Monitoring started
  /api/v1/site-visit-sessions/{visit_session_id}/monitoring/stop:
    post:
      tags:
        - site_chat
      summary: Stop heavier live monitoring for a visit session
      operationId: siteChatMonitoringStop
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/visit_session_id'
      responses:
        '204':
          description: Monitoring stopped
  /api/v1/site-visit-sessions/{visit_session_id}/invite:
    post:
      tags:
        - site_chat
      summary: Operator invites visitor to chat
      operationId: siteChatVisitorInvite
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/visit_session_id'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatInviteInput'
      responses:
        '200':
          description: Conversation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatConversation'
  /api/v1/site-visit-sessions/{visit_session_id}/call-offer:
    post:
      tags:
        - site_chat
      summary: Operator offers a call to visitor
      operationId: siteChatOperatorCallOffer
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/visit_session_id'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatCallInput'
      responses:
        '201':
          description: Call session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatCallSession'
  /api/v1/site-visit-sessions/{visit_session_id}/events:
    get:
      tags:
        - site_chat
      summary: Operator reads cobrowse frames as REST fallback
      operationId: siteChatVisitEvents
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/visit_session_id'
        - name: since_sequence
          in: query
          required: false
          schema:
            type: integer
            format: int64
            default: 0
      responses:
        '200':
          description: Cobrowse frames
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SiteCobrowseFrame'
  /api/v1/site-visit-sessions/{visit_session_id}/snapshot:
    get:
      tags:
        - site_chat
      summary: Operator reads current visitor_state_snapshot
      operationId: siteChatVisitSnapshot
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/visit_session_id'
      responses:
        '200':
          description: Visitor state snapshot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VisitorStateSnapshot'
  /api/v1/site-chat/ws/operator:
    get:
      tags:
        - site_chat
      summary: Operator Live Assist WebSocket
      operationId: siteChatOperatorWebSocket
      security:
        - bearerAuth: []
      parameters:
        - name: project_id
          in: query
          required: true
          schema:
            type: string
            format: uuid
        - name: visit_session_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
        - name: conversation_id
          in: query
          required: false
          schema:
            type: string
            format: uuid
      responses:
        '101':
          description: WebSocket upgraded. Uses SiteChatWSEnvelope frames.
  /api/v1/site-chat/calls/{call_session_id}/accept:
    post:
      tags:
        - site_chat
      summary: Operator accepts visitor-requested call
      operationId: siteChatOperatorCallAccept
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/call_session_id'
      responses:
        '200':
          description: Call session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatCallSession'
  /api/v1/site-chat/calls/{call_session_id}/reject:
    post:
      tags:
        - site_chat
      summary: Operator rejects call
      operationId: siteChatOperatorCallReject
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/call_session_id'
      responses:
        '200':
          description: Call session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatCallSession'
  /api/v1/site-chat/calls/{call_session_id}/end:
    post:
      tags:
        - site_chat
      summary: Operator ends active call
      operationId: siteChatOperatorCallEnd
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/call_session_id'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatCallInput'
      responses:
        '200':
          description: Call session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiteChatCallSession'
  /api/v1/site-chat-conversations/{conversation_id}/messages:
    get:
      tags:
        - site_chat
      summary: List operator-visible chat messages
      operationId: siteChatMessageList
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/conversation_id'
      responses:
        '200':
          description: Messages
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SiteChatMessage'
    post:
      tags:
        - site_chat
      summary: Operator sends chat message
      operationId: siteChatMessageCreate
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/conversation_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SiteChatMessageInput'
      responses:
        '201':
          description: Message id
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                  - message_id
                properties:
                  message_id:
                    type: string
                    format: uuid
  /api/v1/projects/{project_id}/client-service-types:
    get:
      tags:
        - clients
      summary: List editable project service types
      operationId: projectClientServiceTypeList
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      responses:
        '200':
          description: Project service types
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ClientServiceTypeView'
    post:
      tags:
        - clients
      summary: Create or reuse a project service type
      operationId: projectClientServiceTypeCreate
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientServiceTypeInput'
      responses:
        '201':
          description: Created or existing active type returned
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                required:
                  - client_service_type_id
                properties:
                  client_service_type_id:
                    type: string
                    format: uuid
        '409':
          $ref: '#/components/responses/problem'
  /api/v1/projects/{project_id}/client-service-types/{client_service_type_id}:
    patch:
      tags:
        - clients
      summary: Update a project service type
      operationId: projectClientServiceTypePatch
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/client_service_type_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClientServiceTypePatch'
      responses:
        '204':
          description: Updated
        '404':
          $ref: '#/components/responses/problem'
        '409':
          $ref: '#/components/responses/problem'
    delete:
      tags:
        - clients
      summary: Archive a project service type
      operationId: projectClientServiceTypeArchive
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/client_service_type_id'
      responses:
        '204':
          description: Archived
        '404':
          $ref: '#/components/responses/problem'
  /api/v1/docs/openapi.json:
    get:
      tags:
        - docs
      summary: Download bundled OpenAPI JSON
      operationId: docsOpenapiJson
      description: Returns full bundled OpenAPI document for SDK generation and testing tools.
      responses:
        '200':
          description: OpenAPI JSON
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: object
              examples:
                sample:
                  value:
                    openapi: 3.2.0
                    info:
                      title: Generated Stack API
                      version: 1.1.0
        '404':
          description: Docs asset not found
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                docs_not_found:
                  value:
                    status: fix_required
                    title: Docs path validate required
                    detail: Проверьте путь документации и повторите запрос.
                    action: Проверьте validate docs_path
                    validate: docs_path
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
        '500':
          description: Docs asset unavailable
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                docs_unavailable:
                  value:
                    status: error
                    title: Docs storage unavailable
                    detail: Повторите запрос позже или обратитесь в поддержку.
                    action: Проверьте validate docs_storage
                    validate: docs_storage
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/docs/openapi.json
  /api/v1/docs/openapi.yaml:
    get:
      tags:
        - docs
      summary: Download bundled OpenAPI YAML
      operationId: docsOpenapiYaml
      responses:
        '200':
          description: OpenAPI YAML
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            text/yaml:
              schema:
                type: string
              examples:
                snippet:
                  value: |
                    openapi: 3.2.0
                    info:
                      title: Generated Stack API
                      version: 1.1.0
        '404':
          description: Docs asset not found
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                docs_not_found:
                  value:
                    status: fix_required
                    title: Docs path validate required
                    detail: Проверьте путь документации и повторите запрос.
                    action: Проверьте validate docs_path
                    validate: docs_path
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/docs/openapi.yaml
  /api/v1/docs/endpoints:
    get:
      tags:
        - docs
      summary: Endpoint catalog with examples and testing hints
      operationId: docsEndpointsCatalog
      description: |
        Returns every endpoint with method/path/summary, multiple examples,
        and testing hints (curl + scenario checklist).
      parameters:
        - name: tag
          in: query
          required: false
          schema:
            type: string
            enum:
              - auth
              - company
              - docs
        - name: method
          in: query
          required: false
          schema:
            type: string
            enum:
              - GET
              - POST
              - PUT
              - PATCH
              - DELETE
              - HEAD
              - OPTIONS
      responses:
        '200':
          description: Endpoint catalog
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndpointDocList'
              examples:
                catalog:
                  value:
                    generated_at: '2026-03-02T15:00:00Z'
                    version: 1.1.0
                    endpoints:
                      - method: POST
                        path: /api/v1/auth/login
                        summary: Login with email/password
                        tag: auth
                        operation_id: authLogin
                        curl_examples:
                          - 'curl -X POST https://api.example.test/api/v1/auth/login -H ''Content-Type: application/json'' -d ''{"email":"owner@example.test","password":"example-password-only"}'''
                          - 'curl -X POST https://api.example.test/api/v1/auth/login -H ''Content-Type: application/json'' -d ''{"email":"admin@example.test","password":"example-password-only"}'''
                        test_hints:
                          - happy_path_valid_credentials
                          - error_invalid_password
        '400':
          description: Invalid filter values
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid_filter:
                  value:
                    status: fix_required
                    title: Docs filter validate required
                    detail: Исправьте query-параметры и повторите запрос.
                    action: Проверьте validate tag,method
                    validate: tag,method
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/docs/endpoints?tag=auth
  /api/v1/docs/testing/postman:
    get:
      tags:
        - docs
      summary: Postman testing collection metadata
      operationId: docsTestingPostman
      description: Returns metadata for generated Postman collection and download endpoint.
      responses:
        '200':
          description: Testing collection
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestingCollection'
              examples:
                postman:
                  value:
                    format: postman-v2.1
                    version: 1.1.0
                    download_url: https://api.example.test/api/v1/docs/testing/postman
        '404':
          description: Testing collection artifact not found
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            X-App-Action:
              $ref: '#/components/headers/X-App-Action'
            X-App-Validate:
              $ref: '#/components/headers/X-App-Validate'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                artifact_missing:
                  value:
                    status: fix_required
                    title: Testing collection validate required
                    detail: Повторите генерацию testing collection и повторите запрос.
                    action: Проверьте validate collection_artifact
                    validate: collection_artifact
                    request_id: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
      x-codeSamples:
        - lang: curl
          source: |
            curl -L https://api.example.test/api/v1/docs/testing/postman
  /api/v1/action-types:
    get:
      tags:
        - catalog
      summary: Список типов действий для конструктора workflow
      description: |
        Каталог поддерживаемых типов узлов (действий). Используйте `config_schema_json` / `result_schema_json`
        при редактировании графа черновика и для валидации на стороне UI.
      operationId: actionTypes
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Каталог действий
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ActionTypeCatalogItem'
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
        '500':
          description: Внутренняя ошибка загрузки каталога
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
  /api/v1/action-types/{action_type_key}:
    get:
      tags:
        - catalog
      summary: Детали типа действия
      operationId: actionTypeGet
      security:
        - bearerAuth: []
      parameters:
        - name: action_type_key
          in: path
          required: true
          schema:
            type: string
          example: http.request
      responses:
        '200':
          description: Тип действия
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionTypeCatalogItem'
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: Неизвестный action_key
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
  /api/v1/action-dependency-types:
    get:
      tags:
        - catalog
      summary: Список типов зависимостей проекта
      description: |
        Схемы для настройки SMTP, мессенджеров и других внешних интеграций, на которые ссылаются действия.
      operationId: depTypes
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Каталог типов зависимостей
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DependencyTypeCatalogItem'
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
        '500':
          description: Внутренняя ошибка загрузки каталога
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
  /api/v1/action-dependency-types/{dependency_type_key}:
    get:
      tags:
        - catalog
      summary: Детали типа зависимости
      operationId: depTypeGet
      security:
        - bearerAuth: []
      parameters:
        - name: dependency_type_key
          in: path
          required: true
          schema:
            type: string
          example: smtp.generic
      responses:
        '200':
          description: Тип зависимости
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DependencyTypeCatalogItem'
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: Неизвестный dependency_type_key
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
  /api/v1/ai/runtime/readiness:
    get:
      tags:
        - ai
      summary: Проверить готовность AI runtime и Python gRPC health
      operationId: aiRuntimeReadiness
      responses:
        '200':
          description: AI runtime readiness
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIRuntimeReadiness'
        '503':
          description: AI runtime is not ready when langgraph runtime requires Python gRPC
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIRuntimeReadiness'
  /api/v1/ai/agent/readiness:
    get:
      tags:
        - ai
      summary: Alias for AI runtime readiness
      operationId: aiAgentReadiness
      responses:
        '200':
          description: AI runtime readiness
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIRuntimeReadiness'
        '503':
          description: AI runtime is not ready when langgraph runtime requires Python gRPC
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIRuntimeReadiness'
  /api/v1/ai/runtime/capabilities:
    get:
      tags:
        - ai
      summary: Получить capability state AI runtime
      operationId: aiRuntimeCapabilities
      responses:
        '200':
          description: AI runtime capability state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIRuntimeReadiness'
        '503':
          description: AI runtime is disabled or unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIRuntimeReadiness'
  /api/v1/projects/{project_id}/ai/model-providers:
    get:
      tags:
        - ai
      summary: Список AI-провайдеров моделей для проекта
      operationId: aiModelProviders
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      responses:
        '200':
          description: Model provider catalog
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/AIModelProvider'
        '401':
          $ref: '#/components/responses/Problem'
  /api/v1/projects/{project_id}/ai/employee:
    get:
      tags:
        - ai
      summary: Получить или lazy-create AI-сотрудника проекта
      operationId: aiEmployeeGet
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      responses:
        '200':
          description: Project AI employee envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIEmployeeEnvelope'
        '401':
          $ref: '#/components/responses/Problem'
    patch:
      tags:
        - ai
      summary: Обновить настройки AI-сотрудника проекта
      operationId: aiEmployeePatch
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                display_name:
                  type: string
                status:
                  type: string
                  enum:
                    - active
                    - disabled
                    - archived
                action_dependency_id:
                  type: string
                  format: uuid
                model_id:
                  type: string
                profile_json:
                  type: object
                tool_policy_json:
                  type: object
                memory_policy_json:
                  type: object
                ui_settings_json:
                  type: object
      responses:
        '200':
          description: Updated employee envelope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIEmployeeEnvelope'
        '401':
          $ref: '#/components/responses/Problem'
  /api/v1/projects/{project_id}/ai/employee/capability:
    get:
      tags:
        - ai
      summary: Получить capability state AI-сотрудника проекта
      operationId: aiEmployeeCapability
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      responses:
        '200':
          description: AI employee capability envelope
          content:
            application/json:
              schema:
                type: object
                properties:
                  capability:
                    $ref: '#/components/schemas/AICapability'
        '401':
          $ref: '#/components/responses/Problem'
  /api/v1/projects/{project_id}/ai/employee/sessions:
    post:
      tags:
        - ai
      summary: Создать chat session AI-сотрудника
      operationId: aiEmployeeSessionCreate
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AISessionCreate'
      responses:
        '201':
          description: Created session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIChatSession'
  /api/v1/projects/{project_id}/ai/employee/sessions/{session_id}:
    get:
      tags:
        - ai
      summary: Получить AI chat session
      operationId: aiEmployeeSessionGet
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/session_id'
      responses:
        '200':
          description: Session with messages
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIChatSession'
  /api/v1/projects/{project_id}/ai/employee/sessions/{session_id}/messages:
    post:
      tags:
        - ai
      summary: Отправить сообщение AI-сотруднику
      operationId: aiEmployeeMessagePost
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/session_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - body
              properties:
                body:
                  type: string
                page_context_json:
                  $ref: '#/components/schemas/AIPageContext'
                client_context_json:
                  type: object
                  additionalProperties: true
                ui_state_json:
                  type: object
                  additionalProperties: true
                active_tool_call_id:
                  type: string
                  format: uuid
                active_patch_proposal_id:
                  type: string
                  format: uuid
                reply_to_message_id:
                  type: string
                  format: uuid
                client_command:
                  type: string
                local_date:
                  type: string
                timezone:
                  type: string
      responses:
        '200':
          description: Updated session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIChatSession'
  /api/v1/projects/{project_id}/ai/employee/sessions/{session_id}/cancel:
    post:
      tags:
        - ai
      summary: Отменить AI chat session
      operationId: aiEmployeeSessionCancel
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/session_id'
      responses:
        '200':
          description: Canceled session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIChatSession'
  /api/v1/projects/{project_id}/ai/tool-calls/{tool_call_id}/approve:
    post:
      tags:
        - ai
      summary: Подтвердить и выполнить AI tool call
      operationId: aiToolCallApprove
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/tool_call_id'
      responses:
        '200':
          description: Updated AI session after tool execution
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIChatSession'
  /api/v1/projects/{project_id}/ai/tool-calls/{tool_call_id}/reject:
    post:
      tags:
        - ai
      summary: Отклонить AI tool call без side effect
      operationId: aiToolCallReject
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/tool_call_id'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                reason:
                  type: string
      responses:
        '200':
          description: Updated AI session after rejection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIChatSession'
  /api/v1/projects/{project_id}/action-dependencies/{action_dependency_id}/models:
    get:
      tags:
        - ai
      summary: Список моделей для project integration
      operationId: aiModelsByDependency
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/action_dependency_id'
      responses:
        '200':
          description: Models
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIModelList'
  /api/v1/projects/{project_id}/action-dependencies/{action_dependency_id}/models/refresh:
    post:
      tags:
        - ai
      summary: Обновить model cache для integration
      operationId: aiModelsRefresh
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/action_dependency_id'
      responses:
        '200':
          description: Refreshed models
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIModelList'
  /api/v1/projects/{project_id}/action-dependencies/{action_dependency_id}/models/evaluate:
    post:
      tags:
        - ai
      summary: Оценить модели провайдера и выбрать дефолты для AI-сотрудника
      operationId: aiModelsEvaluate
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/project_id'
        - $ref: '#/components/parameters/action_dependency_id'
      responses:
        '200':
          description: Model evaluation result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIModelEvaluationResult'
  /api/v1/runs/{workflow_run_id}/actions:
    get:
      tags:
        - runs
      summary: Исполнения действий (узлов) в запуске workflow
      description: |
        Список записей `action_runs` для данного `workflow_run_id` — фактическое выполнение шагов графа с входом, выходом и статусом.
      operationId: runActions
      security:
        - bearerAuth: []
      parameters:
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Список исполнений узлов
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ActionRunView'
        '401':
          description: Unauthorized
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
        '403':
          description: Нет доступа к запуску
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-App-Result:
              $ref: '#/components/headers/X-App-Result'
            Content-Language:
              $ref: '#/components/headers/Content-Language'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Problem'
  /hooks/{hook_key}/{endpoint_key}/runs/{workflow_run_id}/receipt:
    get:
      tags:
        - ingest
      operationId: ingestWebhookRunReceiptGet
      summary: Получить безопасную квитанцию выполнения webhook-сценария
      description: Возвращает только состояние workflow и статусы его действий. Входной payload, адресаты, тексты сообщений и ответы провайдеров не выдаются. Run обязан принадлежать указанному endpoint. Endpoint с auth_type=none не может использовать этот метод.
      parameters:
        - name: hook_key
          in: path
          required: true
          schema:
            type: string
        - name: endpoint_key
          in: path
          required: true
          schema:
            type: string
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: X-Project-Secret
          in: header
          required: true
          schema:
            type: string
            format: password
        - name: X-Riders-Timestamp
          in: header
          required: true
          schema:
            type: string
            format: date-time
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            maxLength: 200
      responses:
        '200':
          description: Текущая либо терминальная квитанция
          headers:
            Cache-Control:
              schema:
                type: string
                enum:
                  - no-store
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookRunReceipt'
        '400':
          description: Некорректный workflow_run_id
        '401':
          description: Ошибка авторизации или freshness-проверки
        '404':
          description: Endpoint или принадлежащий ему run не найден
  /api/v1/auth/api-keys:
    get:
      tags:
        - auth
      operationId: authAPIKeyList
      summary: Runtime inventory operation authAPIKeyList
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - auth
      operationId: authAPIKeyCreate
      summary: Runtime inventory operation authAPIKeyCreate
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/auth/api-keys/{api_key_id}:
    delete:
      tags:
        - auth
      operationId: authAPIKeyDelete
      summary: Runtime inventory operation authAPIKeyDelete
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: api_key_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/auth/profile:
    patch:
      tags:
        - auth
      operationId: authProfilePatch
      summary: Runtime inventory operation authProfilePatch
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/clients/{client_id}/contacts:
    get:
      tags:
        - clients
      operationId: clientContactList
      summary: Runtime inventory operation clientContactList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - clients
      operationId: clientContactCreate
      summary: Runtime inventory operation clientContactCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/clients/{client_id}/contacts/{client_contact_id}:
    delete:
      tags:
        - clients
      operationId: clientContactDelete
      summary: Runtime inventory operation clientContactDelete
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
        - name: client_contact_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - clients
      operationId: clientContactPatch
      summary: Runtime inventory operation clientContactPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
        - name: client_contact_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/clients/{client_id}/projects:
    get:
      tags:
        - clients
      operationId: clientProjectList
      summary: Runtime inventory operation clientProjectList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/clients/{client_id}/projects/{project_id}:
    delete:
      tags:
        - clients
      operationId: clientProjectUnlink
      summary: Runtime inventory operation clientProjectUnlink
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - clients
      operationId: clientProjectLink
      summary: Runtime inventory operation clientProjectLink
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/clients/{client_id}/responsibles:
    get:
      tags:
        - clients
      operationId: clientResponsibleList
      summary: Runtime inventory operation clientResponsibleList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - clients
      operationId: clientResponsibleCreate
      summary: Runtime inventory operation clientResponsibleCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/clients/{client_id}/responsibles/{client_responsible_id}:
    delete:
      tags:
        - clients
      operationId: clientResponsibleDelete
      summary: Runtime inventory operation clientResponsibleDelete
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
        - name: client_responsible_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - clients
      operationId: clientResponsiblePatch
      summary: Runtime inventory operation clientResponsiblePatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: client_id
          in: path
          required: true
          schema:
            type: string
        - name: client_responsible_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/companies/{company_id}:
    get:
      tags:
        - company
      operationId: companyGet
      summary: Runtime inventory operation companyGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - company
      operationId: companyPatch
      summary: Runtime inventory operation companyPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/companies/{company_id}/clients:
    get:
      tags:
        - clients
      operationId: clientList
      summary: Runtime inventory operation clientList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - clients
      operationId: clientCreate
      summary: Runtime inventory operation clientCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/companies/{company_id}/clients/dadata/find-party:
    post:
      tags:
        - clients
      operationId: clientDadataFindParty
      summary: Runtime inventory operation clientDadataFindParty
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/companies/{company_id}/integrations/dadata:
    get:
      tags:
        - clients
      operationId: companyDadataIntegrationGet
      summary: Runtime inventory operation companyDadataIntegrationGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    put:
      tags:
        - clients
      operationId: companyDadataIntegrationSave
      summary: Runtime inventory operation companyDadataIntegrationSave
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/companies/{company_id}/legal-entities:
    get:
      tags:
        - company
      operationId: companyLegalEntityList
      summary: Runtime inventory operation companyLegalEntityList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - company
      operationId: companyLegalEntityCreate
      summary: Runtime inventory operation companyLegalEntityCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/companies/{company_id}/projects:
    get:
      tags:
        - project
      operationId: projectList
      summary: Runtime inventory operation projectList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - project
      operationId: projectCreate
      summary: Runtime inventory operation projectCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/company-legal-entities/{company_legal_entity_id}:
    delete:
      tags:
        - company
      operationId: companyLegalEntityDelete
      summary: Runtime inventory operation companyLegalEntityDelete
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_legal_entity_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    get:
      tags:
        - company
      operationId: companyLegalEntityGet
      summary: Runtime inventory operation companyLegalEntityGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_legal_entity_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - company
      operationId: companyLegalEntityPatch
      summary: Runtime inventory operation companyLegalEntityPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: company_legal_entity_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/desktop/auth/poll:
    post:
      tags:
        - desktop
      operationId: desktopAuthPoll
      summary: Runtime inventory operation desktopAuthPoll
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/desktop/auth/start:
    post:
      tags:
        - desktop
      operationId: desktopAuthStart
      summary: Runtime inventory operation desktopAuthStart
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/desktop/messages:
    get:
      tags:
        - desktop
      operationId: desktopMessages
      summary: Runtime inventory operation desktopMessages
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/desktop/messages/stream:
    get:
      tags:
        - desktop
      operationId: desktopMessagesStream
      summary: Runtime inventory operation desktopMessagesStream
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/desktop/messages/{desktop_message_id}/ack:
    post:
      tags:
        - desktop
      operationId: desktopMessageAck
      summary: Runtime inventory operation desktopMessageAck
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: desktop_message_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/docs/ai-tools.json:
    get:
      tags:
        - docs
      operationId: docsAIToolsJson
      summary: Runtime inventory operation docsAIToolsJson
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/docs/integrations/search:
    get:
      tags:
        - docs
      operationId: docsIntegrationSearch
      summary: Runtime inventory operation docsIntegrationSearch
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/docs/integrations/{public_slug}.md:
    get:
      tags:
        - docs
      operationId: docsIntegrationMarkdown
      summary: Runtime inventory operation docsIntegrationMarkdown
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: public_slug
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/payment-action-documents/{payment_action_document_id}:
    get:
      tags:
        - clients
      operationId: paymentActionDocumentGet
      summary: Runtime inventory operation paymentActionDocumentGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: payment_action_document_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/payment-actions/{payment_action_id}/documents:
    get:
      tags:
        - clients
      operationId: paymentActionDocumentList
      summary: Runtime inventory operation paymentActionDocumentList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: payment_action_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - clients
      operationId: paymentActionDocumentCreate
      summary: Runtime inventory operation paymentActionDocumentCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: payment_action_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}:
    get:
      tags:
        - project
      operationId: projectGet
      summary: Runtime inventory operation projectGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - project
      operationId: projectPatch
      summary: Runtime inventory operation projectPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/action-dependencies:
    get:
      tags:
        - deps
      operationId: actionDepList
      summary: Runtime inventory operation actionDepList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - deps
      operationId: actionDepCreate
      summary: Runtime inventory operation actionDepCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/action-dependencies/{action_dependency_id}:
    delete:
      tags:
        - deps
      operationId: actionDepDelete
      summary: Runtime inventory operation actionDepDelete
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: action_dependency_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    get:
      tags:
        - deps
      operationId: actionDepGet
      summary: Runtime inventory operation actionDepGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: action_dependency_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - deps
      operationId: actionDepPatch
      summary: Runtime inventory operation actionDepPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: action_dependency_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/action-dependencies/{action_dependency_id}/rotate-secret:
    post:
      tags:
        - deps
      operationId: actionDepRotateSecret
      summary: Runtime inventory operation actionDepRotateSecret
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: action_dependency_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/action-dependencies/{action_dependency_id}/telegram-relay-polling:
    post:
      tags:
        - deps
      operationId: actionDepTelegramRelayPolling
      summary: Runtime inventory operation actionDepTelegramRelayPolling
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: action_dependency_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/action-dependencies/{action_dependency_id}/telegram-relay-webhook-secret/rotate:
    post:
      tags:
        - deps
      operationId: actionDepTelegramRelaySecretRotate
      summary: Runtime inventory operation actionDepTelegramRelaySecretRotate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: action_dependency_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/action-dependencies/{action_dependency_id}/test:
    post:
      tags:
        - deps
      operationId: actionDepTest
      summary: Runtime inventory operation actionDepTest
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: action_dependency_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/ai/employee/sessions/{session_id}/messages/stream:
    post:
      tags:
        - ai
      operationId: aiEmployeeMessageStream
      summary: Runtime inventory operation aiEmployeeMessageStream
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: session_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/ai/tool-calls/{tool_call_id}:
    patch:
      tags:
        - ai
      operationId: aiToolCallPatch
      summary: Runtime inventory operation aiToolCallPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: tool_call_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/email-templates:
    get:
      tags:
        - templates
      operationId: emailTplList
      summary: Runtime inventory operation emailTplList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - templates
      operationId: emailTplCreate
      summary: Runtime inventory operation emailTplCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/email-templates/{email_template_id}:
    delete:
      tags:
        - templates
      operationId: emailTplDelete
      summary: Runtime inventory operation emailTplDelete
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: email_template_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    get:
      tags:
        - templates
      operationId: emailTplGet
      summary: Runtime inventory operation emailTplGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: email_template_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - templates
      operationId: emailTplPatch
      summary: Runtime inventory operation emailTplPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: email_template_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/hook-secret/rotate:
    post:
      tags:
        - project
      operationId: projectHookSecretRotate
      summary: Runtime inventory operation projectHookSecretRotate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/integration-docs/search:
    get:
      tags:
        - docs
      operationId: projectIntegrationDocsSearch
      summary: Runtime inventory operation projectIntegrationDocsSearch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/integrations/dadata:
    get:
      tags:
        - clients
      operationId: projectDadataIntegrationGet
      summary: Runtime inventory operation projectDadataIntegrationGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    put:
      tags:
        - clients
      operationId: projectDadataIntegrationSave
      summary: Runtime inventory operation projectDadataIntegrationSave
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/message-templates:
    get:
      tags:
        - templates
      operationId: messageTplList
      summary: Runtime inventory operation messageTplList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - templates
      operationId: messageTplCreate
      summary: Runtime inventory operation messageTplCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/message-templates/{message_template_id}:
    delete:
      tags:
        - templates
      operationId: messageTplDelete
      summary: Runtime inventory operation messageTplDelete
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: message_template_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    get:
      tags:
        - templates
      operationId: messageTplGet
      summary: Runtime inventory operation messageTplGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: message_template_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - templates
      operationId: messageTplPatch
      summary: Runtime inventory operation messageTplPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: message_template_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/payment-actions:
    get:
      tags:
        - clients
      operationId: projectPaymentActionList
      summary: Runtime inventory operation projectPaymentActionList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/payment-actions/manual:
    post:
      tags:
        - clients
      operationId: projectPaymentActionManualCreate
      summary: Runtime inventory operation projectPaymentActionManualCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/payment-schedule:
    get:
      tags:
        - clients
      operationId: projectPaymentSchedule
      summary: Runtime inventory operation projectPaymentSchedule
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/projects/{project_id}/workflows:
    get:
      tags:
        - workflow
      operationId: workflowList
      summary: Runtime inventory operation workflowList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - workflow
      operationId: workflowCreate
      summary: Runtime inventory operation workflowCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/providers/catalog:
    get:
      tags:
        - catalog
      operationId: providerCatalog
      summary: Runtime inventory operation providerCatalog
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/public/site-chat/conversations/{conversation_id}/attachments:
    post:
      tags:
        - site_chat
      operationId: siteChatPublicAttachmentCreate
      summary: Runtime inventory operation siteChatPublicAttachmentCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/public/site-chat/voice-config:
    get:
      tags:
        - site_chat
      operationId: siteChatPublicVoiceConfig
      summary: Runtime inventory operation siteChatPublicVoiceConfig
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/runs/{workflow_run_id}:
    get:
      tags:
        - runs
      operationId: runGet
      summary: Runtime inventory operation runGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/runs/{workflow_run_id}/cancel:
    post:
      tags:
        - runs
      operationId: runCancel
      summary: Runtime inventory operation runCancel
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/runs/{workflow_run_id}/events:
    get:
      tags:
        - runs
      operationId: runEvents
      summary: Runtime inventory operation runEvents
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/runs/{workflow_run_id}/events/stream:
    get:
      tags:
        - runs
      operationId: runEventsStream
      summary: Runtime inventory operation runEventsStream
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/runs/{workflow_run_id}/graph:
    get:
      tags:
        - runs
      operationId: runGraph
      summary: Runtime inventory operation runGraph
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/runs/{workflow_run_id}/replay:
    post:
      tags:
        - runs
      operationId: runReplay
      summary: Runtime inventory operation runReplay
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/runs/{workflow_run_id}/retry-action:
    post:
      tags:
        - runs
      operationId: runRetryAction
      summary: Runtime inventory operation runRetryAction
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_run_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/site-chat-conversations/{conversation_id}/attachments:
    post:
      tags:
        - site_chat
      operationId: siteChatAttachmentCreate
      summary: Runtime inventory operation siteChatAttachmentCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/site-chat/attachments/{attachment_id}/{download_token}:
    get:
      tags:
        - site_chat
      operationId: siteChatAttachmentDownload
      summary: Runtime inventory operation siteChatAttachmentDownload
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: attachment_id
          in: path
          required: true
          schema:
            type: string
        - name: download_token
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/site-chat/calls/{call_session_id}/recordings:
    get:
      tags:
        - site_chat
      operationId: siteChatCallRecordings
      summary: Runtime inventory operation siteChatCallRecordings
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: call_session_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/site-chat/voice-config:
    get:
      tags:
        - site_chat
      operationId: siteChatVoiceConfig
      summary: Runtime inventory operation siteChatVoiceConfig
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/telegram/bot-api/{relay_key}/{method}:
    post:
      tags:
        - telegram
      operationId: telegramBotAPIProxy
      summary: Runtime inventory operation telegramBotAPIProxy
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: relay_key
          in: path
          required: true
          schema:
            type: string
        - name: method
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/telegram/relay/{relay_key}:
    post:
      tags:
        - telegram
      operationId: telegramRelayAPI
      summary: Runtime inventory operation telegramRelayAPI
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: relay_key
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/webhook-endpoints/{webhook_endpoint_id}:
    get:
      tags:
        - webhooks
      operationId: webhookEpGet
      summary: Runtime inventory operation webhookEpGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: webhook_endpoint_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - webhooks
      operationId: webhookEpPatch
      summary: Runtime inventory operation webhookEpPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: webhook_endpoint_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/webhook-endpoints/{webhook_endpoint_id}/events:
    get:
      tags:
        - webhooks
      operationId: webhookEpEvents
      summary: Runtime inventory operation webhookEpEvents
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: webhook_endpoint_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/webhook-endpoints/{webhook_endpoint_id}/rotate-secret:
    post:
      tags:
        - webhooks
      operationId: webhookEpRotateSecret
      summary: Runtime inventory operation webhookEpRotateSecret
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: webhook_endpoint_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/webhook-endpoints/{webhook_endpoint_id}/snippets:
    get:
      tags:
        - webhooks
      operationId: webhookSnippets
      summary: Runtime inventory operation webhookSnippets
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: webhook_endpoint_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/webhook-events/{webhook_event_id}:
    get:
      tags:
        - webhooks
      operationId: webhookEventGet
      summary: Runtime inventory operation webhookEventGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: webhook_event_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/webhook-events/{webhook_event_id}/replay:
    post:
      tags:
        - webhooks
      operationId: webhookEventReplay
      summary: Runtime inventory operation webhookEventReplay
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: webhook_event_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/access:
    get:
      tags:
        - worktracker
      operationId: workAccess
      summary: Runtime inventory operation workAccess
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/boards:
    get:
      tags:
        - worktracker
      operationId: workBoardList
      summary: Runtime inventory operation workBoardList
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - worktracker
      operationId: workBoardCreate
      summary: Runtime inventory operation workBoardCreate
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/boards/{task_board_id}:
    get:
      tags:
        - worktracker
      operationId: workBoardGet
      summary: Runtime inventory operation workBoardGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_board_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/employees:
    get:
      tags:
        - worktracker
      operationId: workEmployeeList
      summary: Runtime inventory operation workEmployeeList
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/overview:
    get:
      tags:
        - worktracker
      operationId: workOverview
      summary: Runtime inventory operation workOverview
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/presets:
    get:
      tags:
        - worktracker
      operationId: workPresets
      summary: Runtime inventory operation workPresets
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/projects/{project_id}/members:
    post:
      tags:
        - worktracker
      operationId: workProjectMemberCreate
      summary: Runtime inventory operation workProjectMemberCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/reports:
    get:
      tags:
        - worktracker
      operationId: workReports
      summary: Runtime inventory operation workReports
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/task-attachments/{task_attachment_id}:
    get:
      tags:
        - worktracker
      operationId: workTaskAttachmentGet
      summary: Runtime inventory operation workTaskAttachmentGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_attachment_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/task-workflows:
    get:
      tags:
        - worktracker
      operationId: workTaskWorkflowList
      summary: Runtime inventory operation workTaskWorkflowList
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - worktracker
      operationId: workTaskWorkflowCreate
      summary: Runtime inventory operation workTaskWorkflowCreate
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/task-workflows/{task_workflow_id}/roles:
    get:
      tags:
        - worktracker
      operationId: workTaskWorkflowRoleList
      summary: Runtime inventory operation workTaskWorkflowRoleList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - worktracker
      operationId: workTaskWorkflowRoleCreate
      summary: Runtime inventory operation workTaskWorkflowRoleCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/task-workflows/{task_workflow_id}/roles/reset:
    post:
      tags:
        - worktracker
      operationId: workTaskWorkflowRoleReset
      summary: Runtime inventory operation workTaskWorkflowRoleReset
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/task-workflows/{task_workflow_id}/roles/{task_process_role_id}:
    patch:
      tags:
        - worktracker
      operationId: workTaskWorkflowRolePatch
      summary: Runtime inventory operation workTaskWorkflowRolePatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_workflow_id
          in: path
          required: true
          schema:
            type: string
        - name: task_process_role_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks:
    get:
      tags:
        - worktracker
      operationId: workTaskList
      summary: Runtime inventory operation workTaskList
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - worktracker
      operationId: workTaskCreate
      summary: Runtime inventory operation workTaskCreate
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks/{task_id}:
    get:
      tags:
        - worktracker
      operationId: workTaskGet
      summary: Runtime inventory operation workTaskGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    patch:
      tags:
        - worktracker
      operationId: workTaskPatch
      summary: Runtime inventory operation workTaskPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks/{task_id}/attachments:
    get:
      tags:
        - worktracker
      operationId: workTaskAttachmentList
      summary: Runtime inventory operation workTaskAttachmentList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - worktracker
      operationId: workTaskAttachmentCreate
      summary: Runtime inventory operation workTaskAttachmentCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks/{task_id}/checklist:
    post:
      tags:
        - worktracker
      operationId: workTaskChecklistCreate
      summary: Runtime inventory operation workTaskChecklistCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks/{task_id}/checklist/{task_checklist_item_id}:
    patch:
      tags:
        - worktracker
      operationId: workTaskChecklistPatch
      summary: Runtime inventory operation workTaskChecklistPatch
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
        - name: task_checklist_item_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks/{task_id}/comments:
    post:
      tags:
        - worktracker
      operationId: workTaskCommentCreate
      summary: Runtime inventory operation workTaskCommentCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks/{task_id}/custom-fields/{task_custom_field_id}:
    put:
      tags:
        - worktracker
      operationId: workTaskCustomFieldPut
      summary: Runtime inventory operation workTaskCustomFieldPut
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
        - name: task_custom_field_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks/{task_id}/move:
    post:
      tags:
        - worktracker
      operationId: workTaskMove
      summary: Runtime inventory operation workTaskMove
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/tasks/{task_id}/timer/start:
    post:
      tags:
        - worktracker
      operationId: workTaskTimerStart
      summary: Runtime inventory operation workTaskTimerStart
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/time:
    get:
      tags:
        - worktracker
      operationId: workTimeList
      summary: Runtime inventory operation workTimeList
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - worktracker
      operationId: workTimeCreate
      summary: Runtime inventory operation workTimeCreate
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/timer/active:
    get:
      tags:
        - worktracker
      operationId: workTimerActive
      summary: Runtime inventory operation workTimerActive
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/work/timer/stop:
    post:
      tags:
        - worktracker
      operationId: workTimerStop
      summary: Runtime inventory operation workTimerStop
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflow-versions/{workflow_version_id}:
    get:
      tags:
        - workflow
      operationId: workflowVersionGet
      summary: Runtime inventory operation workflowVersionGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_version_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}:
    get:
      tags:
        - workflow
      operationId: workflowGet
      summary: Runtime inventory operation workflowGet
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/draft:
    put:
      tags:
        - workflow
      operationId: workflowPutDraft
      summary: Runtime inventory operation workflowPutDraft
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/publish:
    post:
      tags:
        - workflow
      operationId: workflowPublish
      summary: Runtime inventory operation workflowPublish
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/runs:
    get:
      tags:
        - runs
      operationId: runList
      summary: Runtime inventory operation runList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/runs/manual:
    post:
      tags:
        - runs
      operationId: runManual
      summary: Runtime inventory operation runManual
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/test-runs:
    post:
      tags:
        - workflow
      operationId: workflowTestRunCreate
      summary: Runtime inventory operation workflowTestRunCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/validate:
    post:
      tags:
        - workflow
      operationId: workflowValidate
      summary: Runtime inventory operation workflowValidate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/versions:
    get:
      tags:
        - workflow
      operationId: workflowVersions
      summary: Runtime inventory operation workflowVersions
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/versions/{workflow_version_id}/restore:
    post:
      tags:
        - workflow
      operationId: workflowVersionRestore
      summary: Runtime inventory operation workflowVersionRestore
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
        - name: workflow_version_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /api/v1/workflows/{workflow_id}/webhook-endpoints:
    get:
      tags:
        - webhooks
      operationId: webhookEpList
      summary: Runtime inventory operation webhookEpList
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
    post:
      tags:
        - webhooks
      operationId: webhookEpCreate
      summary: Runtime inventory operation webhookEpCreate
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /healthz:
    get:
      tags:
        - health
      operationId: healthz
      summary: Runtime inventory operation healthz
      x-runtime-source: endpoints.inventory.tsv
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /hooks/{hook_key}/{endpoint_key}:
    post:
      tags:
        - ingest
      operationId: ingestWebhookPost
      summary: Runtime inventory operation ingestWebhookPost
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: hook_key
          in: path
          required: true
          schema:
            type: string
        - name: endpoint_key
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
  /telegram/relay/{relay_key}:
    post:
      tags:
        - telegram
      operationId: telegramRelayPublic
      summary: Runtime inventory operation telegramRelayPublic
      x-runtime-source: endpoints.inventory.tsv
      parameters:
        - name: relay_key
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Runtime response
        '400':
          description: Problem response
components:
  schemas:
    Problem:
      type: object
      additionalProperties: false
      required:
        - status
        - title
        - detail
        - action
        - validate
        - request_id
      properties:
        status:
          type: string
          enum:
            - fix_required
            - error
          example: fix_required
        title:
          type: string
          example: Validation required
        detail:
          type: string
          example: Исправьте email и повторите запрос.
        action:
          type: string
          example: Проверьте validate email
        validate:
          type: string
          example: email
        request_id:
          type: string
          example: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
    SessionView:
      type: object
      additionalProperties: false
      required:
        - session_id
        - client_type
        - device_label
        - created_at
        - last_seen_at
        - is_current
      properties:
        session_id:
          type: string
          format: uuid
          example: 9d660b52-2e4e-4b0c-8ab0-ce0df8a3e550
        client_type:
          type: string
          example: web
        device_label:
          type: string
          example: Chrome on macOS
        ip_address:
          type: string
          example: 203.0.113.10
        created_at:
          type: string
          format: date-time
        last_seen_at:
          type: string
          format: date-time
        is_current:
          type: boolean
          example: true
    UserMe:
      type: object
      additionalProperties: false
      required:
        - user_id
        - email
        - current_company_id
      properties:
        user_id:
          type: string
          format: uuid
          example: e2f0d908-03d7-4ba0-9c76-f0d1553f7428
        email:
          type: string
          format: email
          example: owner@example.test
        current_company_id:
          type:
            - string
            - 'null'
          format: uuid
    WorkspaceContext:
      type: object
      additionalProperties: false
      required:
        - user_id
        - active_company_id
        - active_project_id
      properties:
        user_id:
          type: string
          format: uuid
        active_company_id:
          type: string
          format: uuid
          description: Empty string when no company is selected.
        active_project_id:
          type: string
          format: uuid
          description: Empty string when no project is selected.
    WorkspaceContextPatch:
      type: object
      additionalProperties: false
      properties:
        active_company_id:
          type:
            - string
            - 'null'
          format: uuid
        active_project_id:
          type:
            - string
            - 'null'
          format: uuid
    CompanyView:
      type: object
      additionalProperties: false
      required:
        - company_id
        - slug
        - name
        - role
      properties:
        company_id:
          type: string
          format: uuid
          example: b98772dd-7cf7-455d-a750-9ef142546b37
        slug:
          type: string
          example: example-core
        name:
          type: string
          example: Example Core
        role:
          type: string
          example: owner
    ClientView:
      type: object
      additionalProperties: false
      required:
        - client_id
        - company_id
        - client_type
        - status
        - name
      properties:
        client_id:
          type: string
          format: uuid
        company_id:
          type: string
          format: uuid
        client_type:
          type: string
          enum:
            - individual
            - individual_entrepreneur
            - legal_entity
        status:
          type: string
          enum:
            - active
            - archived
            - deleted
        name:
          type: string
        short_name:
          type: string
        full_name:
          type: string
        inn:
          type: string
        kpp:
          type: string
        ogrn:
          type: string
        ogrnip:
          type: string
        legal_address:
          type: string
        actual_address:
          type: string
        okved:
          type: string
        comment:
          type: string
        projects_count:
          type: integer
        services_count:
          type: integer
    ClientServiceView:
      type: object
      additionalProperties: false
      required:
        - client_service_id
        - company_id
        - client_id
        - project_id
        - client_service_type_id
        - service_type_key
        - service_type_name
        - name
        - status
        - amount
        - currency
        - billing_period
      properties:
        client_service_id:
          type: string
          format: uuid
        company_id:
          type: string
          format: uuid
        client_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        client_service_type_id:
          type: string
          format: uuid
        service_type_key:
          type: string
        service_type_name:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
            - active
            - paused
            - completed
            - archived
            - deleted
        amount:
          type: number
          format: double
        raw_price_text:
          type: string
        currency:
          type: string
          example: RUB
        billing_period:
          type: string
          enum:
            - once
            - weekly
            - monthly
            - quarterly
            - semiannual
            - yearly
        next_due_date:
          type: string
          format: date
        remind_days_before:
          type: integer
          deprecated: true
          description: Backward compatibility only. Reminder settings belong to workflow action config.
        remind_every_days:
          type: integer
          deprecated: true
          description: Backward compatibility only. Reminder settings belong to workflow action config.
    ClientServiceInput:
      type: object
      additionalProperties: false
      required:
        - project_id
        - name
      properties:
        project_id:
          type: string
          format: uuid
        client_service_type_id:
          type: string
          format: uuid
        service_type_key:
          type: string
        name:
          type: string
        status:
          type: string
        amount:
          type: number
          format: double
        raw_price_text:
          type: string
        currency:
          type: string
          default: RUB
        billing_period:
          type: string
          default: monthly
        next_due_date:
          type: string
          format: date
        metadata_json:
          type: object
    ClientServicePatch:
      type: object
      additionalProperties: false
      properties:
        project_id:
          type: string
          format: uuid
        client_service_type_id:
          type: string
          format: uuid
        service_type_key:
          type: string
        name:
          type: string
        status:
          type: string
        amount:
          type: number
          format: double
        raw_price_text:
          type: string
        currency:
          type: string
        billing_period:
          type: string
        next_due_date:
          type: string
          format: date
        metadata_json:
          type: object
    ClientServiceTypeView:
      type: object
      additionalProperties: false
      required:
        - client_service_type_id
        - service_type_key
        - display_name
        - sort_order
      properties:
        client_service_type_id:
          type: string
          format: uuid
        company_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        scope_kind:
          type: string
          enum:
            - global
            - company
            - project
        service_type_key:
          type: string
        display_name:
          type: string
        description:
          type: string
        status:
          type: string
          enum:
            - active
            - archived
            - deleted
        sort_order:
          type: integer
    ClientServiceTypeInput:
      type: object
      additionalProperties: false
      required:
        - display_name
      properties:
        service_type_key:
          type: string
        display_name:
          type: string
        description:
          type: string
        sort_order:
          type: integer
        status:
          type: string
          enum:
            - active
            - archived
            - deleted
    ClientServiceTypePatch:
      type: object
      additionalProperties: false
      properties:
        service_type_key:
          type: string
        display_name:
          type: string
        description:
          type: string
        sort_order:
          type: integer
        status:
          type: string
          enum:
            - active
            - archived
            - deleted
    PaymentActionView:
      type: object
      additionalProperties: false
      required:
        - payment_action_id
        - company_id
        - client_id
        - client_name
        - project_id
        - project_name
        - status
        - source
        - payment_method
        - period_start
        - period_end
        - due_date
        - total_amount
        - currency
      properties:
        payment_action_id:
          type: string
          format: uuid
        company_id:
          type: string
          format: uuid
        client_id:
          type: string
          format: uuid
        client_name:
          type: string
        project_id:
          type: string
          format: uuid
        project_name:
          type: string
        workflow_run_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - pending
            - sent
            - snoozed
            - paid
            - cancelled
            - needs_decision
        source:
          type: string
          enum:
            - manual
            - api_key
            - bank
            - workflow
            - email
            - incoming_email
            - kontur_elba
            - integration
            - other_integration
        payment_method:
          type: string
          enum:
            - cash
            - legal_invoice
            - bank_transfer
            - card
            - other
        period_start:
          type: string
          format: date
        period_end:
          type: string
          format: date
        due_date:
          type: string
          format: date
        total_amount:
          type: number
          format: double
        currency:
          type: string
          example: RUB
        confirmed_at:
          type: string
          format: date-time
        comment:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/PaymentActionItem'
        facts:
          type: array
          items:
            $ref: '#/components/schemas/PaymentFactView'
    PaymentActionConfirmRequest:
      type: object
      additionalProperties: false
      properties:
        amount:
          type: number
          format: double
        source:
          type: string
          default: manual
          enum:
            - manual
            - api_key
            - bank
            - workflow
            - email
            - incoming_email
            - kontur_elba
            - integration
            - other_integration
        payment_method:
          type: string
          description: How the client actually paid. This is distinct from source, which says how Pulse learned about the payment.
          enum:
            - cash
            - legal_invoice
            - bank_transfer
            - card
            - other
        paid_at:
          type: string
          format: date-time
        next_due_date:
          type: string
          format: date
          description: Optional explicit next payment date for all services in this payment action after the payment is recorded.
        comment:
          type: string
        items:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              payment_action_item_id:
                type: string
                format: uuid
              amount:
                type: number
                format: double
    PaymentActionSnoozeRequest:
      type: object
      additionalProperties: false
      required:
        - snoozed_until
      properties:
        snoozed_until:
          type: string
          format: date
        comment:
          type: string
    ManualPaymentRecordRequest:
      type: object
      additionalProperties: false
      required:
        - client_service_id
        - amount
        - period_start
        - paid_at
        - payment_method
        - idempotency_key
      properties:
        project_id:
          type: string
          format: uuid
        client_service_id:
          type: string
          format: uuid
        amount:
          type: number
          format: double
        currency:
          type: string
          default: RUB
        period_start:
          type: string
          format: date
        period_end:
          type: string
          format: date
        paid_at:
          type: string
          format: date-time
        payment_method:
          type: string
          description: How the client actually paid. This is distinct from source, which says how Pulse learned about the payment.
          enum:
            - cash
            - legal_invoice
            - bank_transfer
            - card
            - other
        next_due_date:
          type: string
          format: date
          description: Optional explicit next payment date for the selected service after the payment is recorded.
        comment:
          type: string
        idempotency_key:
          type: string
          description: Stable key for retry safety. The Idempotency-Key header may also be used.
        metadata:
          type: object
    ManualPaymentRecordResponse:
      type: object
      additionalProperties: false
      required:
        - event_id
        - event_type
        - event_source
        - idempotency_key
        - payment_action_id
        - payment_fact_id
        - status
        - duplicate
      properties:
        event_id:
          type: string
          format: uuid
        event_type:
          type: string
          example: payment.recorded
        event_source:
          type: string
          example: manual
        event_subject:
          type: string
          example: client/{client_id}/service/{client_service_id}
        idempotency_key:
          type: string
        payment_action_id:
          type: string
          format: uuid
        payment_fact_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - processed
            - processing
            - failed
        duplicate:
          type: boolean
    SiteChatWidget:
      type: object
      additionalProperties: false
      required:
        - chat_widget_id
        - company_id
        - project_id
        - public_key
        - name
        - status
        - title
        - subtitle
        - accent_color
        - position
        - heavy_tracking_default
        - sampling_rate
      properties:
        chat_widget_id:
          type: string
          format: uuid
        company_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        public_key:
          type: string
        name:
          type: string
        status:
          type: string
          enum:
            - active
            - paused
            - archived
        title:
          type: string
        subtitle:
          type: string
        accent_color:
          type: string
        position:
          type: string
          enum:
            - left
            - right
        heavy_tracking_default:
          type: boolean
        sampling_rate:
          type: number
          minimum: 0
          maximum: 1
        settings_json:
          type: object
        embed_script:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    SiteChatWidgetInput:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
        title:
          type: string
        subtitle:
          type: string
        accent_color:
          type: string
        position:
          type: string
          enum:
            - left
            - right
          default: right
        heavy_tracking_default:
          type: boolean
          default: false
        sampling_rate:
          type: number
          minimum: 0
          maximum: 1
          default: 1
        settings_json:
          type: object
    SiteChatWidgetPatch:
      allOf:
        - $ref: '#/components/schemas/SiteChatWidgetInput'
        - type: object
          properties:
            status:
              type: string
              enum:
                - active
                - paused
                - archived
    SiteChatPublicConfig:
      type: object
      additionalProperties: false
      required:
        - chat_widget_id
        - project_id
        - public_key
        - title
        - subtitle
        - accent_color
        - position
        - heavy_tracking_default
        - sampling_rate
        - endpoint_base
      properties:
        chat_widget_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        public_key:
          type: string
        title:
          type: string
        subtitle:
          type: string
        accent_color:
          type: string
        position:
          type: string
          enum:
            - left
            - right
        heavy_tracking_default:
          type: boolean
        sampling_rate:
          type: number
        endpoint_base:
          type: string
    SiteChatPresenceRequest:
      type: object
      additionalProperties: false
      required:
        - public_key
      properties:
        public_key:
          type: string
        anonymous_id:
          type: string
        visit_session_id:
          type: string
          format: uuid
        url:
          type: string
        title:
          type: string
        referrer:
          type: string
        utm:
          type: object
        viewport_width:
          type: integer
        viewport_height:
          type: integer
        scroll_x:
          type: integer
        scroll_y:
          type: integer
        browser:
          type: string
        browser_version:
          type: string
        os:
          type: string
        device_type:
          type: string
        screen_width:
          type: integer
        screen_height:
          type: integer
        language:
          type: string
        timezone:
          type: string
        metrika_client_id:
          type: string
        metrika_user_id:
          type: string
        metrika_session_id:
          type: string
        user_agent:
          type: string
        metadata:
          type: object
    SiteChatPresenceResponse:
      type: object
      additionalProperties: false
      required:
        - visitor_id
        - visit_session_id
        - chat_widget_id
        - project_id
        - conversation_id
        - conversation_url
        - panel_url
        - call_url
        - is_first_visit
        - monitoring_status
        - operator_invited
        - visitor_state_snapshot
      properties:
        visitor_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        chat_widget_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
        conversation_url:
          type: string
        panel_url:
          type: string
        call_url:
          type: string
        is_first_visit:
          type: boolean
        monitoring_status:
          type: string
        operator_invited:
          type: boolean
        visitor_state_snapshot:
          $ref: '#/components/schemas/VisitorStateSnapshot'
    SiteChatEventBatch:
      type: object
      additionalProperties: false
      required:
        - public_key
        - visitor_id
        - visit_session_id
        - events
      properties:
        public_key:
          type: string
        visitor_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        events:
          type: array
          maxItems: 50
          items:
            type: object
            additionalProperties: false
            required:
              - event_type
            properties:
              event_type:
                type: string
              occurred_at:
                type: string
                format: date-time
              payload:
                type: object
              priority:
                type: string
                enum:
                  - low
                  - normal
                  - high
    VisitorStateSnapshot:
      type: object
      additionalProperties: true
      properties:
        visitor_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        chat_widget_id:
          type: string
          format: uuid
        current_url:
          type: string
        current_title:
          type: string
        viewport:
          type: object
        scroll:
          type: object
        analytics:
          type: object
        activity:
          type: object
        signals:
          type: object
        suggested_actions:
          type: array
          items:
            type: string
    SiteVisitorSession:
      type: object
      additionalProperties: false
      required:
        - visitor_id
        - visit_session_id
        - chat_widget_id
        - project_id
        - conversation_id
        - conversation_url
        - panel_url
        - call_url
        - current_url
        - current_title
        - last_activity_at
        - monitoring_status
        - operator_invited
        - chat_open
        - visitor_state_snapshot
      properties:
        visitor_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        chat_widget_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
        conversation_url:
          type: string
        panel_url:
          type: string
        call_url:
          type: string
        current_url:
          type: string
        current_title:
          type: string
        last_activity_at:
          type: string
          format: date-time
        monitoring_status:
          type: string
          enum:
            - idle
            - requested
            - active
            - stopped
        operator_invited:
          type: boolean
        chat_open:
          type: boolean
        visitor_state_snapshot:
          $ref: '#/components/schemas/VisitorStateSnapshot'
    SiteChatConversation:
      type: object
      additionalProperties: false
      required:
        - conversation_id
        - project_id
        - chat_widget_id
        - visitor_id
        - status
        - title
        - created_at
        - updated_at
      properties:
        conversation_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        chat_widget_id:
          type: string
          format: uuid
        visitor_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - open
            - closed
        title:
          type: string
        visitor_name:
          type: string
        visitor_contact:
          type: string
        operator_url:
          type: string
        call_url:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    SiteChatMessage:
      type: object
      additionalProperties: false
      required:
        - message_id
        - conversation_id
        - author_kind
        - author_name
        - body
        - created_at
      properties:
        message_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
        author_kind:
          type: string
          enum:
            - visitor
            - operator
            - system
        author_user_id:
          type: string
          format: uuid
        author_name:
          type: string
        body:
          type: string
        created_at:
          type: string
          format: date-time
    SiteChatMessageInput:
      type: object
      additionalProperties: false
      required:
        - body
      properties:
        public_key:
          type: string
        conversation_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        visitor_id:
          type: string
          format: uuid
        author_name:
          type: string
        visitor_contact:
          type: string
        body:
          type: string
    SiteChatInviteInput:
      type: object
      additionalProperties: false
      properties:
        message:
          type: string
        template:
          type: string
        force:
          type: boolean
          default: false
    SiteChatCallInput:
      type: object
      additionalProperties: false
      properties:
        public_key:
          type: string
        visitor_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
        media_kind:
          type: string
          enum:
            - audio
            - video
          default: audio
        recording_enabled:
          type: boolean
        privacy_consent_accepted:
          type: boolean
        recording_consent_accepted:
          type: boolean
        end_reason:
          type: string
    SiteChatCallSession:
      type: object
      additionalProperties: false
      required:
        - call_session_id
        - company_id
        - project_id
        - chat_widget_id
        - visitor_id
        - direction
        - requested_by
        - status
        - recording_enabled
        - media_kind
        - created_at
        - updated_at
      properties:
        call_session_id:
          type: string
          format: uuid
        company_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        chat_widget_id:
          type: string
          format: uuid
        visitor_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
        direction:
          type: string
          enum:
            - operator_to_visitor
            - visitor_to_operator
        requested_by:
          type: string
          enum:
            - operator
            - visitor
        requested_by_user_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - offered
            - ringing
            - accepted
            - rejected
            - missed
            - ended
            - failed
            - cancelled
        privacy_consent_accepted_at:
          type: string
          format: date-time
        recording_consent_accepted_at:
          type: string
          format: date-time
        recording_enabled:
          type: boolean
        media_kind:
          type: string
          enum:
            - audio
            - video
        started_at:
          type: string
          format: date-time
        ended_at:
          type: string
          format: date-time
        last_signal_at:
          type: string
          format: date-time
        end_reason:
          type: string
        metadata_json:
          type: object
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    SiteCobrowseFrame:
      type: object
      additionalProperties: false
      required:
        - frame_id
        - visit_session_id
        - sequence
        - kind
        - occurred_at
        - payload_json
        - created_at
      properties:
        frame_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        sequence:
          type: integer
          format: int64
        kind:
          type: string
          enum:
            - snapshot
            - mutation
            - cursor
            - touch
            - scroll
            - viewport
            - navigation
            - click
            - diagnostic
        occurred_at:
          type: string
          format: date-time
        payload_json:
          type: object
        created_at:
          type: string
          format: date-time
    SiteChatWSEnvelope:
      type: object
      additionalProperties: false
      required:
        - id
        - type
        - sent_at
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - visitor.heartbeat
            - visitor.left
            - presence.update
            - event.batch
            - chat.message
            - chat.typing
            - operator.invite
            - invite.seen
            - invite.accepted
            - invite.declined
            - monitoring.start
            - monitoring.stop
            - monitoring.snapshot
            - monitoring.incremental
            - cursor.move
            - touch.move
            - click
            - scroll
            - viewport
            - page.navigate
            - call.request
            - call.offer
            - call.accept
            - call.reject
            - call.cancel
            - call.end
            - webrtc.offer
            - webrtc.answer
            - webrtc.ice
            - consent.accepted
            - consent.declined
            - ack
            - error
        sent_at:
          type: string
          format: date-time
        project_id:
          type: string
          format: uuid
        chat_widget_id:
          type: string
          format: uuid
        visitor_id:
          type: string
          format: uuid
        visit_session_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
        call_session_id:
          type: string
          format: uuid
        payload:
          type: object
    EndpointDoc:
      type: object
      additionalProperties: false
      required:
        - method
        - path
        - summary
        - tag
        - operation_id
        - curl_examples
        - test_hints
      properties:
        method:
          type: string
          example: POST
        path:
          type: string
          example: /api/v1/auth/login
        summary:
          type: string
          example: Login with email/password
        tag:
          type: string
          example: auth
        operation_id:
          type: string
          example: authLogin
        curl_examples:
          type: array
          items:
            type: string
          minItems: 1
        test_hints:
          type: array
          items:
            type: string
          minItems: 1
    EndpointDocList:
      type: object
      additionalProperties: false
      required:
        - generated_at
        - version
        - endpoints
      properties:
        generated_at:
          type: string
          format: date-time
        version:
          type: string
          example: 1.1.0
        endpoints:
          type: array
          items:
            $ref: '#/components/schemas/EndpointDoc'
    TestingCollection:
      type: object
      additionalProperties: false
      required:
        - format
        - version
        - download_url
      properties:
        format:
          type: string
          example: postman-v2.1
        version:
          type: string
          example: 1.1.0
        download_url:
          type: string
          example: https://api.example.test/api/v1/docs/testing/postman
    ActionTypeCatalogItem:
      type: object
      description: Строка каталога действий узла workflow (совпадает с ответом ListActionTypes)
      additionalProperties: true
      required:
        - action_key
        - display_name
        - category
        - requires_dependency
        - provider_key
        - config_schema_json
        - result_schema_json
      properties:
        action_key:
          type: string
          description: Идентификатор типа действия для графа (JSON config)
          example: http.request
        display_name:
          type: string
          example: HTTP-запрос
        category:
          type: string
          example: integration
        requires_dependency:
          type: boolean
        provider_key:
          type: string
          description: Связка с зависимостью проекта, если нужна (иначе пустая строка)
          example: ''
        config_schema_json:
          type: object
          description: JSON Schema параметров узла для конструктора
          additionalProperties: true
        result_schema_json:
          type: object
          description: JSON Schema результата шага для подсказок и валидации
          additionalProperties: true
    DependencyTypeCatalogItem:
      type: object
      description: Строка каталога зависимостей (SMTP, Telegram и т.д.)
      additionalProperties: true
      required:
        - dependency_type_key
        - display_name
        - provider_key
        - auth_schema_json
        - metadata_schema_json
      properties:
        dependency_type_key:
          type: string
          example: smtp.generic
        display_name:
          type: string
        provider_key:
          type: string
        auth_schema_json:
          type: object
          description: Поля авторизации зависимости
          additionalProperties: true
        metadata_schema_json:
          type: object
          description: Дополнительные поля конфигурации
          additionalProperties: true
    ActionRunView:
      type: object
      description: Исполнение одного узла workflow внутри запуска
      additionalProperties: true
      required:
        - action_run_id
        - action_key
        - action_type_key
        - status
        - attempt_count
        - input_json
        - output_json
        - provider_response_json
      properties:
        action_run_id:
          type: string
          format: uuid
        action_key:
          type: string
          description: Ключ узла в графе workflow
          example: node_a1
        action_type_key:
          type: string
          description: Тип действия из каталога
          example: http.request
        status:
          type: string
          example: succeeded
        attempt_count:
          type: integer
          minimum: 0
        input_json:
          type: object
          description: Контекст и параметры на вход узла
          additionalProperties: true
        output_json:
          type: object
          description: Результат узла после исполнения
          additionalProperties: true
        provider_response_json:
          type: object
          description: Ответ провайдера при наличии
          additionalProperties: true
        diagnostics:
          type: object
          description: 'Человекочитаемая интерпретация выполнения действия: причина, критерии успеха, retryable и next action.'
          additionalProperties: true
          properties:
            summary:
              type: string
              example: Telegram подтвердил отправку сообщения.
            status:
              type: string
              example: success
            provider:
              type: string
              example: telegram
            reason_code:
              type: string
              example: telegram_invalid_token
            human_reason:
              type: string
              example: Telegram отклонил токен бота.
            next_action:
              type: string
              example: Проверьте bot_token в интеграции Telegram и сохраните его заново.
            retryable:
              type: boolean
            criteria_results:
              type: array
              items:
                type: object
                additionalProperties: true
        error:
          type:
            - string
            - 'null'
          description: Текст ошибки при неуспехе
        started_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Время начала исполнения
        finished_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Время завершения
    PaymentActionItem:
      type: object
      additionalProperties: false
      required:
        - payment_action_item_id
        - client_service_id
        - title
        - due_date
        - amount
        - currency
      properties:
        payment_action_item_id:
          type: string
          format: uuid
        client_service_id:
          type: string
          format: uuid
        service_type_key:
          type: string
        title:
          type: string
        due_date:
          type: string
          format: date
        amount:
          type: number
          format: double
        currency:
          type: string
    PaymentFactView:
      type: object
      additionalProperties: false
      required:
        - payment_fact_id
        - source
        - payment_method
        - amount
        - currency
        - paid_at
      properties:
        payment_fact_id:
          type: string
          format: uuid
        source:
          type: string
          enum:
            - manual
            - api_key
            - bank
            - workflow
            - email
            - incoming_email
            - kontur_elba
            - integration
            - other_integration
        payment_method:
          type: string
          enum:
            - cash
            - legal_invoice
            - bank_transfer
            - card
            - other
        amount:
          type: number
          format: double
        currency:
          type: string
        paid_at:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
    AICapability:
      type: object
      required:
        - state
        - runtime
        - production
        - allows_read
        - allows_proposals
        - allows_writes
        - reasons
        - dependencies
      properties:
        state:
          type: string
          enum:
            - disabled
            - deterministic_preview
            - read_only
            - proposal_only
            - ready
        runtime:
          type: string
        production:
          type: boolean
        allows_read:
          type: boolean
        allows_proposals:
          type: boolean
        allows_writes:
          type: boolean
        reasons:
          type: array
          items:
            type: string
        dependencies:
          type: object
          additionalProperties:
            type: object
            properties:
              status:
                type: string
              detail:
                type: string
    AIRuntimeReadiness:
      type: object
      required:
        - ok
        - runtime
        - go_api
        - python_grpc
        - checked_at
      properties:
        ok:
          type: boolean
        runtime:
          type: string
        go_api:
          type: object
          additionalProperties: true
        python_grpc:
          type: object
          additionalProperties: true
        checked_at:
          type: string
          format: date-time
        ready_policy:
          type: string
        endpoint_note:
          type: string
        capability:
          $ref: '#/components/schemas/AICapability'
    AIModelProvider:
      type: object
      properties:
        provider_key:
          type: string
        dependency_type_key:
          type: string
        display_name:
          type: string
        status:
          type: string
        default_base_url:
          type: string
        capabilities:
          type: array
          items:
            type: string
        tool_loop:
          type: string
        docs_url:
          type: string
    AIEmployeeEnvelope:
      type: object
      properties:
        employee:
          type: object
        project:
          type: object
        model_providers:
          type: array
          items:
            $ref: '#/components/schemas/AIModelProvider'
        configured_dependencies:
          type: array
          items:
            type: object
        setup_required:
          type: boolean
        capability:
          $ref: '#/components/schemas/AICapability'
    AIPageContext:
      type: object
      additionalProperties: true
      properties:
        route:
          type: string
        pathname:
          type: string
        pageKind:
          type: string
        projectId:
          type: string
          format: uuid
        workflowId:
          type: string
          format: uuid
        workflowRunId:
          type: string
          format: uuid
        taskId:
          type: string
          format: uuid
        clientId:
          type: string
          format: uuid
        timestamp:
          type: string
    AISessionCreate:
      type: object
      properties:
        screen_scope:
          type: string
        screen_entity_type:
          type: string
        screen_entity_id:
          type: string
        workflow_id:
          type: string
          format: uuid
        workflow_run_id:
          type: string
          format: uuid
        task_id:
          type: string
          format: uuid
        client_id:
          type: string
          format: uuid
        action_dependency_id:
          type: string
          format: uuid
        model_id:
          type: string
        page_context_json:
          $ref: '#/components/schemas/AIPageContext'
    AIToolCall:
      type: object
      properties:
        ai_tool_call_id:
          type: string
          format: uuid
        tool_key:
          type: string
        risk_level:
          type: string
        status:
          type: string
        input_json:
          type: object
        output_json:
          type: object
        requires_approval:
          type: boolean
    AIChatSession:
      type: object
      properties:
        ai_chat_session_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        company_id:
          type: string
          format: uuid
        status:
          type: string
        agent_runtime:
          type: string
        langgraph_thread_id:
          type: string
        screen_scope:
          type: string
        session_revision:
          type: integer
        page_context_json:
          $ref: '#/components/schemas/AIPageContext'
        last_page_context_json:
          $ref: '#/components/schemas/AIPageContext'
        active_tool_call_id:
          type: string
          format: uuid
        active_patch_proposal_id:
          type: string
          format: uuid
        working_memory_json:
          type: object
          additionalProperties: true
        runtime_state_json:
          type: object
          additionalProperties: true
        messages:
          type: array
          items:
            type: object
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/AIToolCall'
    AIModelList:
      type: object
      properties:
        action_dependency_id:
          type: string
          format: uuid
        name:
          type: string
        provider_key:
          type: string
        dependency_type_key:
          type: string
        models:
          type: array
          items:
            type: object
        source:
          type: string
        fetched_at:
          type: string
    AIModelEvaluationResult:
      type: object
      properties:
        action_dependency_id:
          type: string
          format: uuid
        provider_key:
          type: string
        selected_model_id:
          type: string
        score:
          type: number
        items:
          type: array
          items:
            type: object
    WebhookActionReceipt:
      type: object
      additionalProperties: false
      required:
        - action_key
        - action_type_key
        - status
        - attempt_count
      properties:
        action_key:
          type: string
        action_type_key:
          type: string
        status:
          type: string
          enum:
            - pending
            - running
            - succeeded
            - failed
            - skipped
            - waiting
            - retrying
            - dead_lettered
        attempt_count:
          type: integer
          minimum: 0
        max_attempts:
          type: integer
          minimum: 1
        terminal_reason:
          type: string
        retry_class:
          type: string
          enum:
            - validation
            - auth
            - permanent
            - transient
            - rate_limited
            - timeout_unknown
            - canceled
            - unknown_outcome
        started_at:
          type: string
          format: date-time
        finished_at:
          type: string
          format: date-time
    WebhookRunReceipt:
      type: object
      additionalProperties: false
      required:
        - workflow_run_id
        - status
        - terminal
        - actions
      properties:
        workflow_run_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - pending
            - running
            - waiting
            - succeeded
            - failed
            - cancelled
        terminal:
          type: boolean
        terminal_reason:
          type: string
        started_at:
          type: string
          format: date-time
        finished_at:
          type: string
          format: date-time
        actions:
          type: array
          items:
            $ref: '#/components/schemas/WebhookActionReceipt'
  headers:
    X-Request-Id:
      description: Unique request identifier
      required: true
      schema:
        type: string
        example: req_01HPX4K9V7F5Q3Q0M3X6B8N1TZ
    X-App-Result:
      description: Result status (`ok`, `fix_required`, `error`)
      required: true
      schema:
        type: string
        enum:
          - ok
          - fix_required
          - error
    X-App-Action:
      description: Action hint in imperative tone (e.g. "Проверьте validate email")
      required: false
      schema:
        type: string
    X-App-Validate:
      description: Comma-separated fields for validation
      required: false
      schema:
        type: string
        example: email,password
    Content-Language:
      description: Response language code
      required: true
      schema:
        type: string
        example: ru-RU
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  parameters:
    client_id:
      name: client_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    client_service_id:
      name: client_service_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    payment_action_id:
      name: payment_action_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    public_key:
      name: public_key
      in: path
      required: true
      schema:
        type: string
    conversation_id:
      name: conversation_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    call_session_id:
      name: call_session_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    project_id:
      name: project_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    chat_widget_id:
      name: chat_widget_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    visit_session_id:
      name: visit_session_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    client_service_type_id:
      name: client_service_type_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    session_id:
      name: session_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    tool_call_id:
      name: tool_call_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
    action_dependency_id:
      name: action_dependency_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  responses:
    problem:
      description: Problem Details error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Problem'
    Problem:
      description: Problem
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
