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

# Run a function over a sample of an Iceberg table

> Read a sample of an Iceberg table on your Spark session, as you, and run
the function over it. Nothing is stored; the rows come back to you only.

**Required roles**: `simulator`, `author`, `approver` or `workspace_admin`



## OpenAPI

````yaml post /api/decisions/{workspace}/functions/{name}/try
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/decisions/{workspace}/functions/{name}/try:
    post:
      tags:
        - Decision functions
      summary: Run a function over a sample of an Iceberg table
      description: >-
        Read a sample of an Iceberg table on your Spark session, as you, and run

        the function over it. Nothing is stored; the rows come back to you only.


        **Required roles**: `simulator`, `author`, `approver` or
        `workspace_admin`
      operationId: >-
        try_function_on_table_api_decisions__workspace__functions__name__try_post
      parameters:
        - name: workspace
          in: path
          required: true
          schema:
            type: string
            maxLength: 64
            pattern: ^[a-z0-9][a-z0-9-]{0,63}$
            description: Workspace slug.
            title: Workspace
          description: Workspace slug.
        - name: name
          in: path
          required: true
          schema:
            type: string
            maxLength: 64
            pattern: ^[a-z][a-z0-9_]{0,63}$
            description: Function name — a Python identifier.
            title: Name
          description: Function name — a Python identifier.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TryOnTableRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TryOnTableResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    TryOnTableRequest:
      properties:
        version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version
        spec:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Spec
        table:
          type: string
          pattern: ^[A-Za-z0-9_]+\.[A-Za-z0-9_]+\.[A-Za-z0-9_]+$
          title: Table
          description: catalog.schema.table to sample, read as you.
        columns:
          additionalProperties:
            type: string
          type: object
          maxProperties: 64
          title: Columns
          description: >-
            Which table column feeds each column parameter (scalar/aggregate) or
            input column (table). Unmapped names are read from a column of the
            same name.
        args:
          additionalProperties: true
          type: object
          maxProperties: 64
          title: Args
          description: The const arguments.
        limit:
          type: integer
          maximum: 1000
          minimum: 1
          title: Limit
          default: 50
      type: object
      required:
        - table
      title: TryOnTableRequest
    TryOnTableResponse:
      properties:
        workspace:
          type: string
          title: Workspace
        name:
          type: string
          title: Name
        table:
          type: string
          title: Table
        rows:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Rows
          description: The sampled input rows.
        result:
          title: Result
        result_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Result Type
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        truncated:
          type: boolean
          title: Truncated
          description: A table function's output was cut at 500 rows.
          default: false
        spark_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Spark Version
      type: object
      required:
        - workspace
        - name
        - table
      title: TryOnTableResponse
    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
  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.