> ## 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's tests on your Spark

> Run the spec's tests, edge cases, a reordering check and a declarative
pipeline dry run on your Kyuubi Spark session, as you. 409 while the
session is starting (see `/spark-connect/session`).

A saved version's result is stored on it for its reviewer to see. An
unsaved spec's result is only returned.

**Required roles**: `simulator`, `author`, `approver` or `workspace_admin`
(an unsaved spec: `author` or `workspace_admin`)



## OpenAPI

````yaml post /api/decisions/{workspace}/functions/{name}/simulate
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}/simulate:
    post:
      tags:
        - Decision functions
      summary: Run a function's tests on your Spark
      description: >-
        Run the spec's tests, edge cases, a reordering check and a declarative

        pipeline dry run on your Kyuubi Spark session, as you. 409 while the

        session is starting (see `/spark-connect/session`).


        A saved version's result is stored on it for its reviewer to see. An

        unsaved spec's result is only returned.


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

        (an unsaved spec: `author` or `workspace_admin`)
      operationId: >-
        simulate_function_api_decisions__workspace__functions__name__simulate_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/SimulateFunctionRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimulateFunctionResponse'
        '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:
    SimulateFunctionRequest:
      properties:
        version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version
          description: A saved version to simulate. The result is stored on it.
        spec:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Spec
          description: An unsaved spec to simulate instead. Nothing is stored.
        include_edges:
          type: boolean
          title: Include Edges
          default: true
        include_pipeline:
          type: boolean
          title: Include Pipeline
          description: Also dry-run it inside a declarative pipeline.
          default: true
      type: object
      title: SimulateFunctionRequest
    SimulateFunctionResponse:
      properties:
        workspace:
          type: string
          title: Workspace
        name:
          type: string
          title: Name
        version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version
        stored:
          type: boolean
          title: Stored
          default: false
        report:
          additionalProperties: true
          type: object
          title: Report
      type: object
      required:
        - workspace
        - name
        - report
      title: SimulateFunctionResponse
    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.