openapi: 3.0.1
info:
  title: Context API
  version: v1
servers:
  - url: https://knowledge-enrichment.ai.experience.hyland.com/latest/api/context-enrichment
paths:
  /api/content/process:
    post:
      tags:
        - ContentProcessing
      summary: Process content asynchronously.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProcessContentInput'
          text/json:
            schema:
              $ref: '#/components/schemas/ProcessContentInput'
          application/*+json:
            schema:
              $ref: '#/components/schemas/ProcessContentInput'
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ContentProcessingRequestResult'
            application/json:
              schema:
                $ref: '#/components/schemas/ContentProcessingRequestResult'
            text/json:
              schema:
                $ref: '#/components/schemas/ContentProcessingRequestResult'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: Internal Server Error
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  '/api/content/process/{id}/results':
    get:
      tags:
        - ContentProcessing
      summary: Get content processing results.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ContentsProcessingResults'
            application/json:
              schema:
                $ref: '#/components/schemas/ContentsProcessingResults'
            text/json:
              schema:
                $ref: '#/components/schemas/ContentsProcessingResults'
        '404':
          description: Not Found
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '202':
          description: Accepted
  /api/content/process/actions:
    get:
      tags:
        - ContentProcessing
      summary: Get available process content actions.
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: array
                items:
                  type: string
            application/json:
              schema:
                type: array
                items:
                  type: string
            text/json:
              schema:
                type: array
                items:
                  type: string
  /api/files/upload/presigned-url:
    get:
      tags:
        - Files
      summary: Get a presigned URL for uploading a file.
      parameters:
        - name: contentType
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/PresignedUrlResult'
            application/json:
              schema:
                $ref: '#/components/schemas/PresignedUrlResult'
            text/json:
              schema:
                $ref: '#/components/schemas/PresignedUrlResult'
        '400':
          description: Bad Request
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /health:
    get:
      tags:
        - Health
      summary: Check the health of the service.
      responses:
        '200':
          description: OK
components:
  schemas:
    ContentProcessingRequestResult:
      type: object
      properties:
        processingId:
          type: string
          nullable: true
      additionalProperties: false
    ContentProcessingResult:
      type: object
      properties:
        objectKey:
          type: string
          nullable: true
        imageDescription:
          $ref: '#/components/schemas/StringProcessingResult'
        imageMetadata:
          $ref: '#/components/schemas/StringObjectDictionaryProcessingResult'
        textMetadata:
          $ref: '#/components/schemas/StringObjectDictionaryProcessingResult'
        textSummary:
          $ref: '#/components/schemas/StringProcessingResult'
        textClassification:
          $ref: '#/components/schemas/StringProcessingResult'
        imageClassification:
          $ref: '#/components/schemas/StringProcessingResult'
        textEmbeddings:
          $ref: '#/components/schemas/SingleListListProcessingResult'
        imageEmbeddings:
          $ref: '#/components/schemas/SingleListProcessingResult'
        generalProcessingErrors:
          type: array
          items:
            $ref: '#/components/schemas/ProcessingError'
          nullable: true
        namedEntityText:
          $ref: '#/components/schemas/StringStringListDictionaryProcessingResult'
        namedEntityImage:
          $ref: '#/components/schemas/StringStringListDictionaryProcessingResult'
      additionalProperties: false
    ContentsProcessingResults:
      required:
        - inProgress
        - results
      type: object
      properties:
        id:
          type: string
          format: uuid
        timestamp:
          type: string
          format: date-time
        results:
          type: array
          items:
            $ref: '#/components/schemas/ContentProcessingResult'
          nullable: true
        status:
          type: string
          nullable: true
        inProgress:
          type: boolean
      additionalProperties: false
    PresignedUrlResult:
      type: object
      properties:
        presignedUrl:
          type: string
          nullable: true
        objectKey:
          type: string
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: { }
    ProcessContentInput:
      required:
        - actions
        - objectKeys
      type: object
      properties:
        objectKeys:
          type: array
          items:
            type: string
          nullable: true
        actions:
          type: array
          items:
            type: string
          nullable: true
        classes:
          type: array
          items:
            type: string
          nullable: true
        maxWordCount:
          type: integer
          format: int32
          nullable: true
        kSimilarMetadata:
          type: array
          items:
            type: object
            additionalProperties: { }
          nullable: true
      additionalProperties: false
    ProcessingError:
      type: object
      properties:
        errorType:
          $ref: '#/components/schemas/ProcessingErrorType'
        message:
          type: string
          nullable: true
      additionalProperties: false
    ProcessingErrorType:
      enum:
        - LambdaError
        - Timeout
        - ValidationError
        - LambdaResponse
        - UnexpectedError
      type: string
    SingleListListProcessingResult:
      type: object
      properties:
        isSuccess:
          type: boolean
          nullable: true
          readOnly: true
        result:
          type: array
          items:
            type: array
            items:
              type: number
              format: float
          nullable: true
        error:
          $ref: '#/components/schemas/ProcessingError'
      additionalProperties: false
    SingleListProcessingResult:
      type: object
      properties:
        isSuccess:
          type: boolean
          nullable: true
          readOnly: true
        result:
          type: array
          items:
            type: number
            format: float
          nullable: true
        error:
          $ref: '#/components/schemas/ProcessingError'
      additionalProperties: false
    StringObjectDictionaryProcessingResult:
      type: object
      properties:
        isSuccess:
          type: boolean
          nullable: true
          readOnly: true
        result:
          type: object
          additionalProperties:
            nullable: true
          nullable: true
        error:
          $ref: '#/components/schemas/ProcessingError'
      additionalProperties: false
    StringProcessingResult:
      type: object
      properties:
        isSuccess:
          type: boolean
          nullable: true
          readOnly: true
        result:
          type: string
          nullable: true
        error:
          $ref: '#/components/schemas/ProcessingError'
      additionalProperties: false
    StringStringListDictionaryProcessingResult:
      type: object
      properties:
        isSuccess:
          type: boolean
          nullable: true
          readOnly: true
        result:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
            nullable: true
          nullable: true
        error:
          $ref: '#/components/schemas/ProcessingError'
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
security:
  - Bearer: [ ]