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

# Rotate a share's key

> External: a new key, returned this once; the old one stops working at
once. Tenant: the recipient tenant claims a new key and swaps it into
its catalog (`remote` says whether it did); until it claims, the old
key keeps working.

**Required roles**: `nx1_catalog_admin` and a Data Access grant role



## OpenAPI

````yaml post /api/data-shares/{share_id}/rotate
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/{share_id}/rotate:
    post:
      tags:
        - Data shares
      summary: Rotate a share's key
      description: |-
        External: a new key, returned this once; the old one stops working at
        once. Tenant: the recipient tenant claims a new key and swaps it into
        its catalog (`remote` says whether it did); until it claims, the old
        key keeps working.

        **Required roles**: `nx1_catalog_admin` and a Data Access grant role
      operationId: rotate_share_api_data_shares__share_id__rotate_post
      parameters:
        - name: share_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-fA-F-]{36}$
            title: Share Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShareRotateResponse'
        '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:
    ShareRotateResponse:
      properties:
        profile:
          anyOf:
            - $ref: '#/components/schemas/ConnectionProfile'
            - type: 'null'
        remote:
          anyOf:
            - $ref: '#/components/schemas/RemoteSetupResult'
            - type: 'null'
      type: object
      title: ShareRotateResponse
    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
    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.