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

# Compare two versions of a function

> What changed between two versions: the fields, a diff of the code,
whether existing calls still work and whether it computes differently.

**Required roles**: any role in the workspace



## OpenAPI

````yaml post /api/decisions/{workspace}/functions/{name}/diff
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}/diff:
    post:
      tags:
        - Decision functions
      summary: Compare two versions of a function
      description: |-
        What changed between two versions: the fields, a diff of the code,
        whether existing calls still work and whether it computes differently.

        **Required roles**: any role in the workspace
      operationId: diff_function_api_decisions__workspace__functions__name__diff_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.
        - name: from_version
          in: query
          required: true
          schema:
            type: integer
            minimum: 1
            title: From Version
        - name: to_version
          in: query
          required: true
          schema:
            type: integer
            minimum: 1
            title: To Version
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FunctionDiffResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    FunctionDiffResponse:
      properties:
        workspace:
          type: string
          title: Workspace
        name:
          type: string
          title: Name
        from_version:
          type: integer
          title: From Version
        to_version:
          type: integer
          title: To Version
        identical:
          type: boolean
          title: Identical
        changed_fields:
          items:
            type: string
          type: array
          title: Changed Fields
        code_diff:
          type: string
          title: Code Diff
        signature_compatible:
          type: boolean
          title: Signature Compatible
        computes_differently:
          type: boolean
          title: Computes Differently
      type: object
      required:
        - workspace
        - name
        - from_version
        - to_version
        - identical
        - changed_fields
        - code_diff
        - signature_compatible
        - computes_differently
      title: FunctionDiffResponse
    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
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  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.