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

# Creates data products

> Creates a new data product based on the provided query, domain, suggestion ID, or query ID.



## OpenAPI

````yaml post /api/dataproduct
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/dataproduct:
    post:
      tags:
        - Data products
      summary: Creates data products
      description: >-
        Creates a new data product based on the provided query, domain,
        suggestion ID, or query ID.
      operationId: create_dataproduct_api_dataproduct_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateViewRequest'
        required: true
      responses:
        '200':
          description: View created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateViewResponse'
        '400':
          description: Bad Request
          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:
    CreateViewRequest:
      properties:
        role_name:
          type: string
          title: Role Name
          description: Name of the role associated with this view.
        name:
          type: string
          title: Name
          description: Name of the view to create.
        domain_urn:
          anyOf:
            - type: string
            - type: 'null'
          title: Domain Urn
          description: URN of the domain where the view belongs.
        query:
          anyOf:
            - type: string
            - type: 'null'
          title: Query
          description: SQL query for creating the view.
        suggestion_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Suggestion Id
          description: ID of the suggested query to base the view on.
        query_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Query Id
          description: ID of an existing query to base the view on.
        is_view:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is View
          description: Indicates if the object to create is a view.
      type: object
      required:
        - role_name
        - name
      title: CreateViewRequest
    CreateViewResponse:
      properties:
        view_id:
          type: string
          format: uuid
          title: View Id
          description: Unique ID of the created view.
        view_name:
          type: string
          title: View Name
          description: Name of the created view.
        preshared_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Preshared Key
          description: Pre-shared key associated with the view, if applicable.
        preshared_key_valid_until:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Preshared Key Valid Until
          description: Expiration date and time of the pre-shared key.
      type: object
      required:
        - view_id
        - view_name
      title: CreateViewResponse
    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
    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

````