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

# Start a Data API from a semantic model or a table

> Creates the API and its first draft, described from DataHub and the model.



## OpenAPI

````yaml post /api/data-apis
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/data-apis:
    post:
      tags:
        - Data APIs
      summary: Start a Data API from a semantic model or a table
      description: >-
        Creates the API and its first draft, described from DataHub and the
        model.
      operationId: create_data_api_api_data_apis_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDataApiRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataApiDetail'
        '400':
          description: Invalid request.
        '403':
          description: Not allowed.
        '404':
          description: No such API or version.
        '409':
          description: Conflicts with the API's state.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too many of your queries are running; see Retry-After.
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    CreateDataApiRequest:
      properties:
        name:
          type: string
          title: Name
          description: 'URL name: lowercase letters, digits, _.'
        title:
          type: string
          title: Title
          default: ''
        description:
          type: string
          title: Description
          default: ''
        source_kind:
          $ref: '#/components/schemas/SourceKind-Input'
        source_id:
          type: string
          title: Source Id
          description: Semantic model id, or a table as catalog.schema.table.
      type: object
      required:
        - name
        - source_kind
        - source_id
      title: CreateDataApiRequest
      description: Start a Data API from an existing asset. Creates its first draft.
    DataApiDetail:
      properties:
        name:
          type: string
          title: Name
        title:
          type: string
          title: Title
        description:
          type: string
          title: Description
        owner:
          type: string
          title: Owner
        source_kind:
          $ref: '#/components/schemas/api__models__data_api_models__SourceKind'
        source_id:
          type: string
          title: Source Id
        source_table:
          type: string
          title: Source Table
        source_label:
          type: string
          title: Source Label
        domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain
        latest_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Latest Version
          description: Newest published version.
        has_draft:
          type: boolean
          title: Has Draft
          default: false
        can_edit:
          type: boolean
          title: Can Edit
          default: false
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        versions:
          items:
            $ref: '#/components/schemas/DataApiVersionSummary'
          type: array
          title: Versions
        endpoint_path:
          type: string
          title: Endpoint Path
          description: e.g. /api/data/orders_daily/v2
      type: object
      required:
        - name
        - title
        - description
        - owner
        - source_kind
        - source_id
        - source_table
        - source_label
        - created_at
        - updated_at
        - versions
        - endpoint_path
      title: DataApiDetail
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SourceKind-Input:
      type: string
      enum:
        - semantic_model
        - table
      title: SourceKind
      description: What a Data API reads.
    api__models__data_api_models__SourceKind:
      type: string
      enum:
        - semantic_model
        - table
      title: SourceKind
      description: What a Data API reads.
    DataApiVersionSummary:
      properties:
        version:
          type: integer
          title: Version
        status:
          $ref: '#/components/schemas/api__models__data_api_models__VersionStatus'
        context_hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Context Hash
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
        created_at:
          type: string
          format: date-time
          title: Created At
        published_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Published By
        published_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Published At
        retired_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Retired At
      type: object
      required:
        - version
        - status
        - created_at
      title: DataApiVersionSummary
    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
    api__models__data_api_models__VersionStatus:
      type: string
      enum:
        - draft
        - published
        - retired
      title: VersionStatus
      description: A version's lifecycle. Only ``draft`` can be edited.
  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.