> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corti.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Codes

> `Limited Access - Contact us for more information`<br/><br/>Generate codes within the context of an interaction.<br/><Note>This endpoint is only accessible within specific customer tenants. It is not available in the public API.<br/><br/>For stateless code prediction based on input text string or documentId, please refer to the [Predict Codes](/api-reference/codes/predict-codes) API, or [contact us](https://help.corti.app) for more information.</Note>



## OpenAPI

````yaml /api-reference/auto-generated-openapi.yml post /interactions/{id}/codes/
openapi: 3.0.0
info:
  title: Corti API
  version: 2.0.0
servers:
  - url: https://api.{environment}.corti.app/v2/
    variables:
      environment:
        default: eu
        enum:
          - us
          - eu
security:
  - AuthorizationHeader:
      - bearer
tags:
  - name: Interactions
  - name: Facts
  - name: Documents
  - name: Codes
  - name: Recordings
  - name: Transcripts
paths:
  /interactions/{id}/codes/:
    post:
      tags:
        - Codes (Legacy)
      summary: Generate Codes
      description: >-
        `Limited Access - Contact us for more information`<br/><br/>Generate
        codes within the context of an interaction.<br/><Note>This endpoint is
        only accessible within specific customer tenants. It is not available in
        the public API.<br/><br/>For stateless code prediction based on input
        text string or documentId, please refer to the [Predict
        Codes](/api-reference/codes/predict-codes) API, or [contact
        us](https://help.corti.app) for more information.</Note>
      parameters:
        - $ref: '#/components/parameters/Tenant-Name'
        - $ref: '#/components/parameters/CommonInteractionId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RequestCodesPredict'
        required: true
      responses:
        '200':
          description: List of predicted codes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseCodesList'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: RFC9457
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: RFC9457
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: RFC9457
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: RFC9457
        '504':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: RFC9457
components:
  parameters:
    Tenant-Name:
      name: Tenant-Name
      in: header
      description: >-
        Identifies a distinct entity within Corti's multi-tenant system. Ensures
        correct routing and authentication of the request.
      required: true
      example: base
      schema:
        type: string
        description: >-
          Identifies a distinct entity within Corti's multi-tenant system.
          Ensures correct routing and authentication of the request.
        example: base
    CommonInteractionId:
      name: id
      in: path
      description: The unique identifier of the interaction. Must be a valid UUID.
      required: true
      schema:
        $ref: '#/components/schemas/UUID'
  schemas:
    RequestCodesPredict:
      type: object
      required:
        - modelName
        - context
      properties:
        modelName:
          type: string
          description: The model name used for code predictions
          example: '"geography_modelName (Latest)" | "geography_modelName_version"'
        context:
          $ref: '#/components/schemas/CodesContext'
          type: object
          description: Context object containing type and data
        existingCodes:
          type: array
          description: List of pre-selected codes before interaction
          items:
            type: string
    ResponseCodesList:
      type: object
      properties:
        codes:
          type: array
          description: List of medical codes
          items:
            type: object
            properties:
              system:
                type: string
                description: The coding system used
                example: ICD-10
              code:
                type: string
                description: The medical code
                example: T933
              description:
                type: string
                description: Description of the medical code
              state:
                $ref: '#/components/schemas/CodesState'
                type: object
                description: State of the code
              additionalCodes:
                type: array
                description: List of additional codes
                items:
                  type: object
                  properties:
                    subsetName:
                      type: string
                      description: Category or subset of the additional code
                      example: orsakskoder
                    code:
                      type: string
                      description: The additional code
                      example: W0231
                    description:
                      type: string
                      description: Description of the additional code
                    state:
                      $ref: '#/components/schemas/CodesState'
                      type: object
                      description: State of the additional code
        usageInfo:
          $ref: '#/components/schemas/CommonUsageInfo'
          type: object
    ErrorResponse:
      type: object
      required:
        - requestid
        - status
        - type
        - detail
      properties:
        requestid:
          type: string
        status:
          type: integer
        type:
          type: string
        detail:
          type: string
        validationErrors:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
    UUID:
      type: string
      items: {}
      format: uuid
      example: f47ac10b-58cc-4372-a567-0e02b2c3d479
    CodesContext:
      type: object
      required:
        - type
        - data
      properties:
        type:
          $ref: '#/components/schemas/CodesContextTypeEnum'
        data:
          type: string
        metadata:
          type: string
    CodesState:
      type: object
      properties:
        isSelected:
          type: boolean
          description: Indicates whether the code is selected
        source:
          $ref: '#/components/schemas/CommonSourceEnum'
          description: Source of the predicted code
    CommonUsageInfo:
      type: object
      description: Credits consumed for this request.
      required:
        - creditsConsumed
      properties:
        creditsConsumed:
          type: number
    CodesContextTypeEnum:
      type: string
      enum:
        - string
        - documentId
    CommonSourceEnum:
      type: string
      enum:
        - core
        - system
        - user
  securitySchemes:
    AuthorizationHeader:
      type: http
      description: Input your token
      scheme: bearer

````