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

# Create a share

> Share a warehouse, read-only, as existing realm roles: the recipient
reads what those roles may read there. To another tenant (an
invitation, or set up there at once with `setup`) or an outside
organisation (a connection profile, returned this once).

**Required roles**: `nx1_catalog_admin` and `nx1_migration_admin` or `nx1_migration_ops`



## OpenAPI

````yaml post /api/data-shares
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-shares:
    post:
      tags:
        - Data shares
      summary: Create a share
      description: >-
        Share a warehouse, read-only, as existing realm roles: the recipient

        reads what those roles may read there. To another tenant (an

        invitation, or set up there at once with `setup`) or an outside

        organisation (a connection profile, returned this once).


        **Required roles**: `nx1_catalog_admin` and `nx1_migration_admin` or
        `nx1_migration_ops`
      operationId: create_share_api_data_shares_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShareCreateRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShareCreateResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Too Many Requests
        '502':
          description: Bad Gateway
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    ShareCreateRequest:
      properties:
        name:
          type: string
          maxLength: 200
          minLength: 3
          title: Name
        purpose:
          type: string
          maxLength: 2000
          title: Purpose
          default: ''
        recipient_kind:
          type: string
          enum:
            - tenant
            - external
          title: Recipient Kind
        recipient_name:
          type: string
          maxLength: 200
          minLength: 1
          title: Recipient Name
        recipient_url:
          type: string
          maxLength: 500
          title: Recipient Url
          default: ''
        recipient_contact:
          type: string
          maxLength: 320
          title: Recipient Contact
          default: ''
        warehouse:
          type: string
          pattern: ^[a-z0-9_][a-z0-9_-]{0,127}$
          title: Warehouse
        roles:
          items:
            type: string
          type: array
          maxItems: 20
          minItems: 1
          title: Roles
        expires_in_days:
          anyOf:
            - type: integer
              maximum: 730
              minimum: 1
            - type: 'null'
          title: Expires In Days
          default: 90
        setup:
          anyOf:
            - $ref: '#/components/schemas/RemoteSetup'
            - type: 'null'
      type: object
      required:
        - name
        - recipient_kind
        - recipient_name
        - warehouse
        - roles
      title: ShareCreateRequest
    ShareCreateResponse:
      properties:
        share:
          $ref: '#/components/schemas/ShareSummary'
        profile:
          anyOf:
            - $ref: '#/components/schemas/ConnectionProfile'
            - type: 'null'
        delivered:
          type: boolean
          title: Delivered
          default: false
        setup:
          anyOf:
            - $ref: '#/components/schemas/RemoteSetupResult'
            - type: 'null'
      type: object
      required:
        - share
      title: ShareCreateResponse
    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
    RemoteSetup:
      properties:
        access_key:
          type: string
          maxLength: 512
          minLength: 8
          title: Access Key
        catalog_name:
          type: string
          pattern: ^[a-z0-9_][a-z0-9_-]{0,127}$
          title: Catalog Name
      type: object
      required:
        - access_key
        - catalog_name
      title: RemoteSetup
      description: Set the share up in the recipient tenant now, as the caller there.
    ShareSummary:
      properties:
        id:
          type: string
          title: Id
        slug:
          type: string
          title: Slug
        name:
          type: string
          title: Name
        purpose:
          type: string
          title: Purpose
          default: ''
        recipient_kind:
          type: string
          title: Recipient Kind
        recipient_name:
          type: string
          title: Recipient Name
        recipient_url:
          type: string
          title: Recipient Url
          default: ''
        warehouse:
          type: string
          title: Warehouse
        roles:
          items:
            type: string
          type: array
          title: Roles
        tables:
          items:
            type: string
          type: array
          title: Tables
        status:
          type: string
          title: Status
        expires_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Expires At
        expires_soon:
          type: boolean
          title: Expires Soon
          default: false
        owner:
          type: string
          title: Owner
        created_at:
          type: string
          title: Created At
        key_hint:
          type: string
          title: Key Hint
          default: ''
        last_read_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Read At
      type: object
      required:
        - id
        - slug
        - name
        - recipient_kind
        - recipient_name
        - warehouse
        - status
        - owner
        - created_at
      title: ShareSummary
    ConnectionProfile:
      properties:
        nx1_share:
          type: integer
          title: Nx1 Share
          default: 1
        share:
          type: string
          title: Share
        share_id:
          type: string
          title: Share Id
        provider:
          type: string
          title: Provider
        endpoint:
          type: string
          title: Endpoint
        warehouse:
          type: string
          title: Warehouse
        token_endpoint:
          type: string
          title: Token Endpoint
        client_id:
          type: string
          title: Client Id
        client_secret:
          type: string
          title: Client Secret
        scope:
          type: string
          title: Scope
          default: catalog
        expires_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Expires At
      type: object
      required:
        - share
        - share_id
        - provider
        - endpoint
        - warehouse
        - token_endpoint
        - client_id
        - client_secret
      title: ConnectionProfile
      description: Everything an Iceberg REST client needs. Shown once.
    RemoteSetupResult:
      properties:
        ok:
          type: boolean
          title: Ok
        catalog_name:
          type: string
          title: Catalog Name
          default: ''
        tables_visible:
          anyOf:
            - type: integer
            - type: 'null'
          title: Tables Visible
        message:
          type: string
          title: Message
          default: ''
      type: object
      required:
        - ok
      title: RemoteSetupResult
  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.