openapi: 3.0.0
info:
  title: BELF Projects API
  version: 1.0.0
servers:
- url: https://cloud.belf.uz/api/v1
security:
- integrationToken: []
components:
  securitySchemes:
    integrationToken:
      type: http
      scheme: bearer
  responses:
    Error400:
      description: Проверьте поля запроса.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            required:
            - message
    Error401:
      description: Проверьте срок и значение токена.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            required:
            - message
    Error403:
      description: Проверьте права токена, роль и тариф.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            required:
            - message
    Error404:
      description: Объект недоступен или отсутствует.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            required:
            - message
    Error409:
      description: Изменилась версия задачи или этот requestId уже использован с другими
        данными.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            required:
            - message
    Error413:
      description: Уменьшите размер запроса.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            required:
            - message
    Error429:
      description: Повторите позже с тем же requestId.
    Error500:
      description: Повторите операцию с тем же requestId.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            required:
            - message
paths:
  /projects:
    get:
      operationId: list_projects
      summary: Доступные проекты
      description: Возвращает проекты текущей организации, в которых вы участвуете.
      parameters:
      - name: after
        in: query
        required: false
        schema:
          description: Значение nextCursor с предыдущей страницы
          type: string
          minLength: 1
          maxLength: 128
      responses:
        '200':
          description: Доступные проекты
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        key:
                          type: string
                        name:
                          type: string
                        status:
                          type: string
                      required:
                      - id
                      - key
                      - name
                      - status
                  nextCursor:
                    type: string
                    nullable: true
                required:
                - items
                - nextCursor
              example:
                items:
                - id: project_1
                  key: APP
                  name: Мобильное приложение
                  status: ACTIVE
                nextCursor: null
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '413':
          $ref: '#/components/responses/Error413'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
  /projects/{projectId}/members:
    get:
      operationId: list_project_members
      summary: Участники проекта
      description: Возвращает активных участников. Для назначения используйте id участника.
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 128
          description: ID проекта
      - name: after
        in: query
        required: false
        schema:
          description: Значение nextCursor с предыдущей страницы
          type: string
          minLength: 1
          maxLength: 128
      responses:
        '200':
          description: Участники проекта
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        displayName:
                          type: string
                        role:
                          type: string
                      required:
                      - id
                      - displayName
                      - role
                  nextCursor:
                    type: string
                    nullable: true
                required:
                - items
                - nextCursor
              example:
                items:
                - id: member_1
                  displayName: Алина
                  role: MEMBER
                nextCursor: null
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '413':
          $ref: '#/components/responses/Error413'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
  /projects/{projectId}/tasks:
    get:
      operationId: list_tasks
      summary: Задачи проекта
      description: Параметр q ищет по части названия или точному ключу задачи. Сохраните
        id и version для изменений.
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 128
          description: ID проекта
      - name: q
        in: query
        required: false
        schema:
          type: string
          minLength: 1
          maxLength: 200
          description: Фрагмент названия или ключ задачи
      - name: after
        in: query
        required: false
        schema:
          description: Значение nextCursor с предыдущей страницы
          type: string
          minLength: 1
          maxLength: 128
      responses:
        '200':
          description: Задачи проекта
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        projectId:
                          type: string
                        key:
                          type: string
                        title:
                          type: string
                        description:
                          type: string
                          nullable: true
                        priority:
                          type: string
                          enum:
                          - LOW
                          - MEDIUM
                          - HIGH
                          - CRITICAL
                        status:
                          type: string
                          enum:
                          - TODO
                          - IN_PROGRESS
                          - IN_REVIEW
                          - DONE
                          - BLOCKED
                          - CANCELLED
                        assigneeId:
                          type: string
                          nullable: true
                        dueAt:
                          type: string
                          format: date-time
                          nullable: true
                        version:
                          type: integer
                          minimum: 1
                      required:
                      - id
                      - projectId
                      - key
                      - title
                      - description
                      - priority
                      - status
                      - assigneeId
                      - dueAt
                      - version
                  nextCursor:
                    type: string
                    nullable: true
                required:
                - items
                - nextCursor
              example:
                items:
                - id: task_1
                  projectId: project_1
                  key: APP-12
                  title: Проверить экран оплаты
                  description: null
                  priority: HIGH
                  status: TODO
                  assigneeId: member_1
                  dueAt: null
                  version: 1
                nextCursor: null
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '413':
          $ref: '#/components/responses/Error413'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
    post:
      operationId: create_task
      summary: Создать задачу
      description: Создаёт задачу со статусом TODO. По умолчанию приоритет MEDIUM.
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 128
          description: ID проекта
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  minLength: 1
                  maxLength: 200
                  description: Название
                description:
                  nullable: true
                  type: string
                  maxLength: 20000
                  description: Описание
                priority:
                  type: string
                  enum:
                  - LOW
                  - MEDIUM
                  - HIGH
                  - CRITICAL
                  description: Приоритет
                assigneeId:
                  description: ID участника проекта
                  nullable: true
                  type: string
                  minLength: 1
                  maxLength: 128
                dueAt:
                  description: Срок в ISO 8601 с часовым поясом
                  nullable: true
                  type: string
                  format: date-time
                  pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                requestId:
                  type: string
                  format: uuid
                  pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  description: UUID операции. Сохраните для повтора.
              required:
              - title
              - requestId
              additionalProperties: false
            example:
              title: Проверить экран оплаты
              priority: HIGH
              assigneeId: member_1
              requestId: 03699736-8001-4000-8000-000000000004
      responses:
        '201':
          description: Создать задачу
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  projectId:
                    type: string
                  key:
                    type: string
                  title:
                    type: string
                  description:
                    type: string
                    nullable: true
                  priority:
                    type: string
                    enum:
                    - LOW
                    - MEDIUM
                    - HIGH
                    - CRITICAL
                  status:
                    type: string
                    enum:
                    - TODO
                    - IN_PROGRESS
                    - IN_REVIEW
                    - DONE
                    - BLOCKED
                    - CANCELLED
                  assigneeId:
                    type: string
                    nullable: true
                  dueAt:
                    type: string
                    format: date-time
                    nullable: true
                  version:
                    type: integer
                    minimum: 1
                required:
                - id
                - projectId
                - key
                - title
                - description
                - priority
                - status
                - assigneeId
                - dueAt
                - version
              example:
                id: task_1
                projectId: project_1
                key: APP-12
                title: Проверить экран оплаты
                description: null
                priority: HIGH
                status: TODO
                assigneeId: member_1
                dueAt: null
                version: 1
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '409':
          $ref: '#/components/responses/Error409'
        '413':
          $ref: '#/components/responses/Error413'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
  /tasks/{taskId}:
    patch:
      operationId: update_task
      summary: Изменить задачу
      description: Передайте текущую version и хотя бы одно изменяемое поле. Значение
        null очищает исполнителя, описание или срок.
      parameters:
      - name: taskId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 128
          description: ID задачи
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  minLength: 1
                  maxLength: 200
                  description: Название
                description:
                  nullable: true
                  type: string
                  maxLength: 20000
                  description: Описание
                priority:
                  type: string
                  enum:
                  - LOW
                  - MEDIUM
                  - HIGH
                  - CRITICAL
                  description: Приоритет
                assigneeId:
                  description: ID участника проекта
                  nullable: true
                  type: string
                  minLength: 1
                  maxLength: 128
                dueAt:
                  description: Срок в ISO 8601 с часовым поясом
                  nullable: true
                  type: string
                  format: date-time
                  pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
                status:
                  type: string
                  enum:
                  - TODO
                  - IN_PROGRESS
                  - IN_REVIEW
                  - DONE
                  - BLOCKED
                  - CANCELLED
                  description: Статус
                version:
                  type: integer
                  minimum: 0
                  exclusiveMinimum: true
                  maximum: 2147483647
                  description: Текущая версия задачи
                requestId:
                  type: string
                  format: uuid
                  pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  description: UUID операции. Сохраните для повтора.
              required:
              - version
              - requestId
              additionalProperties: false
              minProperties: 3
            example:
              version: 1
              status: IN_PROGRESS
              requestId: 03699736-8001-4000-8000-000000000005
      responses:
        '200':
          description: Изменить задачу
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  projectId:
                    type: string
                  key:
                    type: string
                  title:
                    type: string
                  description:
                    type: string
                    nullable: true
                  priority:
                    type: string
                    enum:
                    - LOW
                    - MEDIUM
                    - HIGH
                    - CRITICAL
                  status:
                    type: string
                    enum:
                    - TODO
                    - IN_PROGRESS
                    - IN_REVIEW
                    - DONE
                    - BLOCKED
                    - CANCELLED
                  assigneeId:
                    type: string
                    nullable: true
                  dueAt:
                    type: string
                    format: date-time
                    nullable: true
                  version:
                    type: integer
                    minimum: 1
                required:
                - id
                - projectId
                - key
                - title
                - description
                - priority
                - status
                - assigneeId
                - dueAt
                - version
              example:
                id: task_1
                projectId: project_1
                key: APP-12
                title: Проверить экран оплаты
                description: null
                priority: HIGH
                status: IN_PROGRESS
                assigneeId: member_1
                dueAt: null
                version: 2
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '409':
          $ref: '#/components/responses/Error409'
        '413':
          $ref: '#/components/responses/Error413'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
  /tasks/{taskId}/comments:
    post:
      operationId: add_task_comment
      summary: Добавить комментарий
      description: Добавляет комментарий от вашего имени. Участники получают уведомления
        согласно настройкам.
      parameters:
      - name: taskId
        in: path
        required: true
        schema:
          type: string
          minLength: 1
          maxLength: 128
          description: ID задачи
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                  minLength: 1
                  maxLength: 10000
                  description: Текст комментария
                requestId:
                  type: string
                  format: uuid
                  pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                  description: UUID операции. Сохраните для повтора.
              required:
              - body
              - requestId
              additionalProperties: false
            example:
              body: Проверяю оплату на телефоне.
              requestId: 03699736-8001-4000-8000-000000000006
      responses:
        '201':
          description: Добавить комментарий
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  taskId:
                    type: string
                  body:
                    type: string
                  authorId:
                    type: string
                  createdAt:
                    type: string
                    format: date-time
                required:
                - id
                - taskId
                - body
                - authorId
                - createdAt
              example:
                id: comment_1
                taskId: task_1
                body: Проверяю оплату на телефоне.
                authorId: member_1
                createdAt: '2026-12-03T10:00:00Z'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '409':
          $ref: '#/components/responses/Error409'
        '413':
          $ref: '#/components/responses/Error413'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
