---
title: "Create a function.
WARNING: This API is experimental and will change in future versions."
method: POST
path: "/functions"
tags: ["Functions"]
---

# Create a function.
WARNING: This API is experimental and will change in future versions.

`POST /functions`

Creates a new function instance.
WARNING: This API is experimental and will change in future versions.

## Request body

- CreateFunctionRequest
  - `function_info` CreateFunction, required
    - `name` string, required — Name of function, relative to parent schema.
    - `catalog_name` string, required — Name of parent catalog.
    - `schema_name` string, required — Name of parent schema relative to its parent catalog.
    - `input_params` FunctionParameterInfos, required
      - `parameters` FunctionParameterInfo[] — The array of __FunctionParameterInfo__ definitions of the function's parameters.
        - `name` string, required — Name of parameter.
        - `type_text` string, required — Full data type spec, SQL/catalogString text.
        - `type_json` string, required — Full data type spec, JSON-serialized.
        - `type_name` 'BOOLEAN' | 'BYTE' | 'SHORT' | 'INT' | 'LONG' | 'FLOAT' | 'DOUBLE' | 'DATE' | 'TIMESTAMP' | 'TIMESTAMP_NTZ' | 'STRING' | 'BINARY' | 'DECIMAL' | 'INTERVAL' | 'ARRAY' | 'STRUCT' | 'MAP' | 'CHAR' | 'NULL' | 'USER_DEFINED_TYPE' | 'TABLE_TYPE', required — Name of type (INT, STRUCT, MAP, etc.).
        - `type_precision` integer — Digits of precision; required on Create for DecimalTypes.
        - `type_scale` integer — Digits to right of decimal; Required on Create for DecimalTypes.
        - `type_interval_type` string — Format of IntervalType.
        - `position` integer, required — Ordinal position of column (starting at position 0).
        - `parameter_mode` 'IN' — The mode of the function parameter.
        - `parameter_type` 'PARAM' | 'COLUMN' — The type of function parameter.
        - `parameter_default` string — Default value of the parameter.
        - `comment` string — User-provided free-form text description.
    - `data_type` 'BOOLEAN' | 'BYTE' | 'SHORT' | 'INT' | 'LONG' | 'FLOAT' | 'DOUBLE' | 'DATE' | 'TIMESTAMP' | 'TIMESTAMP_NTZ' | 'STRING' | 'BINARY' | 'DECIMAL' | 'INTERVAL' | 'ARRAY' | 'STRUCT' | 'MAP' | 'CHAR' | 'NULL' | 'USER_DEFINED_TYPE' | 'TABLE_TYPE', required — Name of type (INT, STRUCT, MAP, etc.).
    - `full_data_type` string, required — Pretty printed function data type.
    - `return_params` FunctionParameterInfos
      - `parameters` FunctionParameterInfo[] — The array of __FunctionParameterInfo__ definitions of the function's parameters.
        - `name` string, required — Name of parameter.
        - `type_text` string, required — Full data type spec, SQL/catalogString text.
        - `type_json` string, required — Full data type spec, JSON-serialized.
        - `type_name` 'BOOLEAN' | 'BYTE' | 'SHORT' | 'INT' | 'LONG' | 'FLOAT' | 'DOUBLE' | 'DATE' | 'TIMESTAMP' | 'TIMESTAMP_NTZ' | 'STRING' | 'BINARY' | 'DECIMAL' | 'INTERVAL' | 'ARRAY' | 'STRUCT' | 'MAP' | 'CHAR' | 'NULL' | 'USER_DEFINED_TYPE' | 'TABLE_TYPE', required — Name of type (INT, STRUCT, MAP, etc.).
        - `type_precision` integer — Digits of precision; required on Create for DecimalTypes.
        - `type_scale` integer — Digits to right of decimal; Required on Create for DecimalTypes.
        - `type_interval_type` string — Format of IntervalType.
        - `position` integer, required — Ordinal position of column (starting at position 0).
        - `parameter_mode` 'IN' — The mode of the function parameter.
        - `parameter_type` 'PARAM' | 'COLUMN' — The type of function parameter.
        - `parameter_default` string — Default value of the parameter.
        - `comment` string — User-provided free-form text description.
    - `routine_body` 'SQL' | 'EXTERNAL', required — Function language. When **EXTERNAL** is used, the language of the routine function should be specified in the __external_language__ field, and the __return_params__ of the function cannot be used (as **TABLE** return type is not supported), and the __sql_data_access__ field must be **NO_SQL**.
    - `routine_definition` string, required — Function body.
    - `routine_dependencies` DependencyList — A list of dependencies.
      - `dependencies` Dependency[] — Array of dependencies.
        - `table` TableDependency — A table that is dependent on a SQL object.
          - `table_full_name` string, required — Full name of the dependent table, in the form of __catalog_name__.__schema_name__.__table_name__.
        - `function` FunctionDependency — A function that is dependent on a SQL object.
          - `function_full_name` string, required — Full name of the dependent function, in the form of __catalog_name__.__schema_name__.__function_name__.
    - `parameter_style` 'S', required — Function parameter style. **S** is the value for SQL.
    - `is_deterministic` boolean, required — Whether the function is deterministic.
    - `sql_data_access` 'CONTAINS_SQL' | 'READS_SQL_DATA' | 'NO_SQL', required — Function SQL data access.
    - `is_null_call` boolean, required — Function null call.
    - `security_type` 'DEFINER', required — Function security type.
    - `specific_name` string, required — Specific name of the function; Reserved for future use.
    - `comment` string — User-provided free-form text description.
    - `properties` string, required — JSON-serialized key-value pair map, encoded (escaped) as a string.
    - `external_language` string — External language of the function.

## Response `200`

The new function was successfully created.

- FunctionInfo
  - `name` string — Name of function, relative to parent schema.
  - `catalog_name` string — Name of parent catalog.
  - `schema_name` string — Name of parent schema relative to its parent catalog.
  - `input_params` FunctionParameterInfos
    - `parameters` FunctionParameterInfo[] — The array of __FunctionParameterInfo__ definitions of the function's parameters.
      - `name` string, required — Name of parameter.
      - `type_text` string, required — Full data type spec, SQL/catalogString text.
      - `type_json` string, required — Full data type spec, JSON-serialized.
      - `type_name` 'BOOLEAN' | 'BYTE' | 'SHORT' | 'INT' | 'LONG' | 'FLOAT' | 'DOUBLE' | 'DATE' | 'TIMESTAMP' | 'TIMESTAMP_NTZ' | 'STRING' | 'BINARY' | 'DECIMAL' | 'INTERVAL' | 'ARRAY' | 'STRUCT' | 'MAP' | 'CHAR' | 'NULL' | 'USER_DEFINED_TYPE' | 'TABLE_TYPE', required — Name of type (INT, STRUCT, MAP, etc.).
      - `type_precision` integer — Digits of precision; required on Create for DecimalTypes.
      - `type_scale` integer — Digits to right of decimal; Required on Create for DecimalTypes.
      - `type_interval_type` string — Format of IntervalType.
      - `position` integer, required — Ordinal position of column (starting at position 0).
      - `parameter_mode` 'IN' — The mode of the function parameter.
      - `parameter_type` 'PARAM' | 'COLUMN' — The type of function parameter.
      - `parameter_default` string — Default value of the parameter.
      - `comment` string — User-provided free-form text description.
  - `data_type` 'BOOLEAN' | 'BYTE' | 'SHORT' | 'INT' | 'LONG' | 'FLOAT' | 'DOUBLE' | 'DATE' | 'TIMESTAMP' | 'TIMESTAMP_NTZ' | 'STRING' | 'BINARY' | 'DECIMAL' | 'INTERVAL' | 'ARRAY' | 'STRUCT' | 'MAP' | 'CHAR' | 'NULL' | 'USER_DEFINED_TYPE' | 'TABLE_TYPE' — Name of type (INT, STRUCT, MAP, etc.).
  - `full_data_type` string — Pretty printed function data type.
  - `return_params` FunctionParameterInfos
    - `parameters` FunctionParameterInfo[] — The array of __FunctionParameterInfo__ definitions of the function's parameters.
      - `name` string, required — Name of parameter.
      - `type_text` string, required — Full data type spec, SQL/catalogString text.
      - `type_json` string, required — Full data type spec, JSON-serialized.
      - `type_name` 'BOOLEAN' | 'BYTE' | 'SHORT' | 'INT' | 'LONG' | 'FLOAT' | 'DOUBLE' | 'DATE' | 'TIMESTAMP' | 'TIMESTAMP_NTZ' | 'STRING' | 'BINARY' | 'DECIMAL' | 'INTERVAL' | 'ARRAY' | 'STRUCT' | 'MAP' | 'CHAR' | 'NULL' | 'USER_DEFINED_TYPE' | 'TABLE_TYPE', required — Name of type (INT, STRUCT, MAP, etc.).
      - `type_precision` integer — Digits of precision; required on Create for DecimalTypes.
      - `type_scale` integer — Digits to right of decimal; Required on Create for DecimalTypes.
      - `type_interval_type` string — Format of IntervalType.
      - `position` integer, required — Ordinal position of column (starting at position 0).
      - `parameter_mode` 'IN' — The mode of the function parameter.
      - `parameter_type` 'PARAM' | 'COLUMN' — The type of function parameter.
      - `parameter_default` string — Default value of the parameter.
      - `comment` string — User-provided free-form text description.
  - `routine_body` 'SQL' | 'EXTERNAL' — Function language. When **EXTERNAL** is used, the language of the routine function should be specified in the __external_language__ field, and the __return_params__ of the function cannot be used (as **TABLE** return type is not supported), and the __sql_data_access__ field must be **NO_SQL**.
  - `routine_definition` string — Function body.
  - `routine_dependencies` DependencyList — A list of dependencies.
    - `dependencies` Dependency[] — Array of dependencies.
      - `table` TableDependency — A table that is dependent on a SQL object.
        - `table_full_name` string, required — Full name of the dependent table, in the form of __catalog_name__.__schema_name__.__table_name__.
      - `function` FunctionDependency — A function that is dependent on a SQL object.
        - `function_full_name` string, required — Full name of the dependent function, in the form of __catalog_name__.__schema_name__.__function_name__.
  - `parameter_style` 'S' — Function parameter style. **S** is the value for SQL.
  - `is_deterministic` boolean — Whether the function is deterministic.
  - `sql_data_access` 'CONTAINS_SQL' | 'READS_SQL_DATA' | 'NO_SQL' — Function SQL data access.
  - `is_null_call` boolean — Function null call.
  - `security_type` 'DEFINER' — Function security type.
  - `specific_name` string — Specific name of the function; Reserved for future use.
  - `comment` string — User-provided free-form text description.
  - `properties` string — JSON-serialized key-value pair map, encoded (escaped) as a string.
  - `full_name` string — Full name of function, in form of __catalog_name__.__schema_name__.__function__name__
  - `created_at` integer — Time at which this function was created, in epoch milliseconds.
  - `updated_at` integer — Time at which this function was last updated, in epoch milliseconds.
  - `function_id` string — Id of Function, relative to parent schema.
  - `external_language` string — External language of the function.

---

[API](https://skmtc.dev/unitycatalog/apis/unity-catalog-api.md) · [All operations](https://skmtc.dev/unitycatalog/apis/unity-catalog-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/unitycatalog/unity-catalog-api/revisions/afb7536b3c70/schema)
