Snowflake Function API

The Snowflake Function API is a REST API that allows caller to create, execute and drop functions in a Snowflake database.

OpenAPI Specification

function.yaml Raw ↑
openapi: 3.0.0
servers:
- description: Snowflake REST Server
  url: https://org-account.snowflakecomputing.com
info:
  version: 0.0.1
  title: Snowflake Function API
  description: The Snowflake Function API is a REST API that allows caller to create, execute and drop functions in a Snowflake database.
  contact:
    name: Snowflake, Inc.
    url: https://snowflake.com
    email: support@snowflake.com
paths:
  /api/v2/databases/{database}/schemas/{schema}/functions:
    get:
      summary: List Functions
      tags:
      - function
      description: Lists the user functions under the database and schema.
      operationId: listFunctions
      parameters:
      - $ref: common.yaml#/components/parameters/database
      - $ref: common.yaml#/components/parameters/schema
      - $ref: common.yaml#/components/parameters/like
      responses:
        '200':
          description: successful
          headers:
            X-Snowflake-Request-ID:
              $ref: common.yaml#/components/headers/X-Snowflake-Request-ID
            Link:
              $ref: common.yaml#/components/headers/Link
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Function'
              examples:
                Listfunctions200Example:
                  summary: Default listFunctions 200 response
                  x-microcks-default: true
                  value:
                  - function_type: example_value
                    name: Example Title
                    arguments:
                    - {}
                    returns: FIXED
                    max_batch_rows: 10
                    created_on: '2026-01-15T10:30:00Z'
                    signature: example_value
                    language: example_value
                    body: example_value
        '202':
          $ref: common.yaml#/components/responses/202SuccessAcceptedResponse
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      summary: Create a Function
      tags:
      - function
      description: Create a function.
      operationId: createFunction
      parameters:
      - $ref: common.yaml#/components/parameters/database
      - $ref: common.yaml#/components/parameters/schema
      - $ref: common.yaml#/components/parameters/createMode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Function'
            examples:
              CreatefunctionRequestExample:
                summary: Default createFunction request
                x-microcks-default: true
                value:
                  function_type: example_value
                  name: Example Title
                  arguments:
                  - name: Example Title
                    datatype: FIXED
                    value: example_value
                  returns: FIXED
                  max_batch_rows: 10
                  created_on: '2026-01-15T10:30:00Z'
                  signature: example_value
                  language: example_value
                  body: example_value
      responses:
        '200':
          $ref: common.yaml#/components/responses/200SuccessResponse
        '202':
          $ref: common.yaml#/components/responses/202SuccessAcceptedResponse
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '408':
          $ref: common.yaml#/components/responses/408RequestTimeout
        '409':
          $ref: common.yaml#/components/responses/409Conflict
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api/v2/databases/{database}/schemas/{schema}/functions/{nameWithArgs}:
    get:
      summary: Fetch a Function.
      tags:
      - function
      description: Fetch a Function using the describe command output.
      operationId: fetchFunction
      parameters:
      - $ref: common.yaml#/components/parameters/database
      - $ref: common.yaml#/components/parameters/schema
      - $ref: common.yaml#/components/parameters/nameWithArgs
      responses:
        '200':
          description: successful
          headers:
            X-Snowflake-Request-ID:
              $ref: common.yaml#/components/headers/X-Snowflake-Request-ID
            Link:
              $ref: common.yaml#/components/headers/Link
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Function'
              examples:
                Fetchfunction200Example:
                  summary: Default fetchFunction 200 response
                  x-microcks-default: true
                  value:
                    function_type: example_value
                    name: Example Title
                    arguments:
                    - name: Example Title
                      datatype: FIXED
                      value: example_value
                    returns: FIXED
                    max_batch_rows: 10
                    created_on: '2026-01-15T10:30:00Z'
                    signature: example_value
                    language: example_value
                    body: example_value
        '202':
          $ref: common.yaml#/components/responses/202SuccessAcceptedResponse
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      parameters:
      - $ref: common.yaml#/components/parameters/database
      - $ref: common.yaml#/components/parameters/schema
      - $ref: common.yaml#/components/parameters/nameWithArgs
      - $ref: common.yaml#/components/parameters/ifExists
      summary: Delete a Function
      tags:
      - function
      description: Delete a function with the given name and args.
      operationId: deleteFunction
      responses:
        '200':
          $ref: common.yaml#/components/responses/200SuccessResponse
        '202':
          $ref: common.yaml#/components/responses/202SuccessAcceptedResponse
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api/v2/databases/{database}/schemas/{schema}/functions/{name}:execute:
    post:
      summary: Execute a Function.
      tags:
      - function
      description: Execute a Function.
      operationId: executeFunction
      parameters:
      - $ref: common.yaml#/components/parameters/database
      - $ref: common.yaml#/components/parameters/schema
      - $ref: common.yaml#/components/parameters/name
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FunctionArguments'
            examples:
              ExecutefunctionRequestExample:
                summary: Default executeFunction request
                x-microcks-default: true
                value:
                - name: Example Title
                  datatype: FIXED
                  value: example_value
      responses:
        '200':
          description: successful
          headers:
            X-Snowflake-Request-ID:
              $ref: common.yaml#/components/headers/X-Snowflake-Request-ID
          content:
            application/json:
              schema:
                type: object
              examples:
                Executefunction200Example:
                  summary: Default executeFunction 200 response
                  x-microcks-default: true
                  value: {}
        '202':
          $ref: common.yaml#/components/responses/202SuccessAcceptedResponse
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    Function:
      type: object
      description: A Snowflake function
      discriminator:
        propertyName: function_type
        mapping:
          service-function: '#/components/schemas/ServiceFunction'
      properties:
        function_type:
          type: string
          default: service-function
          example: example_value
        name:
          type: string
          description: Specifies the name for the function, must be unique for the schema in which the function is created
          example: Example Title
        arguments:
          type: array
          items:
            $ref: '#/components/schemas/FunctionArgument'
          example: []
        returns:
          type: string
          description: Specifies the type for the function return value.
          enum:
          - FIXED
          - INT
          - REAL
          - NUMBER
          - TEXT
          - BOOLEAN
          - DATE
          - TIME
          - TIMESTAMP_TZ
          - TIMESTAMP_LTZ
          - TIMESTAMP_NTZ
          default: TEXT
          example: FIXED
        max_batch_rows:
          type: integer
          description: Specifies the max rows for batch operation.
          example: 10
        created_on:
          type: string
          format: date-time
          description: Date and time when the function was created.
          example: '2026-01-15T10:30:00Z'
        signature:
          type: string
          description: Function's arguments.
          example: example_value
        language:
          type: string
          description: Function's language.
          example: example_value
        body:
          type: string
          description: Function's body.
          example: example_value
      required:
      - name
      - arguments
    FunctionArgument:
      type: object
      description: An argument of function
      properties:
        name:
          type: string
          description: Argument's name
          example: Example Title
        datatype:
          description: Argument's type
          type: string
          enum:
          - FIXED
          - INT
          - REAL
          - NUMBER
          - TEXT
          - BOOLEAN
          - DATE
          - TIME
          - TIMESTAMP_TZ
          - TIMESTAMP_LTZ
          - TIMESTAMP_NTZ
          default: TEXT
          example: FIXED
        value:
          description: Argument's value
          example: example_value
    FunctionArguments:
      type: array
      items:
        $ref: '#/components/schemas/FunctionArgument'
    ServiceFunction:
      allOf:
      - $ref: '#/components/schemas/Function'
      description: Service based function
      required:
      - service
      - endpoint
      - path
      properties:
        service:
          $ref: ./common.yaml#/components/schemas/Identifier
          description: Service's name
        service_database:
          $ref: ./common.yaml#/components/schemas/Identifier
          description: Service's database name
        service_schema:
          $ref: ./common.yaml#/components/schemas/Identifier
          description: Service's schema name
        endpoint:
          type: string
          description: Function's endpoint
          example: example_value
        path:
          type: string
          description: Function's path
          example: example_value
  securitySchemes:
    KeyPair:
      $ref: common.yaml#/components/securitySchemes/KeyPair
    ExternalOAuth:
      $ref: common.yaml#/components/securitySchemes/ExternalOAuth
    SnowflakeOAuth:
      $ref: common.yaml#/components/securitySchemes/SnowflakeOAuth
security:
- KeyPair: []
- ExternalOAuth: []
- SnowflakeOAuth: []