openapi: 3.0.0
paths:
  /api/organizations/reactivate:
    post:
      operationId: OrganizationController_reactivate
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                organizationId:
                  type: string
                  description: ID of the organization to reactivate
              required:
                - organizationId
      responses:
        '200':
          description: Organization has been reactivated successfully.
        '400':
          description: Organization is not inactive or invalid ID.
        '403':
          description: User is not a member of this organization.
        '404':
          description: Organization not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Reactivate an inactive organization
      tags:
        - Organizations
  /api/organizations:
    get:
      operationId: OrganizationController_findOrganizationsForUser
      parameters: []
      responses:
        '200':
          description: Returns the list of organizations.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all organizations for the current user
      tags:
        - Organizations
  /api/organizations/{id}:
    get:
      operationId: OrganizationController_findOne
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: Returns the organization if found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get an organization by ID
      tags:
        - Organizations
    put:
      operationId: OrganizationController_update
      parameters:
        - name: id
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
      responses:
        '200':
          description: Organization has been successfully updated.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update an organization
      tags:
        - Organizations
  /api/organizations/{id}/avatar:
    post:
      operationId: OrganizationController_uploadAvatar
      parameters:
        - name: id
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
              required:
                - file
      responses:
        '201':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Upload or replace organization avatar
      tags:
        - Organizations
    delete:
      operationId: OrganizationController_removeAvatar
      parameters:
        - name: id
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Remove organization avatar
      tags:
        - Organizations
  /api/organizations/{id}/avatar-proxy:
    get:
      operationId: OrganizationController_getAvatarProxy
      parameters:
        - name: id
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Stream organization avatar image via backend proxy
      tags:
        - Organizations
  /api/organizations/invitations/preview:
    get:
      operationId: OrganizationController_getInvitationPreview
      parameters:
        - name: token
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get invite preview info (public, no auth required)
      tags:
        - Organizations
  /api/organizations/invitations:
    post:
      operationId: OrganizationController_createInvitation
      parameters: []
      responses:
        '201':
          description: Invitation created successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a secure invitation link
      tags:
        - Organizations
  /api/organizations/invitations/bulk:
    post:
      operationId: OrganizationController_createInvitations
      parameters: []
      responses:
        '201':
          description: Invitations created successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create multiple invitation links at once
      tags:
        - Organizations
  /api/organizations/accept-invite:
    post:
      operationId: OrganizationController_acceptInvite
      parameters: []
      responses:
        '200':
          description: Invite accepted successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Accept an invitation using a secure token
      tags:
        - Organizations
  /api/organizations/{organizationId}/{projectId}/invitations:
    get:
      operationId: OrganizationController_getPendingInvitations
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: List active pending invitations for a project
      tags:
        - Organizations
  /api/organizations/{organizationId}/{projectId}/invitations/{invitationId}/reminder:
    post:
      operationId: OrganizationController_sendInvitationReminder
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: invitationId
          required: true
          in: path
          description: ID of the invitation
          schema:
            type: string
      responses:
        '201':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Send a reminder email for an active invitation
      tags:
        - Organizations
  /api/organizations/{organizationId}/{projectId}/invitations/{invitationId}:
    delete:
      operationId: OrganizationController_revokeInvitation
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: invitationId
          required: true
          in: path
          description: ID of the invitation
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Revoke an active invitation
      tags:
        - Organizations
  /api/organizations/{id}/backup/download:
    get:
      operationId: OrganizationController_downloadBackupWithToken
      parameters:
        - name: id
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: token
          required: true
          in: query
          description: Short-lived download token
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download an organization backup using a short-lived token (Public)
      tags:
        - Organizations
  /api/{organizationId}/{projectId}/blob/media-proxy:
    get:
      operationId: BlobController_proxyMediaInline
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: url
          required: true
          in: query
          description: Blob storage URL to proxy
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Proxy media (images, audio) from blob storage for inline rendering
      tags:
        - Blob
  /api/{organizationId}/{projectId}/files/upload:
    post:
      operationId: FileController_uploadFile
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                caseId:
                  type: string
                  description: Case ID for file organization
                strategyId:
                  type: string
                  description: Strategy ID for case processing
                accessLevel:
                  type: string
                  enum:
                    - private
                    - organization
                    - project
                  description: Access level for the file
              required:
                - file
      responses:
        '201':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Upload file to Azure storage with proper authorization
      tags:
        - Files
  /api/{organizationId}/{projectId}/files/upload-multiple:
    post:
      operationId: FileController_uploadMultipleFiles
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                caseId:
                  type: string
                  description: Case ID for file organization
                strategyId:
                  type: string
                  description: Strategy ID for case processing
                accessLevel:
                  type: string
                  enum:
                    - private
                    - organization
                    - project
                  description: Access level for the files
              required:
                - files
      responses:
        '201':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Upload multiple files with authorization
      tags:
        - Files
  /api/{organizationId}/{projectId}/files/list:
    get:
      operationId: FileController_listFiles
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: caseId
          required: false
          in: query
          description: Filter by case ID
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: List files for a project with authorization
      tags:
        - Files
  /api/{organizationId}/{projectId}/files/markdown-proxy:
    get:
      operationId: FileController_getMarkdownContent
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: url
          required: true
          in: query
          description: Markdown URL to proxy
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Proxy markdown content from blob storage to avoid CORS issues
      tags:
        - Files
  /api/{organizationId}/{projectId}/files/extracted-data-proxy:
    get:
      operationId: FileController_getExtractedDataContent
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: url
          required: true
          in: query
          description: Extracted data URL to proxy
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Proxy extracted data content from blob storage to avoid CORS issues
      tags:
        - Files
  /api/{organizationId}/{projectId}/files/download-proxy:
    get:
      operationId: FileController_proxyFileDownload
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: url
          required: true
          in: query
          description: File URL to proxy
          schema:
            type: string
        - name: fileName
          required: false
          in: query
          description: Optional filename to use for the downloaded file
          schema: {}
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Proxy file download from blob storage to avoid CORS issues
      tags:
        - Files
  /api/{organizationId}/{projectId}/files/render-pdf-proxy:
    get:
      operationId: FileController_renderPdfProxy
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: url
          required: true
          in: query
          description: Office document URL to render as PDF
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: >-
        Convert an Office document (Word/ODT/RTF) from blob storage to PDF for
        inline preview
      tags:
        - Files
  /api/{organizationId}/{projectId}/files/{fileId}:
    get:
      operationId: FileController_getFileById
      parameters:
        - name: fileId
          required: true
          in: path
          description: File ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema: {}
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema: {}
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get file download URL by ID with authorization
      tags:
        - Files
    delete:
      operationId: FileController_deleteFile
      parameters:
        - name: fileId
          required: true
          in: path
          description: File ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema: {}
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema: {}
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete a file with authorization check
      tags:
        - Files
  /api/billing/config:
    get:
      operationId: BillingController_getBillingConfig
      parameters: []
      responses:
        '200':
          description: Returns the billing configuration
      summary: Get billing configuration (public)
      tags:
        - Billing
  /api/{organizationId}/{projectId}/cases/assignees:
    get:
      operationId: CaseController_getAssigneeOptions
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: includeShadow
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Distinct assignee options for the case board.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get assignee filter options for a project
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases:
    post:
      operationId: CaseController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '201':
          description: Case has been successfully created.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new case
      tags:
        - Cases
    get:
      operationId: CaseController_findByProject
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: search
          required: false
          in: query
          description: Search term
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Number of items to return
          schema:
            type: string
        - name: status
          required: false
          in: query
          description: Case status filter (open, pending, closed)
          schema:
            type: string
        - name: offset
          required: false
          in: query
          description: Number of items to skip
          schema:
            type: string
        - name: strategyId
          required: false
          in: query
          description: Filter by strategy ID
          schema:
            type: string
        - name: assignee
          required: false
          in: query
          description: Filter by assignee ID
          schema:
            type: string
        - name: sortBy
          required: false
          in: query
          description: Sort by field (createdAt, updatedAt, finishedAt)
          schema:
            enum:
              - createdAt
              - updatedAt
              - finishedAt
            type: string
        - name: sortOrder
          required: false
          in: query
          description: Sort order (asc, desc)
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: createdAfter
          required: false
          in: query
          description: Filter by creation date (after)
          schema:
            type: string
        - name: createdBefore
          required: false
          in: query
          description: Filter by creation date (before)
          schema:
            type: string
        - name: includeShadow
          required: false
          in: query
          description: Include shadow copy cases (Super Admin only)
          schema:
            type: boolean
      responses:
        '200':
          description: Returns the list of cases.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all cases for a project
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/create-and-process:
    post:
      description: >-
        This endpoint combines case creation and conversation message creation
        with file upload. It creates a case, uploads files, and automatically
        starts agent processing.
      operationId: CaseController_createAndProcess
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                  description: >-
                    Files to upload and process (one or more files). Example:
                    Select PDF, Excel, Word, or image files.
                caseData:
                  type: string
                  description: >-
                    JSON string containing case metadata. Must be a valid JSON
                    string, not a JSON object.
                  example: >-
                    {"reference":"CASE-2024-001","description":"Import
                    declaration for
                    electronics","priority":"high","strategyId":"6501234567890abcdef12345"}
                message:
                  type: string
                  description: >-
                    Optional message text to accompany the files. If not
                    provided, defaults to "File(s) uploaded for processing".
                  example: Please classify this customs declaration
                metadata:
                  type: string
                  description: >-
                    JSON string containing processing metadata. Must be a valid
                    JSON string. Used for additional processing configuration.
                  example: '{"priority":"urgent","customField":"value"}'
                strategyId:
                  type: string
                  description: >-
                    Optional strategy ID. Can be sent as a separate field or
                    included in caseData JSON. If provided in both, this field
                    takes precedence.
                  example: 6501234567890abcdef12345
            examples:
              Basic Upload:
                summary: Basic file upload with minimal case data
                value:
                  files: Select file(s) to upload
                  message: Process this invoice
              Complete Example:
                summary: Complete example with all fields
                value:
                  files: Select file(s) to upload
                  caseData: >-
                    {"reference":"CASE-2024-001","description":"Import
                    declaration","priority":"high","status":"open"}
                  message: Please classify and extract data from these documents
                  metadata: '{"priority":"urgent","batchProcessing":true}'
              With Strategy:
                summary: Upload with specific strategy
                value:
                  files: Select file(s) to upload
                  caseData: '{"reference":"AUTO-1791069340976","priority":"medium"}'
                  strategyId: 6501234567890abcdef12345
                  message: Apply strategy to these documents
              Strategy as Separate Field:
                summary: Upload with strategyId as separate form field
                value:
                  files: Select file(s) to upload
                  strategyId: 6501234567890abcdef12345
                  message: Process with strategy
      responses:
        '201':
          description: >-
            Case and conversation message have been successfully created.
            Returns both the created case and the conversation message with file
            attachments. Processing starts automatically.
          content:
            application/json:
              schema:
                type: object
                properties:
                  case:
                    type: object
                    properties:
                      _id:
                        type: string
                        example: 6501234567890abcdef12345
                      organizationId:
                        type: string
                        example: org123
                      projectId:
                        type: string
                        example: proj456
                      reference:
                        type: string
                        example: CASE-2024-001
                      description:
                        type: string
                        example: Import declaration
                      status:
                        type: string
                        example: open
                      priority:
                        type: string
                        example: high
                      processing:
                        type: boolean
                        example: true
                      processingStartedAt:
                        type: string
                        format: date-time
                        example: '2024-01-15T10:30:01.000Z'
                      createdAt:
                        type: string
                        format: date-time
                        example: '2024-01-15T10:30:00.000Z'
                      updatedAt:
                        type: string
                        format: date-time
                        example: '2024-01-15T10:30:00.000Z'
                  message:
                    type: object
                    properties:
                      _id:
                        type: string
                        example: msg123456789
                      caseId:
                        type: string
                        example: 6501234567890abcdef12345
                      sender:
                        type: string
                        example: user
                      content:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              example: text
                            text:
                              type: string
                              example: Please classify this customs declaration
                      metadata:
                        type: object
                        properties:
                          attachments:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                  example: invoice.pdf
                                name:
                                  type: string
                                  example: invoice.pdf
                                type:
                                  type: string
                                  example: application/pdf
                                size:
                                  type: number
                                  example: 245678
                                fileType:
                                  type: string
                                  example: PDF
                                hasMarkdown:
                                  type: boolean
                                  example: true
                                url:
                                  type: string
                                  example: https://storage.example.com/...
                                markdownUrl:
                                  type: string
                                  example: https://storage.example.com/...
                      createdAt:
                        type: string
                        format: date-time
                        example: '2024-01-15T10:30:01.000Z'
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a case and start processing with file upload in one call
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/stats/strategy-counts:
    get:
      operationId: CaseController_getStrategyCaseCounts
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Returns a map of strategyId -> case count.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get case counts grouped by strategy for a project
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}:
    get:
      operationId: CaseController_findOne
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
      responses:
        '200':
          description: Returns the case if found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a case by ID
      tags:
        - Cases
    put:
      operationId: CaseController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
      responses:
        '200':
          description: Case has been successfully updated.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update a case
      tags:
        - Cases
    delete:
      operationId: CaseController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
      responses:
        '204':
          description: Case has been successfully deleted.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete a case
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}/strategy-event/{eventId}/{eventRequestType}:
    post:
      operationId: CaseController_triggerStrategyEvent
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
        - name: eventId
          required: true
          in: path
          description: ID of the strategy event
          schema:
            type: string
        - name: eventRequestType
          required: true
          in: path
          description: Type of event request (trigger, download, or email)
          schema:
            type: string
      responses:
        '200':
          description: Strategy event has been successfully triggered.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Trigger a strategy event for a case
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}/restore:
    post:
      description: >-
        Clears the isDeleted flag so the case becomes editable and reappears in
        lists. Restricted to Digicust administrators; customers must request a
        restore.
      operationId: CaseController_restore
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
      responses:
        '200':
          description: Case has been successfully restored.
        '403':
          description: Restricted to Digicust administrators
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Restore a soft-deleted case (Internal/Admin only)
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}/similar:
    get:
      description: >-
        Analyzes the case formData to find other cases with similar field
        values. Returns a list of similar cases with match scores and
        field-by-field comparison.
      operationId: CaseController_findSimilarCases
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the case to find similar cases for
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Maximum number of similar cases to return
          schema:
            type: number
        - name: minMatchRatio
          required: false
          in: query
          description: Minimum match ratio (0-1) for cases to be included
          schema:
            type: number
      responses:
        '200':
          description: Returns similar cases with comparison details.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Find similar cases based on formData patterns
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}/routine-candidate:
    get:
      description: >-
        Checks if there are similar cases (70%+ match) that suggest creating a
        routine. Returns a suggestion with a catchy prompt and suggested routine
        name.
      operationId: CaseController_checkRoutineCandidate
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
      responses:
        '200':
          description: Returns routine suggestion if applicable.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Check if case is a routine candidate
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}/copy:
    post:
      operationId: CaseController_copyCase
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the case to copy
          schema:
            type: string
      responses:
        '201':
          description: Case has been successfully copied.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a full copy of a case including conversation messages
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}/shadow-copy:
    post:
      operationId: CaseController_createShadowCopy
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '201':
          description: Shadow copy has been created.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a shadow copy of a case
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}/shadow-run:
    post:
      operationId: CaseController_runShadowCase
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '202':
          description: Shadow case processing has started.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Run extraction + agent on a shadow case
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/{id}/shadow-reset:
    post:
      operationId: CaseController_resetShadowCase
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: Shadow case has been reset.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Reset a shadow case for re-running
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/merge-preview:
    post:
      operationId: CaseController_getMergePreview
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Returns formData summary for each case.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get merge preview for selected cases
      tags:
        - Cases
  /api/{organizationId}/{projectId}/cases/merge:
    post:
      operationId: CaseController_mergeCases
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '201':
          description: The cases have been successfully merged into a new case.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Merge multiple cases into a new case
      tags:
        - Cases
  /api/{organizationId}/cases/search:
    get:
      operationId: OrganizationCaseSearchController_search
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: createdBefore
          required: false
          in: query
          schema:
            type: string
        - name: createdAfter
          required: false
          in: query
          schema:
            type: string
        - name: sortOrder
          required: false
          in: query
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: sortBy
          required: false
          in: query
          schema:
            enum:
              - createdAt
              - updatedAt
              - finishedAt
            type: string
        - name: status
          required: false
          in: query
          schema:
            enum:
              - open
              - pending
              - closed
            type: string
        - name: offset
          required: false
          in: query
          schema:
            type: number
        - name: limit
          required: false
          in: query
          schema:
            type: number
        - name: search
          required: true
          in: query
          description: Search term, including customer reference
          schema:
            minLength: 2
            maxLength: 200
      responses:
        '200':
          description: Returns only cases from projects the current user can view.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Search cases across every project accessible to the current user
      tags:
        - Cases
  /api/billing/organizations/{organizationId}/projects/{projectId}/cases/{caseId}/usage:
    get:
      operationId: BillingController_getCaseUsage
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      tags:
        - Billing
  /api/organizations/{organizationId}/projects/{projectId}/api-keys:
    post:
      operationId: ApiKeyController_createApiKey
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
      responses:
        '201':
          description: API key created successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new API key
      tags:
        - API Keys
    get:
      operationId: ApiKeyController_listApiKeys
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: API keys retrieved successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: List all API keys for a project
      tags:
        - API Keys
  /api/organizations/{organizationId}/projects/{projectId}/api-keys/{apiKeyId}:
    delete:
      operationId: ApiKeyController_deleteApiKey
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: apiKeyId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: API key deleted successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete an API key
      tags:
        - API Keys
  /api/organizations/{organizationId}/projects/{projectId}/api-keys/{apiKeyId}/revoke:
    post:
      operationId: ApiKeyController_revokeApiKey
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: apiKeyId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: API key revoked successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Revoke an API key
      tags:
        - API Keys
  /api/organizations/{organizationId}/projects/{projectId}/case-creator-resolution:
    post:
      description: >-
        Returns minimal { id, name } payload for the given user IDs and API key
        IDs. Users are looked up across the entire users collection (not limited
        to project membership) so creators who are no longer project members or
        are DigiCust admins still resolve. API keys are scoped to the given
        org/project and include soft-deleted ones.
      operationId: CaseCreatorResolutionController_resolveCreators
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: Resolved creator names
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Resolve creator names for case display
      tags:
        - Case Creator Resolution
  /api/users/{userId}/avatar-proxy:
    get:
      operationId: UserController_getUserAvatarProxy
      parameters:
        - name: userId
          required: true
          in: path
          description: User ID
          schema:
            type: string
      responses:
        '200':
          description: Profile image streamed
        '204':
          description: No profile image set or unreachable
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Stream user profile image via backend proxy
      tags:
        - Users
  /api/users/me:
    get:
      operationId: UserController_getCurrentUser
      parameters: []
      responses:
        '200':
          description: Returns current user profile with role information
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get current user profile
      tags:
        - Users
  /api/users/me/notification-preferences:
    patch:
      operationId: UserController_updateNotificationPreferences
      parameters: []
      responses:
        '200':
          description: Notification preferences updated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update marketplace notification preferences
      tags:
        - Users
    get:
      operationId: UserController_getNotificationPreferences
      parameters: []
      responses:
        '200':
          description: Returns current notification preferences
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get current notification preferences
      tags:
        - Users
  /api/users/me/consumer-profile:
    patch:
      operationId: UserController_updateConsumerProfile
      parameters: []
      responses:
        '200':
          description: Consumer profile updated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update consumer profile information
      tags:
        - Users
  /api/users/me/language:
    put:
      operationId: UserController_updateLanguage
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                language:
                  type: string
                  description: Language code (e.g., "en", "de", "fr")
              required:
                - language
      responses:
        '200':
          description: Language preference updated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update current user language preference
      tags:
        - Users
  /api/users/me/preferences:
    patch:
      operationId: UserController_updatePreferences
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                language:
                  type: string
                  example: de
                productLifecycleEmails:
                  type: boolean
                  example: false
                theme:
                  type: string
                  enum:
                    - light
                    - dark
      responses:
        '200':
          description: User preferences updated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update current user interface preferences
      tags:
        - Users
  /api/users/me/case-volume-feedback:
    get:
      operationId: UserController_getCaseVolumeFeedbackPreference
      parameters: []
      responses:
        '200':
          description: Returns the current case-volume feedback prompt preference
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get current case-volume feedback prompt preference
      tags:
        - Users
    patch:
      operationId: UserController_updateCaseVolumeFeedbackPreference
      parameters: []
      responses:
        '200':
          description: Case-volume feedback prompt preference updated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update current case-volume feedback prompt preference
      tags:
        - Users
  /api/users/me/crm-notification-preferences:
    get:
      operationId: UserController_getCrmNotificationPreferences
      parameters: []
      responses:
        '200':
          description: Returns current CRM notification preferences
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get current CRM notification preferences
      tags:
        - Users
    patch:
      operationId: UserController_updateCrmNotificationPreferences
      parameters: []
      responses:
        '200':
          description: CRM notification preferences updated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update current CRM notification preferences
      tags:
        - Users
  /api/users/me/crm-table-columns:
    get:
      operationId: UserController_getCrmTableColumns
      parameters: []
      responses:
        '200':
          description: Returns column state for contact and account tables
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get CRM table column state per entity
      tags:
        - Users
    patch:
      operationId: UserController_updateCrmTableColumns
      parameters: []
      responses:
        '200':
          description: Column state updated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update CRM table column state for an entity
      tags:
        - Users
  /api/{organizationId}/{projectId}/integrations:
    post:
      operationId: IntegrationController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: creationSource
          required: false
          in: query
          description: Marks a copied integration so lifecycle notifications are suppressed
          schema:
            enum:
              - copy
            type: string
      responses:
        '201':
          description: Integration created successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new integration
      tags:
        - integrations
    get:
      operationId: IntegrationController_findByOrganizationAndProject
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Return all integrations
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all integrations for an organization and project
      tags:
        - integrations
  /api/{organizationId}/{projectId}/integrations/test-sftp:
    post:
      description: >-
        Read-only probe run from the backend that reports each stage (port,
        greeting, authentication, directory), so a failure points at the actual
        cause instead of a generic timeout.
      operationId: IntegrationController_testSftp
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Return the staged connection test result
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Diagnose an SFTP/FTP endpoint before saving the integration
      tags:
        - integrations
  /api/{organizationId}/{projectId}/integrations/names:
    get:
      description: >-
        Returns only id/name/template metadata (never config or credentials), so
        lower roles can see which integration an event references.
      operationId: IntegrationController_findNames
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Return integration name summaries
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: List integration names for selection UIs
      tags:
        - integrations
  /api/{organizationId}/{projectId}/integrations/defaults/{type}/{integrationEnvironment}:
    get:
      description: >-
        Returns the admin-maintained default used to prefill a new integration,
        or null when none exists. Contains credentials, so it requires the same
        role as creating an integration.
      operationId: IntegrationController_getDefault
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: integrationEnvironment
          required: true
          in: path
          description: test or production
          schema: {}
        - name: type
          required: true
          in: path
          description: Integration type
          schema: {}
      responses:
        '200':
          description: Return the default, or null
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get the Digicust default configuration for a vendor and environment
      tags:
        - integrations
  /api/{organizationId}/{projectId}/integrations/{id}:
    get:
      operationId: IntegrationController_findOne
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the integration
          schema:
            type: string
      responses:
        '200':
          description: Return the integration
        '404':
          description: Integration not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get integration by ID
      tags:
        - integrations
    put:
      operationId: IntegrationController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the integration
          schema:
            type: string
      responses:
        '200':
          description: Integration updated successfully
        '404':
          description: Integration not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update integration by ID
      tags:
        - integrations
    delete:
      operationId: IntegrationController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the integration
          schema:
            type: string
      responses:
        '200':
          description: Integration deleted successfully
        '404':
          description: Integration not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete integration by ID
      tags:
        - integrations
  /api/{organizationId}/{projectId}/integrations/{id}/changelog/rollback:
    post:
      operationId: IntegrationController_rollbackToVersion
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the integration
          schema:
            type: string
      responses:
        '200':
          description: Integration rolled back successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Rollback integration to a specific version
      tags:
        - integrations
  /api/{organizationId}/{projectId}/integrations/{id}/changelog:
    get:
      operationId: IntegrationController_getChangelog
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the integration
          schema:
            type: string
      responses:
        '200':
          description: Return all versions of the integration
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all changelog for an integration
      tags:
        - integrations
  /api/{organizationId}/{projectId}/integrations/assign-integration-template:
    post:
      operationId: IntegrationController_assignIntegrationTemplate
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '201':
          description: Integration template assigned
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: >-
        Assign a shared Integration Template to this project (Digicust admin
        only)
      tags:
        - integrations
  /api/{organizationId}/projects/case-counts:
    get:
      operationId: ProjectController_getCaseCounts
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: status
          required: false
          in: query
          description: >-
            Case status to count (open|pending|closed|all). Defaults to closed.
            Use "all" to get total and breakdown by status.
          schema: {}
      responses:
        '200':
          description: >-
            Returns a map of projectId -> ProjectCaseCounts. When status=all,
            includes byStatus breakdown.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: >-
        Get case (shipment) counts per project for an organization (default:
        closed)
      tags:
        - Projects
  /api/{organizationId}/projects:
    post:
      operationId: ProjectController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
      responses:
        '201':
          description: Project has been successfully created.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new project
      tags:
        - Projects
    get:
      operationId: ProjectController_findByOrganization
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
      responses:
        '200':
          description: Returns the list of projects.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all projects for an organization
      tags:
        - Projects
  /api/{organizationId}/projects/{id}:
    get:
      operationId: ProjectController_findOne
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Returns the project if found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a project by ID
      tags:
        - Projects
    put:
      operationId: ProjectController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Project has been successfully updated.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update a project
      tags:
        - Projects
    delete:
      operationId: ProjectController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '204':
          description: Project has been successfully deleted.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete a project
      tags:
        - Projects
  /api/{organizationId}/projects/{id}/duplicate:
    post:
      operationId: ProjectController_duplicate
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the source project
          schema:
            type: string
      responses:
        '201':
          description: Project duplicated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Duplicate a project within the organization
      tags:
        - Projects
  /api/{organizationId}/{projectId}/tariff-trees:
    post:
      operationId: TariffTreeController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '201':
          description: Tariff tree created successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new tariff tree
      tags:
        - tariff-trees
    get:
      operationId: TariffTreeController_findAll
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: includeItems
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return all tariff trees
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all tariff trees for an organization and project
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/registry:
    get:
      operationId: TariffTreeController_listRegistry
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Return tariff tree summaries
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: 'Compact registry listing: one entry per live tariff tree'
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/registry/for-country/{country}:
    get:
      description: >-
        The country's own trees plus, for EU members, the EU-wide TARIC trees in
        the country's languages.
      operationId: TariffTreeController_findTariffTreesForCountry
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: country
          required: true
          in: path
          description: Country code the package covers
          schema:
            type: string
      responses:
        '200':
          description: Return tariff tree summaries
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Registry summaries a country package view shows
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/{id}:
    get:
      operationId: TariffTreeController_findOne
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the tariff tree
          schema:
            type: string
      responses:
        '200':
          description: Return the tariff tree
        '404':
          description: Tariff tree not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get tariff tree by ID
      tags:
        - tariff-trees
    put:
      operationId: TariffTreeController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the tariff tree
          schema:
            type: string
      responses:
        '200':
          description: Tariff tree updated successfully
        '404':
          description: Tariff tree not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update tariff tree by ID
      tags:
        - tariff-trees
    delete:
      operationId: TariffTreeController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the tariff tree
          schema:
            type: string
      responses:
        '200':
          description: Tariff tree deleted successfully
        '404':
          description: Tariff tree not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete tariff tree by ID
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/{id}/codes:
    get:
      operationId: TariffTreeController_getTariffCodes
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the tariff tree
          schema:
            type: string
        - name: page
          required: true
          in: query
          schema:
            type: number
        - name: limit
          required: true
          in: query
          schema:
            type: number
        - name: search
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return tariff codes
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get tariff codes for a specific tariff tree
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/upload:
    post:
      operationId: TariffTreeController_upload
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '201':
          description: Tariff tree uploaded successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Upload tariff tree from file
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/{id}/re-upload:
    post:
      operationId: TariffTreeController_reUpload
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '201':
          description: Tariff tree uploaded successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Upload tariff tree from file
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/import-from-url:
    post:
      operationId: TariffTreeController_importFromUrl
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '201':
          description: Tariff tree imported successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Import tariff tree from URL
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/{id}/reimport-from-url:
    post:
      operationId: TariffTreeController_reimportFromUrl
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the tariff tree
          schema:
            type: string
      responses:
        '200':
          description: Tariff tree reimported successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Reimport tariff tree from URL
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/sample-csv/download:
    get:
      operationId: TariffTreeController_getSampleCsv
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Sample CSV file
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download sample CSV template
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/sample-json/download:
    get:
      operationId: TariffTreeController_getSampleJson
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Sample JSON file
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download sample JSON template
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/tariff-trees/{id}/download/{format}:
    get:
      operationId: TariffTreeController_downloadTariffTree
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the tariff tree
          schema:
            type: string
        - name: format
          required: true
          in: path
          description: Download format (json, csv, xml)
          schema:
            type: string
      responses:
        '200':
          description: File download
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download tariff tree in specified format (json, csv, xml)
      tags:
        - tariff-trees
  /api/{organizationId}/{projectId}/procedures:
    post:
      operationId: ProcedureController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: Procedure created successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new procedure
      tags:
        - procedures
    get:
      operationId: ProcedureController_findByOrganizationAndProject
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
        - name: summary
          required: false
          in: query
          description: Return only list fields (id, name, country) instead of full schemas
          schema:
            type: string
      responses:
        '200':
          description: Return all procedures
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all procedures for an organization and project
      tags:
        - procedures
  /api/{organizationId}/{projectId}/procedures/{id}/package-item:
    post:
      operationId: ProcedureController_createPackageItemFromSource
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the source procedure
          schema:
            type: string
        - name: scope
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: Package procedure created successfully
        '404':
          description: Procedure not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a package procedure from an existing project procedure
      tags:
        - procedures
  /api/{organizationId}/{projectId}/procedures/package-items:
    get:
      operationId: ProcedureController_findAllPackageProcedures
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: summary
          required: false
          in: query
          description: Return only list fields (id, name, country) instead of full schemas
          schema:
            type: string
      responses:
        '200':
          description: Return all procedures
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all package procedures for an organization and project
      tags:
        - procedures
  /api/{organizationId}/{projectId}/procedures/{id}:
    get:
      operationId: ProcedureController_findOne
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the procedure
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return the procedure
        '404':
          description: Procedure not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get procedure by ID
      tags:
        - procedures
    put:
      operationId: ProcedureController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the procedure
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Procedure updated successfully
        '404':
          description: Procedure not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update procedure by ID
      tags:
        - procedures
    delete:
      operationId: ProcedureController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the procedure
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Procedure deleted successfully
        '404':
          description: Procedure not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete procedure by ID
      tags:
        - procedures
  /api/{organizationId}/{projectId}/procedures/{id}/changelog/rollback:
    post:
      operationId: ProcedureController_rollbackToVersion
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the procedure
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Procedure rolled back successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Rollback procedure to a specific version
      tags:
        - procedures
  /api/{organizationId}/{projectId}/procedures/{id}/changelog:
    get:
      operationId: ProcedureController_getChangelog
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the procedure
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return all versions of the procedure
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all changelog for a procedure
      tags:
        - procedures
  /api/bti-search:
    get:
      description: >-
        Search the European Binding Tariff Information (EBTI) database for
        tariff classification decisions.
      operationId: BtiSearchController_search
      parameters:
        - name: nomenclatureCode
          required: false
          in: query
          description: HS/CN code to search (e.g., "8504" or "85044083")
          schema:
            type: string
        - name: nomenclatureCodeTo
          required: false
          in: query
          description: HS/CN code range end
          schema:
            type: string
        - name: issuingCountry
          required: false
          in: query
          description: Issuing country ISO code (e.g., "DE", "FR", "IT")
          schema:
            type: string
        - name: btiReference
          required: false
          in: query
          description: BTI Reference number
          schema:
            type: string
        - name: keyword
          required: false
          in: query
          description: Keyword to search in description
          schema:
            type: string
        - name: description
          required: false
          in: query
          description: Search in description text
          schema:
            type: string
        - name: includeInvalid
          required: false
          in: query
          description: Include invalid/expired BTIs
          schema:
            type: boolean
        - name: offset
          required: false
          in: query
          description: Page offset (1-based)
          schema:
            type: number
        - name: lang
          required: false
          in: query
          description: 'Language (default: EN)'
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Search EU BTI database
      tags:
        - BTI Search
  /api/bti-search/by-hs-code:
    get:
      description: Search the EBTI database by HS/CN nomenclature code.
      operationId: BtiSearchController_searchByHsCode
      parameters:
        - name: hsCode
          required: true
          in: query
          description: HS/CN code to search (e.g., "8504")
          schema:
            type: string
        - name: offset
          required: false
          in: query
          description: Page offset (1-based)
          schema:
            type: number
        - name: includeInvalid
          required: false
          in: query
          description: Include invalid/expired BTIs
          schema:
            type: boolean
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Search BTI by HS code
      tags:
        - BTI Search
  /api/bti-search/by-keyword:
    get:
      description: Search the EBTI database by keyword.
      operationId: BtiSearchController_searchByKeyword
      parameters:
        - name: keyword
          required: true
          in: query
          description: Keyword to search
          schema:
            type: string
        - name: offset
          required: false
          in: query
          description: Page offset (1-based)
          schema:
            type: number
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Search BTI by keyword
      tags:
        - BTI Search
  /api/bti-search/detail:
    get:
      description: Get detailed information for a specific BTI reference.
      operationId: BtiSearchController_getDetail
      parameters:
        - name: reference
          required: true
          in: query
          description: BTI Reference number (e.g., "DEBTI17322/25-1")
          schema:
            type: string
        - name: lang
          required: false
          in: query
          description: 'Language (default: EN)'
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get BTI detail
      tags:
        - BTI Search
  /api/bti-search/countries:
    get:
      description: Get list of available EU country codes for BTI search.
      operationId: BtiSearchController_getCountryCodes
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Get available country codes
      tags:
        - BTI Search
  /api/bti-search/build-url:
    get:
      description: Build a direct URL to the EBTI consultation page with search parameters.
      operationId: BtiSearchController_buildSearchUrl
      parameters:
        - name: nomenclatureCode
          required: false
          in: query
          description: HS/CN code to search
          schema:
            type: string
        - name: keyword
          required: false
          in: query
          description: Keyword to search
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer: []
      summary: Build EBTI search URL
      tags:
        - BTI Search
  /api/{organizationId}/{projectId}/conversations/{caseId}:
    post:
      operationId: ConversationController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                content:
                  type: string
                contentType:
                  type: string
                metadata:
                  type: object
                  properties:
                    model:
                      type: string
                      description: AI model ARN to use for processing
                  additionalProperties: true
          application/json:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                content:
                  type: string
                contentType:
                  type: string
                metadata:
                  type: object
                  properties:
                    model:
                      type: string
                      description: AI model ARN to use for processing
                  additionalProperties: true
      responses:
        '201':
          description: The conversation message has been successfully created.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new conversation message
      tags:
        - Conversations
    get:
      operationId: ConversationController_findByCaseId
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Maximum number of messages to return
          schema:
            type: number
        - name: skip
          required: false
          in: query
          description: Number of messages to skip
          schema:
            type: number
        - name: sortField
          required: false
          in: query
          description: Field to sort by
          schema:
            type: string
        - name: sortOrder
          required: false
          in: query
          description: Sort order
          schema:
            enum:
              - asc
              - desc
            type: string
      responses:
        '200':
          description: Returns conversation messages for the specified case.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get conversation messages for a case
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/{caseId}/bulk:
    post:
      operationId: ConversationController_bulkCreate
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
      responses:
        '201':
          description: The conversation messages have been successfully created.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create multiple conversation messages at once
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/master-data/{masterDataItemId}:
    get:
      operationId: ConversationController_findByMasterDataItemId
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: masterDataItemId
          required: true
          in: path
          description: ID of the master data item
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Maximum number of messages to return
          schema:
            type: number
        - name: skip
          required: false
          in: query
          description: Number of messages to skip
          schema:
            type: number
        - name: sortField
          required: false
          in: query
          description: Field to sort by
          schema:
            type: string
        - name: sortOrder
          required: false
          in: query
          description: Sort order
          schema:
            enum:
              - asc
              - desc
            type: string
      responses:
        '200':
          description: Returns conversation messages for the specified master data item.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get conversation messages for a master data item
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/message/{id}:
    get:
      operationId: ConversationController_findOne
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the message
          schema:
            type: string
      responses:
        '200':
          description: Returns the specified conversation message.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a specific conversation message
      tags:
        - Conversations
    put:
      operationId: ConversationController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the message
          schema:
            type: string
      responses:
        '200':
          description: The conversation message has been successfully updated.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update a conversation message
      tags:
        - Conversations
    delete:
      operationId: ConversationController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the message
          schema:
            type: string
      responses:
        '200':
          description: The conversation message has been successfully deleted.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete a conversation message
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/message/{id}/email-draft:
    put:
      operationId: ConversationController_updateEmailDraft
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the message
          schema:
            type: string
        - name: draftKey
          required: false
          in: query
          description: Per-message email draft key
          schema: {}
      responses:
        '200':
          description: The email draft state has been successfully updated.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update email draft state in a conversation message
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/message/{id}/marketplace-order-draft:
    put:
      operationId: ConversationController_updateMarketplaceOrderDraft
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the message
          schema:
            type: string
      responses:
        '200':
          description: The marketplace order draft state has been successfully updated.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update marketplace order draft state in a conversation message
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/message/{id}/instruction-change:
    put:
      description: >-
        Accepts or rejects AI-proposed instruction changes within a
        conversation. This is NOT for directly editing strategy instructions —
        use PUT /strategies/{id} with instructionsList instead.
      operationId: ConversationController_updateInstructionChange
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the message
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                applied:
                  type: boolean
                  description: Whether all changes were applied
                appliedChangeIds:
                  type: array
                  items:
                    type: string
                  description: IDs of individual changes that were accepted
                rejectedChangeIds:
                  type: array
                  items:
                    type: string
                  description: IDs of individual changes that were rejected
                removeAppliedChangeIds:
                  type: array
                  items:
                    type: string
                  description: IDs of previously applied changes to undo
                removeRejectedChangeIds:
                  type: array
                  items:
                    type: string
                  description: IDs of previously rejected changes to undo
                confirmedAt:
                  type: string
                  format: date-time
                  description: Timestamp when the user confirmed the changes
      responses:
        '200':
          description: The instruction change state has been successfully updated.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update instruction change state in a conversation message
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/message/{id}/rerun:
    post:
      operationId: ConversationController_rerunMessage
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the message
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                presetOverride:
                  type: string
                  enum:
                    - meta_agent
                    - data_steward
                    - search
                    - minimal
                    - fast
                    - balanced
                    - bigdog_v2
                    - tariff_classification
                    - trade_compliance
                    - marketplace_ordering
                    - economy
                    - experimental2
                    - experimental4
                    - experimental5
                    - slow
                  description: Optional agent preset override
                modelSpeed:
                  type: string
                  enum:
                    - fast
                    - slow
                    - experimental
                  description: >-
                    Optional model speed override (fast=Haiku, slow=Sonnet,
                    experimental=Opus)
                clearFormData:
                  type: boolean
                  description: When true, clears the case formData before rerunning the AI
      responses:
        '200':
          description: >-
            Removed subsequent messages and triggered a new AI response from the
            selected user message.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete following messages and rerun the AI for a user message
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/message/{id}/cancel:
    post:
      operationId: ConversationController_cancelMessage
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the AI message to cancel
          schema:
            type: string
      responses:
        '200':
          description: The conversation message was cancelled (or already finished).
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Cancel a running AI inference for a conversation message
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/{caseId}/download-pdf:
    get:
      operationId: ConversationController_downloadConversationHistoryPdf
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          description: Case ID
          schema:
            type: string
        - name: timeZone
          required: false
          in: query
          description: >-
            Optional IANA time zone identifier (e.g. "Europe/Berlin"). If
            omitted, the project time zone will be used when available.
          schema:
            type: string
        - name: language
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: PDF file containing conversation history
          content:
            application/pdf:
              schema:
                type: string
                format: binary
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download conversation history as PDF
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/{caseId}/download-excel:
    get:
      operationId: ConversationController_downloadConversationHistoryExcel
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          description: Case ID
          schema:
            type: string
      responses:
        '200':
          description: Excel file containing conversation history
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download conversation history as Excel
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/conversations/{caseId}/debug-export:
    get:
      operationId: ConversationController_getDebugExport
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          description: Case ID
          schema:
            type: string
      responses:
        '200':
          description: >-
            Markdown containing case data, conversation, strategy, procedure,
            and mappings
          content:
            text/markdown:
              schema:
                type: string
        '403':
          description: Only Digicust admins can access this endpoint
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Export case debug information as markdown (Digicust Admin only)
      tags:
        - Conversations
  /api/{organizationId}/{projectId}/codelists:
    post:
      operationId: CodeListController_createCodeList
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: The code list has been successfully created.
        '400':
          description: Invalid input data.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new code list
      tags:
        - Code Lists
    get:
      operationId: CodeListController_getAllCodeLists
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: includeItems
          required: false
          in: query
          description: 'Whether to include items in the response (default: false)'
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
        - name: search
          required: false
          in: query
          description: Search term to filter code lists
          schema: {}
        - name: sortOrder
          required: false
          in: query
          description: Sort order (asc/desc)
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: sortField
          required: false
          in: query
          description: Field to sort by
          schema: {}
        - name: limit
          required: false
          in: query
          description: 'Items per page (default: 10)'
          schema: {}
        - name: page
          required: false
          in: query
          description: 'Page number (default: 1)'
          schema: {}
      responses:
        '200':
          description: Return all code lists.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all code lists
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/package-item:
    post:
      operationId: CodeListController_createPackageItemFromSource
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the source code list
          schema:
            type: string
      responses:
        '201':
          description: Package code list created successfully
        '404':
          description: Code list not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a package code list from an existing project code list
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/summary:
    get:
      operationId: CodeListController_getCodeListsSummary
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
      responses:
        '200':
          description: Return code lists summary.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get code lists summary for organization/project
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/download/json:
    get:
      operationId: CodeListController_downloadJson
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return the code list as JSON file.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download code list as JSON
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/download/csv:
    get:
      operationId: CodeListController_downloadCsv
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return the code list as CSV file.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download code list as CSV
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/download/xml:
    get:
      operationId: CodeListController_downloadXml
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return the code list as XML file.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download code list as XML
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/changelog:
    get:
      operationId: CodeListController_getChangelog
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return the changelog.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get changelog for a code list
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/items/lookup:
    get:
      operationId: CodeListController_lookupCodeListItem
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID or name
          schema:
            type: string
        - name: field
          required: true
          in: query
          description: Field name to match (e.g. "Code")
          schema:
            type: string
        - name: value
          required: true
          in: query
          description: Exact value to match
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Whether to fetch from packaged code lists
          schema:
            type: string
        - name: byKey
          required: false
          in: query
          description: Whether the id is a package code list key such as DE:import:A0057
          schema:
            type: string
      responses:
        '200':
          description: Return the matching item or null.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Look up a single code list item by exact field value
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/items:
    get:
      operationId: CodeListController_getCodeListItems
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: 'Page number (default: 1)'
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: 'Items per page (default: 10, max: 200)'
          schema:
            type: string
        - name: search
          required: false
          in: query
          description: Search term to filter items
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Whether to fetch items from packaged code lists
          schema:
            type: string
        - name: activeOnly
          required: false
          in: query
          description: >-
            Filter to only currently active items (excludes expired EndDate and
            future StartDate)
          schema:
            type: string
        - name: byKey
          required: false
          in: query
          description: Whether the id is a package code list key such as DE:import:A0057
          schema:
            type: string
      responses:
        '200':
          description: Return the code list items.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get code list items with pagination
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/package-items:
    get:
      operationId: CodeListController_findAllPackageCodeLists
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Return all package code lists
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all package code lists for an organization and project
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}:
    get:
      operationId: CodeListController_getCodeListById
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: includeItems
          required: false
          in: query
          description: 'Whether to include items in the response (default: false)'
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return the code list.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a code list by ID
      tags:
        - Code Lists
    put:
      operationId: CodeListController_updateCodeList
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: The code list has been updated.
        '400':
          description: Invalid input data.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update a code list
      tags:
        - Code Lists
    delete:
      operationId: CodeListController_deleteCodeList
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: The code list has been deleted.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete a code list
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/upload:
    post:
      operationId: CodeListController_uploadCodeList
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                country:
                  type: string
                  description: >-
                    Country code for the code list (can be overridden by file
                    content)
                procedureTypes:
                  type: array
                  items:
                    type: string
                    enum:
                      - import
                      - export
                      - transit
                      - intrastat
                      - eas
                      - other
                  description: >-
                    Procedure types the code list serves (can be overridden by
                    file content); several make it a shared list
                procedureType:
                  type: string
                  description: >-
                    Single procedure type for the code list (optional - can be
                    overridden by file content)
                  enum:
                    - import
                    - export
                    - transit
                    - intrastat
                    - eas
                    - other
                name:
                  type: string
                  description: >-
                    Name for the code list (optional - derived from file if not
                    provided)
                description:
                  type: string
                  description: >-
                    Description for the code list (optional - derived from file
                    if not provided)
              required:
                - file
                - country
      responses:
        '201':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Upload a code list from a file
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/bulk-upload:
    post:
      operationId: CodeListController_bulkUploadCodeLists
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    type: string
                    format: binary
                country:
                  type: string
                  description: >-
                    Default country code for code lists (can be overridden by
                    file content)
              required:
                - files
                - country
      responses:
        '201':
          description: Bulk upload results
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    type: number
                  successful:
                    type: number
                  failed:
                    type: number
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        filename:
                          type: string
                        name:
                          type: string
                        status:
                          type: string
                          enum:
                            - success
                            - error
                        codeListId:
                          type: string
                        error:
                          type: string
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Upload multiple code lists from files
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/import-from-url:
    post:
      operationId: CodeListController_importFromUrl
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  description: URL of the code list file
                name:
                  type: string
                  description: Name for the code list
                description:
                  type: string
                  description: Description for the code list
                country:
                  type: string
                  description: Country code for the code list
              required:
                - url
                - name
                - country
      responses:
        '201':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Import a code list from a URL
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/reimport:
    post:
      operationId: CodeListController_reimportFromUrl
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
      responses:
        '200':
          description: Code list re-imported successfully.
        '400':
          description: Code list was not imported from a URL.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Re-import a code list from its source URL
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/remove-expired:
    post:
      operationId: CodeListController_removeExpiredItems
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: When true, creates a new package version with expired items removed
          schema:
            type: string
      responses:
        '200':
          description: Expired items removed successfully.
        '404':
          description: Code list not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Remove expired items from a code list
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/codelists/{id}/changelog/rollback:
    post:
      operationId: CodeListController_rollbackToVersion
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Code list ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Code list rolled back successfully.
        '404':
          description: Code list or version not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Rollback a code list to a specific version
      tags:
        - Code Lists
  /api/{organizationId}/{projectId}/instructions:
    post:
      operationId: InstructionController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: Instruction created.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new instruction
      tags:
        - Instructions
    get:
      operationId: InstructionController_getAll
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return all project instructions.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all project instructions
      tags:
        - Instructions
  /api/{organizationId}/{projectId}/instructions/{id}/package-item:
    post:
      operationId: InstructionController_createPackageItemFromSource
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the source instruction
          schema:
            type: string
        - name: scope
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: Package instruction created.
        '404':
          description: Instruction not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a package instruction from an existing project instruction
      tags:
        - Instructions
  /api/{organizationId}/{projectId}/instructions/package-items:
    get:
      operationId: InstructionController_getPackageInstructions
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
      responses:
        '200':
          description: Return installed package instructions.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get installed package instructions for project
      tags:
        - Instructions
  /api/{organizationId}/{projectId}/instructions/resolve-existing:
    post:
      operationId: InstructionController_resolveExisting
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
      responses:
        '200':
          description: Return the subset of refs that resolve to live instructions.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Resolve which instruction refs still exist (ids only, no content)
      tags:
        - Instructions
  /api/{organizationId}/{projectId}/instructions/{id}/changelog:
    get:
      operationId: InstructionController_getChangelog
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Instruction ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return the changelog.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get changelog for an instruction
      tags:
        - Instructions
  /api/{organizationId}/{projectId}/instructions/{id}/changelog/rollback:
    post:
      operationId: InstructionController_rollbackToVersion
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Instruction ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Instruction rolled back.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Rollback instruction to a specific version
      tags:
        - Instructions
  /api/{organizationId}/{projectId}/instructions/{id}:
    get:
      operationId: InstructionController_getById
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Instruction ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return the instruction.
        '404':
          description: Instruction not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get an instruction by ID
      tags:
        - Instructions
    put:
      operationId: InstructionController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Instruction ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Instruction updated.
        '404':
          description: Instruction not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update an instruction
      tags:
        - Instructions
    delete:
      operationId: InstructionController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Instruction ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Instruction deleted.
        '404':
          description: Instruction not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete an instruction
      tags:
        - Instructions
  /api/{organizationId}/{projectId}/mappings:
    get:
      operationId: MappingController_getMappings
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Returns all mappings
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all mappings for a project
      tags:
        - mappings
    post:
      operationId: MappingController_createMapping
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: Mapping created successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new mapping
      tags:
        - mappings
  /api/{organizationId}/{projectId}/mappings/package-items:
    get:
      operationId: MappingController_findAllPackageMappings
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Return all mappings
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all package mappings for an organization and project
      tags:
        - mappings
  /api/{organizationId}/{projectId}/mappings/{id}:
    get:
      operationId: MappingController_getMapping
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the mapping
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Returns the mapping
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a specific mapping by ID
      tags:
        - mappings
    put:
      operationId: MappingController_updateMapping
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the mapping
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Mapping updated successfully
        '404':
          description: Mapping not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update an existing mapping
      tags:
        - mappings
    delete:
      operationId: MappingController_deleteMapping
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the mapping
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Mapping deleted successfully
        '404':
          description: Mapping not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete a mapping
      tags:
        - mappings
  /api/{organizationId}/{projectId}/mappings/{id}/changelog:
    get:
      operationId: MappingController_getMappingChangelog
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the mapping
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Returns the mapping changelog
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get changelog for a mapping
      tags:
        - mappings
  /api/{organizationId}/{projectId}/mappings/{id}/rollback:
    post:
      operationId: MappingController_rollbackMapping
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the mapping
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Mapping rolled back successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Rollback mapping to a specific version
      tags:
        - mappings
  /api/{organizationId}/{projectId}/mappings/{id}/package-item:
    post:
      operationId: MappingController_createPackageItemFromSource
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the source mapping
          schema:
            type: string
        - name: scope
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: Package mapping created successfully
        '404':
          description: Mapping not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a package mapping from an existing project mapping
      tags:
        - mappings
  /api/{organizationId}/{projectId}/packages/{id}/install:
    post:
      operationId: PackageManagerController_install
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Package ID
          schema:
            type: string
      responses:
        '200':
          description: Package has been successfully installed.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Install a package
      tags:
        - Package Manager
  /api/{organizationId}/{projectId}/packages/{id}/uninstall:
    delete:
      operationId: PackageManagerController_uninstall
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Package ID
          schema:
            type: string
      responses:
        '200':
          description: Package has been successfully uninstalled.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Uninstall a package
      tags:
        - Package Manager
  /api/{organizationId}/{projectId}/master-data/types:
    post:
      operationId: MasterDataTypesController_createMasterDataType
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
        - name: creationSource
          required: false
          in: query
          description: >-
            Marks a copied master data type so lifecycle notifications are
            suppressed
          schema:
            enum:
              - copy
            type: string
      responses:
        '201':
          description: The master data type has been successfully created.
        '400':
          description: Invalid input data.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new master data type
      tags:
        - Master Data Types
    get:
      operationId: MasterDataTypesController_getAllMasterDataTypes
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: The master data types have been successfully retrieved.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all master data types
      tags:
        - Master Data Types
  /api/{organizationId}/{projectId}/master-data/types/{id}/package-item:
    post:
      operationId: MasterDataTypesController_createPackageItemFromSource
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the source master data type
          schema:
            type: string
        - name: scope
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: Package master data type created successfully
        '404':
          description: Master data type not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: >-
        Create a package master data type from an existing project master data
        type
      tags:
        - Master Data Types
  /api/{organizationId}/{projectId}/master-data/types/package-items:
    get:
      operationId: MasterDataTypesController_findAllPackageMasterDataTypes
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Return all package master data types
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all package master data types for an organization and project
      tags:
        - Master Data Types
  /api/{organizationId}/{projectId}/master-data/types/{id}:
    get:
      operationId: MasterDataTypesController_getMasterDataTypeById
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: The master data type has been successfully retrieved.
        '404':
          description: Master data type not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a master data type by ID
      tags:
        - Master Data Types
    put:
      operationId: MasterDataTypesController_updateMasterDataType
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Master Data Type ID
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: The master data type has been successfully updated.
        '404':
          description: Master data type not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update a master data type
      tags:
        - Master Data Types
    delete:
      operationId: MasterDataTypesController_deleteMasterDataType
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: The master data type has been successfully deleted.
        '404':
          description: Master data type not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete a master data type
      tags:
        - Master Data Types
  /api/{organizationId}/{projectId}/master-data/types/{id}/changelog/rollback:
    post:
      operationId: MasterDataTypesController_rollbackToVersion
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the master data type
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Master data type rolled back successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Rollback master data type to a specific version
      tags:
        - Master Data Types
  /api/{organizationId}/{projectId}/master-data/types/{id}/changelog:
    get:
      operationId: MasterDataTypesController_getChangelog
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the master data type
          schema:
            type: string
        - name: isPackageItem
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Return all versions of the master data type
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all changelog for a master data type
      tags:
        - Master Data Types
  /api/{organizationId}/{projectId}/strategies:
    post:
      operationId: StrategyController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: creationSource
          required: false
          in: query
          description: Marks a copied strategy so lifecycle notifications are suppressed
          schema:
            enum:
              - copy
            type: string
      responses:
        '201':
          description: Strategy created successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new strategy
      tags:
        - strategies
    get:
      operationId: StrategyController_findByOrganizationAndProject
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: includeShadow
          required: false
          in: query
          description: Include shadow strategies (Super Admin only)
          schema:
            type: boolean
        - name: summary
          required: false
          in: query
          description: >-
            Return only the fields the strategy overview needs instead of full
            strategies
          schema:
            type: boolean
      responses:
        '200':
          description: Return all strategies
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all strategies for an organization and project
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/changelog/rollback:
    post:
      operationId: StrategyController_rollbackToVersion
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
      responses:
        '200':
          description: Strategy rolled back successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Rollback strategy to a specific version
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/changelog/compare:
    get:
      operationId: StrategyController_compareVersions
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
        - name: from
          required: true
          in: query
          description: Source version number
          schema:
            type: number
        - name: to
          required: true
          in: query
          description: Target version number
          schema:
            type: number
        - name: fromVersionId
          required: false
          in: query
          description: Document id of the source version. Version numbers are not unique.
          schema:
            type: string
        - name: toVersionId
          required: false
          in: query
          description: Document id of the target version. Version numbers are not unique.
          schema:
            type: string
      responses:
        '200':
          description: Return comparison of two versions
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Compare two versions of a strategy
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/changelog/{version}:
    get:
      operationId: StrategyController_getVersionByNumber
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
        - name: version
          required: true
          in: path
          description: Version number
          schema:
            type: string
        - name: versionId
          required: false
          in: query
          description: Document id of the version. Version numbers are not unique.
          schema:
            type: string
      responses:
        '200':
          description: Return the specified version of the strategy
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a specific version of a strategy
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/changelog:
    get:
      operationId: StrategyController_getChangelog
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: 'Page number (default: 1)'
          schema:
            type: number
        - name: limit
          required: false
          in: query
          description: 'Items per page (default: 10)'
          schema:
            type: number
        - name: startDate
          required: false
          in: query
          description: Filter versions from this date (ISO string)
          schema:
            type: string
        - name: endDate
          required: false
          in: query
          description: Filter versions until this date (ISO string)
          schema:
            type: string
        - name: updatedBy
          required: false
          in: query
          description: Filter by user who made the change
          schema:
            type: string
      responses:
        '200':
          description: Return paginated changelog for the strategy
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get changelog for a strategy with pagination and filters
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}:
    get:
      operationId: StrategyController_findOne
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
      responses:
        '200':
          description: Return the strategy
        '404':
          description: Strategy not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get strategy by ID
      tags:
        - strategies
    put:
      description: >-
        Partially updates a strategy. To update instructions, pass the full
        instructionsList array (stateless replacement). Supports optimistic
        concurrency via expectedVersion.
      operationId: StrategyController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instructionsList:
                  type: array
                  description: >-
                    Full list of instructions (replaces existing). Each request
                    should pass the complete list.
                  items:
                    type: object
                    required:
                      - id
                      - name
                      - type
                      - content
                      - enabled
                    properties:
                      id:
                        type: string
                        description: Unique identifier for the instruction
                      name:
                        type: string
                        description: >-
                          Descriptive name (e.g. "When Supplier XY", "Always
                          check compliance")
                      type:
                        type: string
                        enum:
                          - always-attached
                          - auto-attached
                          - agent-requested
                        description: >-
                          always-attached: included in every AI run.
                          auto-attached: included when the name/condition
                          matches. agent-requested: available on-demand by the
                          AI agent.
                      content:
                        type: string
                        description: The instruction text/rule in natural language
                      enabled:
                        type: boolean
                        description: Whether this instruction is active
                      tags:
                        type: array
                        items:
                          type: string
                        description: Optional tags for categorization
                      order:
                        type: number
                        description: Optional sort order
                instructions:
                  type: string
                  description: >-
                    Legacy: free-text instructions field (prefer
                    instructionsList)
                expectedVersion:
                  type: number
                  description: >-
                    Optional optimistic concurrency control. Pass the current
                    version number to prevent conflicting updates.
      responses:
        '200':
          description: Strategy updated successfully
        '404':
          description: Strategy not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update strategy by ID
      tags:
        - strategies
    delete:
      operationId: StrategyController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
      responses:
        '200':
          description: Strategy deleted successfully
        '404':
          description: Strategy not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete strategy by ID
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/procedure/{procedureId}:
    get:
      operationId: StrategyController_findByProcedure
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: procedureId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: Return all strategies for the procedure
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all strategies for a procedure
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/instructions/analyze-improvements:
    post:
      operationId: StrategyController_analyzeInstructionImprovements
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
      responses:
        '201':
          description: Analysis job accepted
        '404':
          description: Strategy not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Analyze instructions for improvement suggestions
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/instructions/analyze-improvements/{jobId}:
    get:
      operationId: StrategyController_getInstructionImprovementJob
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
        - name: jobId
          required: true
          in: path
          description: ID of the analysis job
          schema:
            type: string
      responses:
        '200':
          description: Analysis job status
        '404':
          description: Analysis job not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get instruction improvement analysis job status
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/routines/generate:
    post:
      operationId: StrategyController_generateRoutine
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
      responses:
        '200':
          description: Routine generated successfully
        '404':
          description: Strategy not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Generate a routine using AI
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/routines/modify:
    post:
      operationId: StrategyController_modifyRoutine
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the strategy
          schema:
            type: string
      responses:
        '200':
          description: Routine modified successfully
        '404':
          description: Strategy not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Modify an existing routine using AI
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/shadow:
    post:
      operationId: StrategyController_createShadow
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the parent strategy
          schema:
            type: string
      responses:
        '201':
          description: Shadow strategy created
        '400':
          description: Shadow already exists
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a shadow strategy for a parent strategy
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/shadow/sync-from-parent:
    post:
      operationId: StrategyController_syncFromParent
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the shadow strategy
          schema:
            type: string
      responses:
        '200':
          description: Shadow synced from parent
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Sync shadow strategy from its parent
      tags:
        - strategies
  /api/{organizationId}/{projectId}/strategies/{id}/shadow/sync-to-parent:
    post:
      operationId: StrategyController_syncToParent
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the shadow strategy
          schema:
            type: string
      responses:
        '200':
          description: Parent synced from shadow
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Sync shadow strategy changes back to parent
      tags:
        - strategies
  /api/{organizationId}/{projectId}/integrations/test-vendor:
    post:
      description: >-
        Calls the vendor's own logon operation with the configured credentials
        and reports whether the endpoint answered and whether the account was
        accepted. No declaration is filed and no business data is sent.
      operationId: VendorConnectionTestController_testVendor
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Return the connection test result
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Verify a vendor account without submitting anything
      tags:
        - integrations
  /api/{organizationId}/{projectId}/reports/package-items:
    get:
      operationId: ReportController_findAllPackageReports
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: Returns all package reports
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all package reports for a project
      tags:
        - reports
  /api/{organizationId}/{projectId}/reports:
    get:
      operationId: ReportController_getReports
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Filter for package items only
          schema:
            type: string
      responses:
        '200':
          description: Returns all reports
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all reports for a project
      tags:
        - reports
    post:
      operationId: ReportController_createReport
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Create as package item
          schema:
            type: string
      responses:
        '201':
          description: Report created successfully
        '400':
          description: Bad request
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new report
      tags:
        - reports
  /api/{organizationId}/{projectId}/reports/{id}:
    get:
      operationId: ReportController_getReport
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the report
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Filter for package items only
          schema:
            type: string
      responses:
        '200':
          description: Returns the report
        '404':
          description: Report not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a report by ID
      tags:
        - reports
    put:
      operationId: ReportController_updateReport
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the report
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Update as package item
          schema:
            type: string
      responses:
        '200':
          description: Report updated successfully
        '404':
          description: Report not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update a report
      tags:
        - reports
    delete:
      operationId: ReportController_deleteReport
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the report
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Delete as package item
          schema:
            type: string
      responses:
        '200':
          description: Report deleted successfully
        '404':
          description: Report not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete a report
      tags:
        - reports
  /api/{organizationId}/{projectId}/reports/{id}/package-item:
    post:
      operationId: ReportController_createPackageItemFromSource
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the source report
          schema:
            type: string
        - name: scope
          required: true
          in: query
          schema:
            type: string
      responses:
        '201':
          description: Package report created successfully
        '404':
          description: Report not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a package report from an existing project report
      tags:
        - reports
  /api/{organizationId}/{projectId}/reports/{id}/changelog:
    get:
      operationId: ReportController_getChangelog
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the report
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Filter for package items only
          schema:
            type: string
      responses:
        '200':
          description: Returns the report changelog
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get changelog for a report
      tags:
        - reports
  /api/{organizationId}/{projectId}/reports/{id}/changelog/rollback:
    post:
      operationId: ReportController_rollbackToVersion
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the report
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Rollback as package item
          schema:
            type: string
      responses:
        '200':
          description: Report rolled back successfully
        '400':
          description: Invalid version
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Rollback report to a specific version
      tags:
        - reports
  /api/{organizationId}/{projectId}/reports/{id}/preview:
    post:
      operationId: ReportController_previewReport
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the report
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Preview as package item
          schema:
            type: string
      responses:
        '200':
          description: Report preview data
        '404':
          description: Report not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Preview a report with optional time frame
      tags:
        - reports
  /api/{organizationId}/{projectId}/reports/{id}/execute:
    post:
      operationId: ReportController_executeAndDownloadReport
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the report
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Execute as package item
          schema:
            type: string
      responses:
        '200':
          description: Report file in the configured format (JSON, CSV, or Excel)
        '404':
          description: Report not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Execute and download a report
      tags:
        - reports
  /api/{organizationId}/{projectId}/reports/{id}/download-pdf:
    post:
      operationId: ReportController_downloadReportAsPdf
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: ID of the report
          schema:
            type: string
        - name: isPackageItem
          required: false
          in: query
          description: Download as package item
          schema:
            type: string
      responses:
        '200':
          description: PDF file containing report data
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        '404':
          description: Report not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Download report as PDF
      tags:
        - reports
  /api/{organizationId}/{projectId}/memberships/users:
    get:
      operationId: MembershipController_getOrgAndProjectMembers
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
      responses:
        '200':
          description: >-
            Returns a list of members with access to both organization and
            project
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all members with access to both organization and project
      tags:
        - Memberships
  /api/{organizationId}/{projectId}/memberships/users/{userId}/role:
    put:
      operationId: MembershipController_updateUserRole
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: userId
          required: true
          in: path
          description: ID of the user
          schema:
            type: string
      responses:
        '200':
          description: User role updated successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update user role in project
      tags:
        - Memberships
  /api/{organizationId}/{projectId}/memberships/users/{auth0Id}:
    get:
      operationId: MembershipController_getUserByAuth0Id
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: auth0Id
          required: true
          in: path
          description: Auth0 ID of the user
          schema:
            type: string
      responses:
        '200':
          description: Returns user details if found
        '404':
          description: User not found
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get user details by auth0Id
      tags:
        - Memberships
  /api/{organizationId}/{projectId}/memberships/users/{userId}:
    delete:
      operationId: MembershipController_removeUser
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: userId
          required: true
          in: path
          description: ID of the user
          schema:
            type: string
      responses:
        '200':
          description: User removed successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Remove user from project
      tags:
        - Memberships
  /api/{organizationId}/{projectId}/memberships/users/{userId}/profile-image:
    post:
      operationId: MembershipController_uploadUserProfileImage
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: userId
          required: true
          in: path
          description: ID of the user
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
              required:
                - file
      responses:
        '200':
          description: Profile image uploaded successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Upload or update user profile image
      tags:
        - Memberships
    delete:
      operationId: MembershipController_removeUserProfileImage
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: userId
          required: true
          in: path
          description: ID of the user
          schema:
            type: string
      responses:
        '200':
          description: Profile image removed successfully
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Remove user profile image
      tags:
        - Memberships
  /api/{organizationId}/{projectId}/master-data/items/{typeId}:
    post:
      operationId: MasterItemsController_createMasterDataItem
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: typeId
          required: true
          in: path
          description: Master Data Type ID
          schema:
            type: string
      responses:
        '201':
          description: The master data item has been successfully created.
        '400':
          description: Invalid input data.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new master data item
      tags:
        - Master Data Items
    get:
      operationId: MasterItemsController_getAllMasterDataItems
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: typeId
          required: true
          in: path
          description: Master Data Type ID
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: Page number
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Items per page (max 200)
          schema:
            type: string
        - name: search
          required: false
          in: query
          description: Search text
          schema:
            type: string
        - name: sortField
          required: false
          in: query
          description: Field to sort by
          schema:
            type: string
        - name: sortOrder
          required: false
          in: query
          description: Sort order
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: filters
          required: false
          in: query
          description: JSON-encoded filter object
          schema:
            type: string
      responses:
        '200':
          description: The master data items have been successfully retrieved.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all master data items
      tags:
        - Master Data Items
    patch:
      description: >-
        Writes only the fields present in `data`; every other field on the item
        is left untouched. Pass an empty `ids` array together with `options` to
        patch all items matching the active filters ("select all" mode).
      operationId: MasterItemsController_bulkUpdateMasterDataItems
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: typeId
          required: true
          in: path
          description: Master Data Type ID
          schema:
            type: string
      responses:
        '200':
          description: The master data items have been successfully updated.
        '400':
          description: Unknown or unsafe field in the patch.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Apply a partial field patch to multiple master data items
      tags:
        - Master Data Items
    delete:
      operationId: MasterItemsController_deleteMasterDataItems
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: typeId
          required: true
          in: path
          description: Master Data Type ID
          schema:
            type: string
      responses:
        '200':
          description: The master data items have been successfully deleted.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete multiple master data items
      tags:
        - Master Data Items
  /api/{organizationId}/{projectId}/master-data/items/{typeId}/count:
    get:
      operationId: MasterItemsController_getFilteredItemCount
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: typeId
          required: true
          in: path
          description: Master Data Type ID
          schema:
            type: string
        - name: page
          required: true
          in: query
          schema:
            type: string
        - name: limit
          required: true
          in: query
          schema:
            type: string
        - name: search
          required: false
          in: query
          description: Search text
          schema:
            type: string
        - name: sortField
          required: true
          in: query
          schema:
            type: string
        - name: sortOrder
          required: true
          in: query
          schema:
            type: string
        - name: filters
          required: false
          in: query
          description: JSON-encoded filter object
          schema:
            type: string
      responses:
        '200':
          description: The filtered item count has been successfully retrieved.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get filtered item count
      tags:
        - Master Data Items
  /api/{organizationId}/{projectId}/master-data/items/{typeId}/acceptance-stats:
    get:
      description: >-
        Returns per-field buckets (accepted / hasData / noData / total)
        honouring the same search and filter params as the list view.
      operationId: MasterItemsController_getAcceptanceStats
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: typeId
          required: true
          in: path
          description: Master Data Type ID
          schema:
            type: string
        - name: search
          required: false
          in: query
          description: Search text
          schema:
            type: string
        - name: filters
          required: false
          in: query
          description: JSON-encoded filter object
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: >-
        Aggregate acceptance counts for every acceptable field on a master data
        type
      tags:
        - Master Data Items
  /api/{organizationId}/{projectId}/master-data/items/{typeId}/ids:
    get:
      operationId: MasterItemsController_getAllMasterDataItemIds
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: typeId
          required: true
          in: path
          description: Master Data Type ID
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: Page number
          schema:
            type: string
        - name: limit
          required: false
          in: query
          description: Items per page (max 200)
          schema:
            type: string
        - name: search
          required: false
          in: query
          description: Search text
          schema:
            type: string
        - name: sortField
          required: false
          in: query
          description: Field to sort by
          schema:
            type: string
        - name: sortOrder
          required: false
          in: query
          description: Sort order
          schema:
            enum:
              - asc
              - desc
            type: string
        - name: filters
          required: false
          in: query
          description: JSON-encoded filter object
          schema:
            type: string
      responses:
        '200':
          description: The master data item IDs have been successfully retrieved.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all master data item IDs
      tags:
        - Master Data Items
  /api/{organizationId}/{projectId}/master-data/items/{typeId}/{id}:
    get:
      operationId: MasterItemsController_getMasterDataItemById
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: The master data item has been successfully retrieved.
        '404':
          description: Master data item not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get a master data item by ID
      tags:
        - Master Data Items
    put:
      operationId: MasterItemsController_updateMasterDataItem
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Master Data Item ID
          schema:
            type: string
      responses:
        '200':
          description: The master data item has been successfully updated.
        '404':
          description: Master data item not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update a master data item
      tags:
        - Master Data Items
  /api/{organizationId}/{projectId}/master-data/items/{typeId}/{id}/classification:
    patch:
      operationId: MasterItemsController_updateClassification
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: id
          required: true
          in: path
          description: Master Data Item ID
          schema:
            type: string
        - name: typeId
          required: true
          in: path
          description: Master Data Type ID
          schema: {}
      responses:
        '200':
          description: The classification has been successfully updated.
        '404':
          description: Master data item not found.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update classification status for a master data item
      tags:
        - Master Data Items
  /api/{organizationId}/projects/{projectId}/mcp-servers:
    get:
      operationId: McpController_findAll
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Get all MCP servers for a project
      tags:
        - MCP
    post:
      operationId: McpController_create
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - transport
              properties:
                name:
                  type: string
                  description: Name of the MCP server
                transport:
                  type: string
                  enum:
                    - sse
                    - stdio
                    - http
                  description: Transport type
                url:
                  type: string
                  description: URL for SSE/HTTP transport
                command:
                  type: string
                  description: Command for stdio transport
                args:
                  type: array
                  items:
                    type: string
                  description: Arguments for stdio command
                env:
                  type: object
                  additionalProperties:
                    type: string
                  description: Environment variables
                enabled:
                  type: boolean
                  default: true
      responses:
        '201':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Create a new MCP server
      tags:
        - MCP
  /api/{organizationId}/projects/{projectId}/mcp-servers/{id}:
    put:
      operationId: McpController_update
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name of the MCP server
                transport:
                  type: string
                  enum:
                    - sse
                    - stdio
                    - http
                  description: Transport type
                url:
                  type: string
                  description: URL for SSE/HTTP transport
                command:
                  type: string
                  description: Command for stdio transport
                args:
                  type: array
                  items:
                    type: string
                  description: Arguments for stdio command
                env:
                  type: object
                  additionalProperties:
                    type: string
                  description: Environment variables
                enabled:
                  type: boolean
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Update an MCP server
      tags:
        - MCP
    delete:
      operationId: McpController_delete
      parameters:
        - name: organizationId
          required: true
          in: path
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          schema:
            type: string
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '204':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Delete an MCP server
      tags:
        - MCP
  /api/{organizationId}/{projectId}/duty-tax-quotes:
    post:
      description: >-
        Uses preloaded tariff data only. Totals are withheld when an applicable
        rule cannot be evaluated safely.
      operationId: DutyTaxQuotesController_createQuote
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: idempotency-key
          required: true
          in: header
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - currency
                - destination
                - hsCode
                - itemValue
                - originCountry
                - valuationDate
              properties:
                additionalCode:
                  type: string
                  example: '1234'
                callerProvidedFees:
                  type: array
                  maxItems: 20
                  items:
                    type: object
                    required:
                      - amount
                      - label
                    properties:
                      amount:
                        type: string
                        pattern: ^(?:0|[1-9]\d*)(?:\.\d+)?$
                      label:
                        type: string
                currency:
                  type: string
                  example: EUR
                customer:
                  type: object
                  properties:
                    taxRegistered:
                      type: boolean
                    type:
                      type: string
                      enum:
                        - business
                        - consumer
                customsValue:
                  type: string
                  example: '112.50'
                destination:
                  type: object
                  required:
                    - country
                  properties:
                    country:
                      type: string
                      pattern: ^[A-Z]{2}$
                    postalCode:
                      type: string
                    subdivision:
                      type: string
                dispatchCountry:
                  type: string
                  example: CN
                externalReference:
                  type: string
                hsCode:
                  type: string
                  example: '6109100010'
                insuranceValue:
                  type: string
                  example: '2.50'
                itemValue:
                  type: string
                  example: '100.00'
                originCountry:
                  type: string
                  example: CN
                otherDutiableCosts:
                  type: string
                  example: '0'
                preferenceProof:
                  type: object
                  required:
                    - asserted
                  properties:
                    asserted:
                      type: boolean
                    proofReference:
                      type: string
                    proofType:
                      type: string
                      example: EUR.1
                quantities:
                  type: object
                  properties:
                    applicationUnitCount:
                      type: string
                    grossMassKg:
                      type: string
                    itemCount:
                      type: string
                      pattern: ^[1-9]\d*$
                    litres:
                      type: string
                    megawattHours:
                      type: string
                    metres:
                      type: string
                    netMassKg:
                      type: string
                    supplementaryUnits:
                      type: array
                      items:
                        type: object
                        required:
                          - amount
                          - unitCode
                        properties:
                          amount:
                            type: string
                          unitCode:
                            type: string
                seller:
                  type: object
                  properties:
                    isMarketplace:
                      type: boolean
                    registrationSchemes:
                      type: array
                      items:
                        type: string
                shippingValue:
                  type: string
                  example: '10.00'
                taxRateCode:
                  type: string
                valuationDate:
                  type: string
                  format: date
                  example: '2026-09-16'
      responses:
        '200':
          description: Quote calculated
          content:
            application/json:
              schema:
                type: object
                required:
                  - assumptions
                  - charges
                  - completeness
                  - computedAt
                  - destinationCountry
                  - elapsedMs
                  - hsCode
                  - originCountry
                  - quoteId
                  - sources
                  - status
                  - totals
                  - valuationDate
                  - warnings
                properties:
                  assumptions:
                    type: array
                    items:
                      type: object
                  candidateHsCodes:
                    type: array
                    items:
                      type: string
                  charges:
                    type: array
                    items:
                      type: object
                  completeness:
                    type: object
                    required:
                      - calculatedMeasureCount
                      - countryCoverageGaps
                      - omittedRuleAreas
                      - unresolvedMeasureCount
                    properties:
                      calculatedMeasureCount:
                        type: integer
                      countryCoverageGaps:
                        type: array
                        items:
                          type: string
                      omittedRuleAreas:
                        type: array
                        items:
                          type: string
                      unresolvedMeasureCount:
                        type: integer
                  computedAt:
                    type: string
                    format: date-time
                  destinationCountry:
                    type: string
                    pattern: ^[A-Z]{2}$
                  elapsedMs:
                    type: number
                  hsCode:
                    type: string
                  matchedHsCode:
                    type: string
                  originCountry:
                    type: string
                  quoteId:
                    type: string
                    format: uuid
                  sources:
                    type: array
                    items:
                      type: object
                  status:
                    type: string
                    enum:
                      - complete
                      - partial
                      - unsupported
                  timing:
                    type: object
                    required:
                      - calculationMs
                      - lookupMs
                      - totalMs
                    properties:
                      authorizationMs:
                        type: number
                      calculationMs:
                        type: number
                      lookupMs:
                        type: number
                      totalMs:
                        type: number
                  totals:
                    type: object
                    nullable: true
                  valuationDate:
                    type: string
                    format: date
                  warnings:
                    type: array
                    items:
                      type: object
        '400':
          description: Invalid quote input
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Calculate a duty and tax quote for one item
      tags:
        - duty-tax-quotes
  /api/{organizationId}/{projectId}/duty-tax-quotes/cart:
    post:
      operationId: DutyTaxQuotesController_createCartQuote
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Calculate duty and tax quotes for a cart
      tags:
        - duty-tax-quotes
  /api/{organizationId}/{projectId}/duty-tax-quotes/capabilities:
    get:
      operationId: DutyTaxQuotesController_getCapabilities
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
      responses:
        '200':
          description: Capability matrix returned
          content:
            application/json:
              schema:
                type: object
                required:
                  - capabilities
                  - computedAt
                properties:
                  capabilities:
                    type: array
                    items:
                      type: object
                      required:
                        - available
                        - destinationCountry
                        - missingCapabilities
                        - status
                        - structuredExpressionTypes
                      properties:
                        available:
                          type: boolean
                        destinationCountry:
                          type: string
                          pattern: ^[A-Z]{2}$
                        missingCapabilities:
                          type: array
                          items:
                            type: string
                        status:
                          type: string
                          enum:
                            - partial
                            - unsupported
                        structuredExpressionTypes:
                          type: array
                          items:
                            type: string
                        tariffTreeId:
                          type: string
                        tariffTreeUpdatedAt:
                          type: string
                          format: date-time
                  computedAt:
                    type: string
                    format: date-time
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: List current deterministic quote capabilities by destination
      tags:
        - duty-tax-quotes
  /api/{organizationId}/{projectId}/duty-tax-quotes/operations:
    get:
      operationId: DutyTaxQuotesController_getOperations
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Read duty and tax quote index and audit health
      tags:
        - duty-tax-quotes
  /api/{organizationId}/{projectId}/duty-tax-quotes/{quoteId}:
    get:
      operationId: DutyTaxQuotesController_getQuote
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            type: string
        - name: quoteId
          required: true
          in: path
          description: Quote ID
          schema:
            type: string
      responses:
        '200':
          description: ''
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Retrieve a previously calculated duty and tax quote
      tags:
        - duty-tax-quotes
  /api/{organizationId}/test-connection:
    post:
      description: >-
        Tests connectivity and validates credentials for the classification
        service at the organization level.
      operationId: ClassificationController_testConnection
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            example: 67ba83829325305a96501bd7
            type: string
      responses:
        '200':
          description: Connection successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    example: true
                  organizationId:
                    type: string
                    example: 67ba83829325305a96501bd7
                  timestamp:
                    type: number
                    example: 1732706438178
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Test API connectivity
      tags:
        - classification
  /api/{organizationId}/{projectId}/test-connection:
    post:
      description: >-
        Tests connectivity and validates credentials for the classification
        service at the project level.
      operationId: ClassificationController_testConnectionWithProject
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            example: 67ba83829325305a96501bd7
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            example: 6916042e20f14cecb9b6700e
            type: string
      responses:
        '200':
          description: Connection successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    example: true
                  organizationId:
                    type: string
                    example: 67ba83829325305a96501bd7
                  projectId:
                    type: string
                    example: 6916042e20f14cecb9b6700e
                  timestamp:
                    type: number
                    example: 1732706438178
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Test API connectivity for a project
      tags:
        - classification
  /api/{organizationId}/{projectId}/classify-batch:
    post:
      description: >-
        Classifies a batch of goods descriptions to determine their customs
        tariff numbers (HS codes).


        **Modes:**

        - **Synchronous (sync=true)**: For single items, returns the
        classification result directly in the response.

        - **Asynchronous (sync=false or multiple items)**: Returns a job ID
        immediately. Results are delivered via WebSocket events.


        **Tariff tree selection:**

        - By default, the tariff tree configured on the project's procedures is
        used.

        - Pass `tariffTreeId` to classify against a specific tree (a marketplace
        package tree or a tree belonging to the organization/project). Invalid
        or inaccessible IDs are rejected with 400.


        **WebSocket Events (async mode):**

        - `classification:progress` - Progress updates with processed/total
        counts

        - `classification:result` - Individual classification results

        - `classification:error` - Classification errors for specific items

        - `classification:complete` - Job completion notification


        **Classification Result includes:**

        - `tariffCode`: The 11-digit customs tariff number

        - `justification`: Short explanation of the classification

        - `reasoning`: Detailed classification reasoning (AV1-AV6 analysis)

        - `confidence`: Confidence score (0-1)

        - `alternatives`: Alternative classifications if applicable

        - `btis`: Related Binding Tariff Information references

        - `tariffNumberInfo`: Optional enriched tariff details when
        `includeTariffDetails=true`
      operationId: ClassificationController_classifyBatch
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            example: 67ba83829325305a96501bd7
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            example: 6916042e20f14cecb9b6700e
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClassifyBatchDto'
            examples:
              Single Item (Sync):
                summary: Classify a single item synchronously
                value:
                  clientId: excel-addin-client-123
                  items:
                    - Intel Core i9 processor for desktop computers
                  includeTariffDetails: true
                  tariffDetails:
                    alpha2Code: CN
                    includeFootnotes: true
                    includeHints: true
                    includeMeasures: true
                  sync: true
              Explicit Tariff Tree:
                summary: Classify against a specific tariff tree
                value:
                  clientId: excel-addin-client-123
                  items:
                    - Intel Core i9 processor for desktop computers
                  tariffTreeId: 68fc9b04139f8e74d596f1cc
                  sync: true
              Batch Processing:
                summary: Classify multiple items asynchronously
                value:
                  clientId: excel-addin-client-123
                  items:
                    - Intel Core i9 processor for desktop computers
                    - Cotton t-shirt, 100% organic cotton, mens size L
                    - Stainless steel kitchen knife, 20cm blade
                  sync: false
                  startIndex: 0
      responses:
        '202':
          description: Batch accepted for processing
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: Synchronous response (single item with sync=true)
                    properties:
                      mode:
                        type: string
                        example: sync
                      result:
                        type: object
                        properties:
                          tariffCode:
                            type: string
                            example: '84715000000'
                          justification:
                            type: string
                            example: >-
                              Processing unit with CPU, classified under heading
                              8471.
                          shortJustification:
                            type: string
                            example: Processing unit with CPU
                          confidence:
                            type: number
                            example: 0.92
                          fullReasoningId:
                            type: string
                            example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                          reasoning:
                            type: object
                            properties:
                              av1Analysis:
                                type: string
                              av6Analysis:
                                type: string
                              finalReasoning:
                                type: string
                          assumptionsMade:
                            type: array
                            items:
                              type: string
                          alternatives:
                            type: array
                            items:
                              type: object
                              properties:
                                tariffCode:
                                  type: string
                                  example: '10011900200'
                                assumptions:
                                  type: string
                          customsDescription:
                            type: string
                          headingDescription:
                            type: string
                          tariffNumberInfo:
                            type: object
                            description: >-
                              Enriched tariff details for the resolved code.
                              Only present when `includeTariffDetails=true` and
                              a tariff tree is configured for the project.
                              Individual sub-sections (measures, hints,
                              footnotes) are only populated when present in the
                              tariff tree for the resolved code.
                            properties:
                              inputTariffNumber:
                                type: string
                                example: '10019900400'
                              inputAlpha2Code:
                                type: string
                                nullable: true
                                description: >-
                                  Origin/destination country filter echoed from
                                  `tariffDetails.alpha2Code`.
                                example: US
                              directResult:
                                type: object
                                properties:
                                  code:
                                    type: string
                                    example: '10019900400'
                                  description:
                                    type: string
                                    example: Weichweizen mittlerer Qualität
                                  level:
                                    type: number
                                    example: 5
                                  path:
                                    type: string
                                    example: /10/1001/100191/100199/10019900400
                                  isLeaf:
                                    type: boolean
                                    example: true
                                  breadcrumbs:
                                    type: array
                                    items:
                                      type: string
                                    example:
                                      - GETREIDE
                                      - Weizen und Mengkorn
                                      - andere
                                      - andere
                                  footnoteIds:
                                    type: array
                                    items:
                                      type: string
                                    description: >-
                                      Footnote codes applicable to this node.
                                      Resolve via `references.footnotes`.
                                    example:
                                      - TN71
                                      - TN701
                                  hintIds:
                                    type: array
                                    items:
                                      type: string
                                    description: >-
                                      National hint codes (EZT). Resolved
                                      objects are provided in `resolvedHints`.
                                    example:
                                      - 250ANWL
                                      - '400013'
                                  measures:
                                    type: object
                                    description: >-
                                      Measures grouped by geographical area code
                                      (e.g. `1011` = ERGA OMNES, `4000` = EU,
                                      ISO alpha-2 like `US`). Resolve area codes
                                      via `references.geographicalAreas`.
                                    additionalProperties:
                                      type: array
                                      items:
                                        type: object
                                        properties:
                                          id:
                                            type: string
                                            example: c7ec2d8ad605
                                          measureTypeCode:
                                            type: string
                                            description: Resolve via `references.measureTypes`.
                                            example: '103'
                                          originType:
                                            type: string
                                            example: origin
                                          additionalCode:
                                            type: string
                                            nullable: true
                                            example: G3
                                          orderNumber:
                                            type: number
                                            nullable: true
                                            example: 94123
                                          dutyExpression:
                                            type: object
                                            nullable: true
                                            properties:
                                              type:
                                                type: string
                                                example: unparsed
                                              raw:
                                                type: string
                                                example: 95 EUR / TNE
                                          footnoteIds:
                                            type: array
                                            items:
                                              type: string
                                            example:
                                              - CD750
                                          exclusions:
                                            type: array
                                            items:
                                              type: object
                                              properties:
                                                excludedCountryCode:
                                                  type: string
                                                  example: RU
                                          conditions:
                                            type: array
                                            items:
                                              type: object
                                              properties:
                                                conditionCode:
                                                  type: string
                                                  description: Resolve via `references.conditionCodes`.
                                                  example: B
                                                sequence:
                                                  type: number
                                                  example: 1
                                                certificateCode:
                                                  type: string
                                                  nullable: true
                                                  example: C085
                                                conditionAmount:
                                                  type: string
                                                  example: '0'
                                                measureActionCode:
                                                  type: string
                                                  description: Resolve via `references.measureActions`.
                                                  example: '29'
                                                components:
                                                  type: array
                                                  items:
                                                    type: object
                                                    properties:
                                                      dutyExpressionId:
                                                        type: string
                                                        example: '01'
                                                      dutyExpression:
                                                        type: object
                                                        properties:
                                                          type:
                                                            type: string
                                                            example: unparsed
                                                          raw:
                                                            type: string
                                                            example: 95 EUR / TNE
                                  resolvedHints:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        code:
                                          type: string
                                          example: 250ANWL
                                        hintTypeId:
                                          type: string
                                          example: '250'
                                        hintId:
                                          type: string
                                          example: ANWL
                                        abbreviation:
                                          type: string
                                          example: HnH
                                        shortDescription:
                                          type: string
                                          example: >-
                                            Hinweise und Anmerkungen nationaler
                                            Herkunft (Einfuhr)
                                        description:
                                          type: string
                                          example: >-
                                            Hinweis auf Anweisung L unter Menüpunkt
                                            Texte
                                        tradeMovementCode:
                                          type: string
                                          example: '0'
                              autoFixResult:
                                type: object
                                nullable: true
                                description: >-
                                  Populated when the input tariff number had to
                                  be auto-corrected to a valid node; otherwise
                                  null.
                              references:
                                type: object
                                description: >-
                                  Lookup tables to resolve the codes referenced
                                  in `directResult`.
                                properties:
                                  footnotes:
                                    type: object
                                    additionalProperties:
                                      type: string
                                    example:
                                      TN71: >-
                                        Diese Beschreibung entspricht der
                                        Qualität gemäß der Definition in Anhang
                                        VI der Verordnung (EU) 2023/2834.
                                  certificates:
                                    type: object
                                    additionalProperties:
                                      type: object
                                      properties:
                                        certificateType:
                                          type: string
                                          example: C
                                        code:
                                          type: string
                                          example: '644'
                                        description:
                                          type: string
                                          example: >-
                                            Kontrollbescheinigung für
                                            ökologische/biologische Erzeugnisse
                                  measureActions:
                                    type: object
                                    additionalProperties:
                                      type: string
                                  conditionCodes:
                                    type: object
                                    additionalProperties:
                                      type: string
                                  measureTypes:
                                    type: object
                                    additionalProperties:
                                      type: string
                                  geographicalAreas:
                                    type: object
                                    additionalProperties:
                                      type: string
                              tariffTree:
                                type: object
                                properties:
                                  country:
                                    type: string
                                    example: DE
                                  id:
                                    type: string
                                    example: 6940a19c52673dae0065002e
                                  name:
                                    type: string
                                    example: DE Import (EZT) 2025-12-19
                  - type: object
                    description: Asynchronous response (batch processing)
                    properties:
                      mode:
                        type: string
                        example: async
                      accepted:
                        type: boolean
                        example: true
                      jobId:
                        type: string
                        example: >-
                          67ba83829325305a96501bd7:6916042e20f14cecb9b6700e:1732706438178
                      total:
                        type: number
                        example: 5
        '400':
          description: Invalid request parameters
        '402':
          description: Usage limit exceeded
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Classify goods descriptions
      tags:
        - classification
  /api/{organizationId}/{projectId}/trade-compliance/check:
    post:
      description: >-
        Performs comprehensive trade compliance checks for goods and/or parties.


        **Checks performed:**

        1. **Embargoes & Sanctions**: Checks destination countries and involved
        parties against global sanctions lists (UN, EU, US OFAC, etc.)

        2. **Export Controls**: Identifies dual-use goods (EU/US/CN), military
        items, and export license requirements

        3. **Import Controls**: Checks for import prohibitions, restrictions,
        and licensing requirements

        4. **CBAM**: Identifies if goods imported into the EU are subject to
        Carbon Border Adjustment Mechanism requirements

        5. **US Re-export Controls**: Checks if items are subject to US EAR
        re-export controls based on ECCN and origin

        6. **Party Screening**: Screens sender and recipient names against
        denied party lists


        **Risk Classification:**

        - 1: Low risk - No compliance issues found

        - 2: Medium risk - Some restrictions may apply

        - 3: High risk - Significant compliance concerns

        - 4: Critical risk - Transaction may be prohibited
      operationId: TradeComplianceController_checkCompliance
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            example: 67ba83829325305a96501bd7
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            example: 6916042e20f14cecb9b6700e
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TradeComplianceCheckDto'
            examples:
              Item Check:
                summary: Check a product for export controls
                value:
                  itemChecks:
                    - productDetails: >-
                        High-precision CNC milling machine with 5-axis
                        capability
                      customsTariffNumber: '8456301000'
                      countryOfOrigin: DE
                      shippingCountry: DE
                      destinationCountry: CN
              Party Check:
                summary: Screen parties against sanctions lists
                value:
                  partyChecks:
                    - name: Acme International Trading Co.
                      role: buyer
                      address: Shanghai, China
                    - name: Global Tech Exports Ltd.
                      role: exporter
                      address: Munich, Germany
              Combined Check:
                summary: Check both items and parties
                value:
                  itemChecks:
                    - productDetails: Industrial laser cutting system
                      customsTariffNumber: '8456100000'
                      destinationCountry: RU
                  partyChecks:
                    - name: Recipient Company
                      role: end_user
                      address: Moscow, Russia
      responses:
        '200':
          description: Compliance check completed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  title:
                    type: string
                    example: Trade Compliance Check
                  results:
                    type: object
                    properties:
                      partyChecks:
                        type: array
                        items:
                          type: object
                          properties:
                            item:
                              type: object
                              properties:
                                name:
                                  type: string
                                  example: Acme Corporation
                                role:
                                  type: string
                                  example: buyer
                            sanctionsHits:
                              type: array
                              items:
                                type: object
                            riskLevel:
                              type: string
                              example: low
                      itemChecks:
                        type: array
                        items:
                          type: object
                          properties:
                            item:
                              type: object
                              properties:
                                productDetails:
                                  type: string
                                  example: CNC milling machine
                                destinationCountry:
                                  type: string
                                  example: CN
                            embargoCheck:
                              type: object
                            exportControlCheck:
                              type: object
                            importControlCheck:
                              type: object
                            cbamCheck:
                              type: object
                      summary:
                        type: object
                        properties:
                          catchAllAnalysis:
                            type: object
                            properties:
                              wmdRelatedEndUse:
                                type: boolean
                                example: false
                              militaryEndUseInEmbargoedCountry:
                                type: boolean
                                example: false
                              militaryPartsMadeOutsideEU:
                                type: boolean
                                example: false
                              cyberSurveillanceHumanRightsRisk:
                                type: boolean
                                example: false
                              summary:
                                type: string
                          generalSummary:
                            type: string
                            example: No significant compliance issues identified.
                          riskClassification:
                            type: number
                            example: 1
                          riskReasoning:
                            type: string
                            example: Standard commercial transaction with no red flags.
        '400':
          description: Invalid request - at least one check type must be provided
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Perform trade compliance check
      tags:
        - trade-compliance
  /api/{organizationId}/{projectId}/trade-compliance/check-batch:
    post:
      description: >-
        Performs multiple trade compliance checks in parallel. Useful for
        processing multiple shipments or transactions at once.
            
        Each check in the batch can contain any combination of item and party
        checks. Results are returned in the same order as the input.
      operationId: TradeComplianceController_checkComplianceBatch
      parameters:
        - name: organizationId
          required: true
          in: path
          description: Organization ID
          schema:
            example: 67ba83829325305a96501bd7
            type: string
        - name: projectId
          required: true
          in: path
          description: Project ID
          schema:
            example: 6916042e20f14cecb9b6700e
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TradeComplianceBatchDto'
            examples:
              Multiple Shipments:
                summary: Check compliance for multiple shipments
                value:
                  clientId: batch-client-123
                  checks:
                    - itemChecks:
                        - productDetails: Electronic components
                          destinationCountry: CN
                      partyChecks:
                        - name: China Electronics Co.
                          role: buyer
                    - itemChecks:
                        - productDetails: Medical equipment
                          destinationCountry: IR
                      partyChecks:
                        - name: Tehran Medical Supplies
                          role: buyer
      responses:
        '200':
          description: Batch compliance checks completed
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    success:
                      type: boolean
                    title:
                      type: string
                    results:
                      type: object
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Perform multiple trade compliance checks in batch
      tags:
        - trade-compliance
  /api/public-tools/email-gate:
    post:
      operationId: PublicToolsController_emailGate
      parameters: []
      responses:
        '200':
          description: Gate result
      summary: Submit business email for free-tool access (Leads v2 + Brevo)
      tags:
        - Public Tools
  /api/public-tools/config:
    get:
      operationId: PublicToolsController_getConfig
      parameters: []
      responses:
        '200':
          description: Returns configuration for embeds
      summary: Get public tools configuration
      tags:
        - Public Tools
  /api/public-tools/tariff-classification:
    post:
      operationId: PublicToolsController_classifyGoods
      parameters: []
      responses:
        '201':
          description: ''
      summary: Classify goods for tariff code (public, email-entitled)
      tags:
        - Public Tools
  /api/public-tools/bti-search:
    post:
      operationId: PublicToolsController_searchBti
      parameters: []
      responses:
        '201':
          description: ''
      summary: Search BTI database (public, email-entitled)
      tags:
        - Public Tools
  /api/public-tools/bti-detail:
    get:
      operationId: PublicToolsController_getBtiDetail
      parameters:
        - name: reference
          required: true
          in: query
          schema:
            type: string
        - name: captchaToken
          required: true
          in: query
          schema:
            type: string
        - name: accessToken
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
      summary: Get BTI detail (does not consume entitlement)
      tags:
        - Public Tools
  /api/public-tools/trade-compliance-party-check:
    post:
      operationId: PublicToolsController_checkPartyCompliance
      parameters: []
      responses:
        '201':
          description: ''
      summary: Check party against sanctions lists (public, email-entitled)
      tags:
        - Public Tools
  /api/public-tools/trade-compliance-item-check:
    post:
      operationId: PublicToolsController_checkItemCompliance
      parameters: []
      responses:
        '201':
          description: ''
      summary: Check item for trade compliance (public, email-entitled)
      tags:
        - Public Tools
  /api/{organizationId}/{projectId}/cases/{caseId}/integration-responses/{integrationId}/poll:
    post:
      operationId: ManualResponsePollingController_pollResponse
      parameters:
        - name: organizationId
          required: true
          in: path
          description: ID of the organization
          schema:
            type: string
        - name: projectId
          required: true
          in: path
          description: ID of the project
          schema:
            type: string
        - name: caseId
          required: true
          in: path
          description: ID of the case
          schema:
            type: string
        - name: integrationId
          required: true
          in: path
          description: ID of the integration to poll
          schema:
            type: string
      responses:
        '200':
          description: Returns the response state for this case and integration.
      security:
        - bearer-auth: []
        - api-key-auth: []
        - x-api-key: []
      summary: Check an integration response for a case
      tags:
        - Integration Response Polling
info:
  title: Digicust V2 API
  description: >-
    # Digicust V2 Backend API Documentation


    ## Overview


    This is the comprehensive API documentation for the Digicust V2 customs
    management platform. The API provides endpoints for managing organizations,
    projects, cases, conversations, AI agent interactions, and various
    customs-related processes.


    ## Authentication


    The API supports two authentication methods. You can use **either** method
    to authenticate your requests:


    ### 1. JWT Bearer Token (native auth)


    **Recommended for:** Web applications, Excel add-in, user-facing
    applications


    This is the primary authentication method for interactive applications.
    Users sign in via Digicust native auth (email/password, SSO, or social) and
    receive a JWT access token.


    **How to use:**

    - Obtain a JWT via POST /api/auth/login (or SSO/social callback)

    - Include the token in the Authorization header: `Authorization: Bearer
    <your-jwt-token>`

    - Click the "Authorize" button (lock icon) in Swagger and select
    "bearer-auth"

    - Enter your JWT token (without the "Bearer" prefix)


    **Token format:** Digicust-issued JWT access token (sub = users._id)


    ### 2. API Key Authentication


    **Recommended for:** Server-to-server integrations, automation scripts,
    third-party integrations


    API keys are project-scoped credentials that can be used for programmatic
    access without user authentication.


    **How to use (Option A - Authorization header):**

    - Create an API key via the
    `/api/organizations/{organizationId}/projects/{projectId}/api-keys` endpoint

    - Include the API key in the Authorization header: `Authorization: Bearer
    dgc_<your-api-key>`

    - Click the "Authorize" button and select "api-key-auth"

    - Enter your API key in the format: `dgc_<your-key>`


    **How to use (Option B - X-API-Key header):**

    - Create an API key via the
    `/api/organizations/{organizationId}/projects/{projectId}/api-keys` endpoint

    - Include the API key in the X-API-Key header: `X-API-Key:
    dgc_<your-api-key>`

    - Click the "Authorize" button and select "x-api-key"

    - Enter your API key in the format: `dgc_<your-key>`


    **Key format:** All API keys start with the prefix `dgc_`


    **Important notes:**

    - API keys are scoped to a specific organization and project

    - API keys must be kept secure and should not be exposed in client-side code

    - You can create, list, revoke, and delete API keys using the API Keys
    endpoints

    - Only use one authentication method per request


    ## Features


    - **Case Management**: Create and manage customs cases

    - **AI Agent Integration**: Interact with AI agents for customs processing

    - **Document Processing**: Upload and process customs documents

    - **Conversation System**: Chat-based interface with AI agents

    - **Master Data**: Manage tariff trees, classifications, and procedures

    - **Excel Integration**: Excel add-in functionality

    - **Real-time Updates**: WebSocket support for live updates


    ## Deployment Information


    - **Version**: 2.0.0

    - **Build Time**: 2026-10-03T23:15:42.398Z

    - **Environment**: production

    - **Socket.IO**: Available at `/api/socket.io`

    - **API Prefix**: `/api` (all endpoints)


    ## Rate Limiting


    API endpoints are rate-limited to ensure fair usage and system stability.


    ## Support


    For API support, please contact the development team or refer to the
    technical documentation.
          
  version: 2.0.0
  contact: {}
tags:
  - name: Organizations
    description: Organization management
  - name: Projects
    description: Project management within organizations
  - name: Cases
    description: Case management and processing
  - name: Conversations
    description: Chat conversations with AI agents
  - name: Users
    description: User management and profiles
  - name: procedures
    description: Custom procedures and workflows
  - name: strategies
    description: AI agent strategies and configurations
  - name: tariff-trees
    description: Tariff classification trees
  - name: mappings
    description: Data mappings and transformations
  - name: reports
    description: Report generation and management
  - name: integrations
    description: Third-party integrations
  - name: Package Manager
    description: Package installation and management
  - name: classification
    description: Customs tariff classification services
  - name: trade-compliance
    description: Trade compliance checks (sanctions, export controls, embargoes)
servers: []
components:
  securitySchemes:
    bearer-auth:
      scheme: bearer
      bearerFormat: JWT
      type: http
      name: Authorization
      description: Enter your Digicust JWT access token (without "Bearer" prefix)
      in: header
    api-key-auth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication using Authorization header. Format: Bearer
        dgc_<your-api-key>
    x-api-key:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key authentication using X-API-Key header. Format:
        dgc_<your-api-key>
  schemas:
    RegisterDto:
      type: object
      properties:
        email:
          type: string
          example: user@example.com
        password:
          type: string
          example: SecurePassword123!
        name:
          type: string
          example: John Doe
        privacyPolicyAccepted:
          type: boolean
          example: true
      required:
        - email
        - password
        - name
        - privacyPolicyAccepted
    VerifyEmailDto:
      type: object
      properties:
        token:
          type: string
      required:
        - token
    ResendExpiredLinkDto:
      type: object
      properties:
        token:
          type: string
      required:
        - token
    LoginDto:
      type: object
      properties:
        email:
          type: string
          example: user@example.com
        password:
          type: string
          example: SecurePassword123!
      required:
        - email
        - password
    RefreshTokenDto:
      type: object
      properties:
        refreshToken:
          type: string
      required:
        - refreshToken
    ForgotPasswordDto:
      type: object
      properties:
        email:
          type: string
          example: user@example.com
      required:
        - email
    ResetPasswordDto:
      type: object
      properties:
        token:
          type: string
        newPassword:
          type: string
          example: NewSecurePassword123!
      required:
        - token
        - newPassword
    AcceptPrivacyPolicyDto:
      type: object
      properties:
        version:
          type: string
          example: '2025-01-10'
      required:
        - version
    SetupTotpDto:
      type: object
      properties:
        verificationCode:
          type: string
          example: '123456'
        secret:
          type: string
      required:
        - verificationCode
        - secret
    VerifyMfaDto:
      type: object
      properties:
        code:
          type: string
          example: '123456'
        method:
          type: string
          enum:
            - totp
            - email
        sessionToken:
          type: string
      required:
        - code
        - method
    UpdateOrgMfaSettingsDto:
      type: object
      properties: {}
    UpdateSsoConfigDto:
      type: object
      properties: {}
    UpdateScimConfigDto:
      type: object
      properties: {}
    UpdateAuditLogConfigDto:
      type: object
      properties: {}
    TestConnectionBodyDto:
      type: object
      properties:
        apiId:
          type: string
          description: Aircall API ID from Dashboard
        apiToken:
          type: string
          description: Aircall API Token from Dashboard
      required:
        - apiId
        - apiToken
    AircallTestConnectionResponseDto:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the connection was successful
        companyName:
          type: string
          description: Company name if connected
        usersCount:
          type: number
          description: Number of users in the company
        numbersCount:
          type: number
          description: Number of phone numbers
        error:
          type: string
          description: Error message if failed
      required:
        - success
    ListByCredentialsBodyDto:
      type: object
      properties:
        apiId:
          type: string
          description: Aircall API ID (optional, uses saved config if omitted)
        apiToken:
          type: string
          description: Aircall API Token (optional, uses saved config if omitted)
    DialBodyDto:
      type: object
      properties:
        phoneNumber:
          type: string
          description: Phone number to dial in E.164 format
        organizationId:
          type: string
          description: Deprecated workspace scope; ignored. Config resolves globally.
        projectId:
          type: string
          description: Deprecated workspace scope; ignored. Config resolves globally.
        userId:
          type: number
          description: Aircall user ID that will receive the dialer/call action
        numberId:
          type: number
          description: Number ID to use for the call
        immediate:
          type: boolean
          description: If true, start the call immediately. If false, fill the dialer only.
          default: false
      required:
        - phoneNumber
        - userId
    InsightCardContentDto:
      type: object
      properties:
        type:
          type: string
          description: Content type
          enum:
            - title
            - shortText
            - user
        text:
          type: string
          description: Text content (for title/shortText)
        label:
          type: string
          description: Label (for shortText/user)
        link:
          type: string
          description: Link URL
        user_id:
          type: number
          description: User ID (for user type)
      required:
        - type
    InsightCardBodyDto:
      type: object
      properties:
        contents:
          description: Insight card contents (max 10KB)
          type: array
          items:
            $ref: '#/components/schemas/InsightCardContentDto'
      required:
        - contents
    CommentBodyDto:
      type: object
      properties:
        content:
          type: string
          description: Comment content (max 1000 chars)
        organizationId:
          type: string
          description: Deprecated workspace scope; ignored. Config resolves globally.
        projectId:
          type: string
          description: Deprecated workspace scope; ignored. Config resolves globally.
      required:
        - content
    AircallCallActionBodyDto:
      type: object
      properties:
        organizationId:
          type: string
          description: Deprecated workspace scope; ignored. Config resolves globally.
        projectId:
          type: string
          description: Deprecated workspace scope; ignored. Config resolves globally.
    TagCallBodyDto:
      type: object
      properties:
        tagIds:
          description: Array of tag IDs to apply to the call
          type: array
          items:
            type: string
      required:
        - tagIds
    SetupWebhookBodyDto:
      type: object
      properties:
        events:
          description: Webhook events to subscribe to. If empty, subscribes to all events.
          type: array
          items:
            type: string
    AircallWebhookSetupResponseDto:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the webhook was set up successfully
        webhookId:
          type: string
          description: Webhook ID
        webhookToken:
          type: string
          description: Webhook token for verification
        error:
          type: string
          description: Error message if failed
      required:
        - success
    TariffDetailsDto:
      type: object
      properties:
        alpha2Code:
          type: string
          description: >-
            Country code used to filter applicable measures. For imports this is
            the origin country; for exports this is the destination country.
          example: CN
        dispatchCountry:
          type: string
          description: >-
            Dispatch country used for measures whose applicability depends on
            the shipping country.
          example: NL
        additionalCode:
          type: string
          description: Optional TARIC additional code used to filter measure applicability.
          example: '4099'
        includeMeasures:
          type: boolean
          description: Include tariff measures and duties in tariffNumberInfo.
          example: true
          default: true
        includeHints:
          type: boolean
          description: Include German EZT regulatory hints in tariffNumberInfo.
          example: true
          default: false
        includeFootnotes:
          type: boolean
          description: Include footnote references in tariffNumberInfo.
          example: true
          default: false
    ClassifyBatchDto:
      type: object
      properties:
        clientId:
          type: string
          description: >-
            Unique client identifier for WebSocket event routing. Used to
            receive async classification results.
          example: excel-addin-client-123
        items:
          description: >-
            Array of product descriptions to classify. Each description should
            contain relevant details like product name, materials, intended use,
            etc.
          example:
            - Intel Core i9 processor for desktop computers
            - Cotton t-shirt, 100% organic cotton
          type: array
          items:
            type: string
        sync:
          type: boolean
          description: >-
            When true and only one item is provided, returns the classification
            result synchronously. Otherwise, processing is asynchronous via
            WebSocket.
          example: true
          default: false
        includeTariffDetails:
          type: boolean
          description: >-
            When true, enriches each classification result with tariffNumberInfo
            containing applicable measures, duties, hints, and reference maps.
          example: true
          default: false
        tariffDetails:
          description: >-
            Optional filters and include controls for tariffNumberInfo when
            includeTariffDetails is true.
          allOf:
            - $ref: '#/components/schemas/TariffDetailsDto'
        tariffTreeId:
          type: string
          description: >-
            ID of the tariff tree to classify against. Must be a marketplace
            package tree or a tree belonging to the organization/project. When
            omitted, the tree configured on the project procedures is used.
          example: 68fc9b04139f8e74d596f1cc
        startIndex:
          type: number
          description: >-
            Starting index for batch processing. Useful for resuming or
            paginating large classification jobs. Results will reference indices
            starting from this value.
          example: 0
          default: 0
      required:
        - clientId
        - items
    FeedbackDto:
      type: object
      properties:
        content:
          type: string
          description: Feedback content text
        senderEmail:
          type: string
          description: Sender email address (for reply-to)
      required:
        - content
    ItemCheckDto:
      type: object
      properties:
        productDetails:
          type: string
          description: Detailed description of the product to check for trade compliance
          example: High-precision CNC milling machine with 5-axis capability
        customsTariffNumber:
          type: string
          description: The customs tariff number (HS code) of the product
          example: '8456301000'
        originCountry:
          type: string
          description: >-
            The origin country code (ISO 3166-1 alpha-2 or alpha-3; alpha-3
            auto-converted)
          example: DE
        shippingCountry:
          type: string
          description: >-
            The country code where the goods are being shipped from (alpha-2 or
            alpha-3)
          example: DE
        destinationCountry:
          type: string
          description: >-
            The destination country code where the goods are being shipped to
            (alpha-2 or alpha-3)
          example: CN
        dppRegistrationIdentifier:
          type: string
          description: >-
            EU Digital Product Passport unique registration identifier from the
            central EU registry (not the QR / product identifier)
    PartyCheckDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the party to check against sanctions lists
          example: Acme Corporation Ltd.
        role:
          type: string
          description: Role of the party in the transaction
          enum:
            - importer
            - exporter
            - buyer
            - seller
            - consignee
            - end_user
            - carrier
            - other
          example: buyer
          default: other
        alias:
          type: string
          description: >-
            Alternative name or alias to check if primary name returns no
            results
          example: ACME Corp
        address:
          type: string
          description: Address of the party for additional verification
          example: 123 Industrial Park, Shanghai, China
      required:
        - name
    TradeComplianceCheckDto:
      type: object
      properties:
        strategyId:
          type: string
          description: >-
            Strategy ID to determine the tariff tree from the associated
            procedure. If the strategy procedure has a tariff tree, it takes
            priority over scanning all project procedures.
          example: 67ba83829325305a96501bd7
        operationId:
          type: string
          deprecated: true
          description: >-
            Accepted for backward compatibility and not used to trigger Light
            billing.
          example: export-control-lite-1700000000000
        paymentMethod:
          type: string
          deprecated: true
          description: >-
            Accepted for backward compatibility and ignored by the standard tool
            path.
          enum:
            - light_operations
            - credits
        itemChecks:
          description: >-
            Array of items to check for comprehensive trade compliance (export
            control, import control, embargo, re-export, CBAM)
          type: array
          items:
            $ref: '#/components/schemas/ItemCheckDto'
        partyChecks:
          description: >-
            Array of parties involved in the transaction to check against
            sanctions lists
          type: array
          items:
            $ref: '#/components/schemas/PartyCheckDto'
    TradeComplianceBatchDto:
      type: object
      properties:
        clientId:
          type: string
          description: >-
            Unique client identifier for WebSocket event routing when processing
            asynchronously
          example: compliance-client-123
        checks:
          description: Array of compliance checks to perform
          type: array
          items:
            $ref: '#/components/schemas/TradeComplianceCheckDto'
      required:
        - clientId
        - checks
