> ## 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 or update many Ranger policies in one request



## OpenAPI

````yaml post /api/govern/data-access/policies/bulk
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/govern/data-access/policies/bulk:
    post:
      tags:
        - Policy Management
      summary: Create or update many Ranger policies in one request
      operationId: create_policies_bulk_api_govern_data_access_policies_bulk_post
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_create_policies_bulk_api_govern_data_access_policies_bulk_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkPolicyCreateResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    Body_create_policies_bulk_api_govern_data_access_policies_bulk_post:
      properties:
        rows:
          anyOf:
            - type: string
            - type: 'null'
          title: Rows
          description: JSON array of PolicyRow
        excel_file:
          anyOf:
            - type: string
              contentMediaType: application/octet-stream
            - type: 'null'
          title: Excel File
      type: object
      title: Body_create_policies_bulk_api_govern_data_access_policies_bulk_post
    BulkPolicyCreateResponse:
      properties:
        total:
          type: integer
          title: Total
          description: >-
            Total result lines — equals created + updated + failed. A
            multi-database row contributes one line per derived policy, so this
            may exceed the number of submitted rows.
        created:
          type: integer
          title: Created
        updated:
          type: integer
          title: Updated
        failed:
          type: integer
          title: Failed
        results:
          items:
            $ref: '#/components/schemas/BulkPolicyResult'
          type: array
          title: Results
      type: object
      required:
        - total
        - created
        - updated
        - failed
        - results
      title: BulkPolicyCreateResponse
      description: Aggregate response for the bulk-create endpoint.
    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
    BulkPolicyResult:
      properties:
        row_index:
          type: integer
          title: Row Index
          description: Original 0-based row index in the submitted batch.
        name:
          type: string
          title: Name
          description: >-
            Policy name from the submitted row (may be empty if the row failed
            before parsing).
        status:
          type: string
          enum:
            - created
            - updated
            - failed
          title: Status
        policy_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Policy Id
          description: Ranger policy ID on success.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Error message on failure.
      type: object
      required:
        - row_index
        - name
        - status
      title: BulkPolicyResult
      description: One row's outcome in a bulk-create response.
  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

````