> ## 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.

# Preview generation context

> What a generation would be built from, before running it: the reference
documents it will use, the business rules it will apply, sensitive
columns, glossary-term coverage and sources failing data-quality checks.
Advisory only — nothing here blocks generating. Changes nothing.

**Required roles**: `nx1_semantic_modeller` or `nx1_semantic_admin`



## OpenAPI

````yaml post /api/semantic-models/generate/context
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/generate/context:
    post:
      tags:
        - Semantic models
      summary: Preview generation context
      description: |-
        What a generation would be built from, before running it: the reference
        documents it will use, the business rules it will apply, sensitive
        columns, glossary-term coverage and sources failing data-quality checks.
        Advisory only — nothing here blocks generating. Changes nothing.

        **Required roles**: `nx1_semantic_modeller` or `nx1_semantic_admin`
      operationId: preview_generation_context_api_semantic_models_generate_context_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SemanticContextPreviewRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SemanticContextPreviewResponse'
        '400':
          description: You provided neither `domain_name` nor `domain_urn`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No such domain.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    SemanticContextPreviewRequest:
      properties:
        domain_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain Name
          description: Domain name.
        domain_urn:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain Urn
          description: Domain URN.
        user_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: User Prompt
          description: The generation brief.
        include_tables:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Include Tables
        exclude_tables:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Exclude Tables
        documents:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 20
            - type: 'null'
          title: Documents
          description: Document URNs to use; omit to let it pick.
        business_rules:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 20
            - type: 'null'
          title: Business Rules
          description: Business rules as `workspace/key`.
      type: object
      title: SemanticContextPreviewRequest
      description: What a generation would be built from, before running it.
    SemanticContextPreviewResponse:
      properties:
        domain_name:
          type: string
          title: Domain Name
        domain_urn:
          type: string
          title: Domain Urn
        tables:
          items:
            type: string
          type: array
          title: Tables
        documents:
          items:
            $ref: '#/components/schemas/ContextDocument'
          type: array
          title: Documents
          description: The documents that will be used. Tell the user which.
        business_rules:
          items:
            $ref: '#/components/schemas/ContextBusinessRule'
          type: array
          title: Business Rules
        sensitive_columns:
          items:
            $ref: '#/components/schemas/SensitiveColumn'
          type: array
          title: Sensitive Columns
        columns_total:
          type: integer
          title: Columns Total
          default: 0
        columns_with_glossary_terms:
          type: integer
          title: Columns With Glossary Terms
          default: 0
        tables_with_failing_quality:
          items:
            type: string
          type: array
          title: Tables With Failing Quality
      type: object
      required:
        - domain_name
        - domain_urn
      title: SemanticContextPreviewResponse
      description: The context a generation would use. Nothing here blocks generating.
    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
    ContextDocument:
      properties:
        urn:
          type: string
          title: Urn
        title:
          type: string
          title: Title
        excerpts:
          items:
            type: string
          type: array
          title: Excerpts
      type: object
      required:
        - urn
        - title
      title: ContextDocument
    ContextBusinessRule:
      properties:
        ref:
          type: string
          title: Ref
        name:
          type: string
          title: Name
          default: ''
        version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version
        readable:
          type: boolean
          title: Readable
          description: False when it could not be read.
          default: true
        note:
          anyOf:
            - type: string
            - type: 'null'
          title: Note
      type: object
      required:
        - ref
      title: ContextBusinessRule
    SensitiveColumn:
      properties:
        table:
          type: string
          title: Table
        column:
          type: string
          title: Column
        labels:
          items:
            type: string
          type: array
          title: Labels
      type: object
      required:
        - table
        - column
        - labels
      title: SensitiveColumn
    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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.