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

# Deploy model

> Deploy an approved semantic model to Trino.

**Required role**: `nx1_semantic_admin`



## OpenAPI

````yaml post /api/semantic-models/{model_id}/deploy
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/semantic-models/{model_id}/deploy:
    post:
      tags:
        - Semantic models
      summary: Deploy model
      description: |-
        Deploy an approved semantic model to Trino.

        **Required role**: `nx1_semantic_admin`
      operationId: deploy_model_api_semantic_models__model_id__deploy_post
      parameters:
        - name: model_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Model Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModelDeploymentRequest'
      responses:
        '200':
          description: Model deployed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelDeploymentResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    ModelDeploymentRequest:
      properties:
        create_schedule:
          type: boolean
          title: Create Schedule
          description: Create an Airflow DAG for scheduled refresh.
          default: false
        schedule_cron:
          anyOf:
            - type: string
            - type: 'null'
          title: Schedule Cron
          description: Cron schedule. Required if `create_schedule=True`.
        register_in_datahub:
          type: boolean
          title: Register In Datahub
          description: Register the deployed view in DataHub.
          default: true
        add_lineage:
          type: boolean
          title: Add Lineage
          description: Add lineage from source tables.
          default: true
        create_dashboard:
          type: boolean
          title: Create Dashboard
          description: Create a Superset dashboard for the deployed model.
          default: true
      type: object
      title: ModelDeploymentRequest
      description: Request to deploy an approved model.
    ModelDeploymentResponse:
      properties:
        model_id:
          type: string
          format: uuid
          title: Model Id
        view_name:
          type: string
          title: View Name
        status:
          $ref: '#/components/schemas/SemanticModelStatus'
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: DataHub URN if registered.
        job_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Job Id
          description: Airflow job ID if scheduled.
        airflow_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Airflow Url
          description: Airflow DAG URL.
        dashboard:
          anyOf:
            - $ref: '#/components/schemas/DashboardInfo'
            - type: 'null'
          description: Superset dashboard info if created.
        deployed_at:
          type: string
          format: date-time
          title: Deployed At
        message:
          type: string
          title: Message
      type: object
      required:
        - model_id
        - view_name
        - status
        - deployed_at
        - message
      title: ModelDeploymentResponse
      description: Response for model deployment.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SemanticModelStatus:
      type: string
      enum:
        - draft
        - pending_review
        - approved
        - rejected
        - deployed
        - failed
        - archived
      title: SemanticModelStatus
      description: Status of a semantic model.
    DashboardInfo:
      properties:
        dashboard_id:
          type: integer
          title: Dashboard Id
          description: Superset dashboard ID.
        dashboard_url:
          type: string
          title: Dashboard Url
          description: URL to view the dashboard.
        embed_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Embed Url
          description: Embeddable URL.
        embed_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Embed Token
          description: Guest token for embedding.
        chart_ids:
          items:
            type: integer
          type: array
          title: Chart Ids
          description: Chart IDs in the dashboard.
      type: object
      required:
        - dashboard_id
        - dashboard_url
      title: DashboardInfo
      description: Dashboard information for a deployed semantic model.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````