---
title: "Create a global UDF"
---

> Documentation Index
> Fetch the complete documentation index at: https://www.arroyo.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a global UDF

Path: Arroyo REST API › udfs

`POST /v1/udfs`

URL: `http://localhost:5115/api/v1/udfs`

## Request body

_Required._

- `definition` (`create_udf.definition`; string, required)
- `prefix` (`create_udf.prefix`; string, required)
- `description` (`create_udf.description`; string, optional, nullable)
- `language` (`create_udf.language`; string, optional)
  - one of `"python"`, `"rust"`

## Example request

```json
{
  "definition": "string",
  "description": "string",
  "language": "python",
  "prefix": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url http://localhost:5115/api/v1/udfs \
  --header 'Content-Type: application/json' \
  --data '
{
  "definition": "string",
  "description": "string",
  "language": "python",
  "prefix": "string"
}
'
```

### TypeScript

```typescript
const url = 'http://localhost:5115/api/v1/udfs';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    definition: 'string',
    description: 'string',
    language: 'python',
    prefix: 'string'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "http://localhost:5115/api/v1/udfs"

payload = {
    "definition": "string",
    "description": "string",
    "language": "python",
    "prefix": "string"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Created UDF

#### Example

```json
{
  "definition": "string",
  "language": "python"
}
```

- `definition` (`create_udf.response.200.definition`; string, required)
- `language` (`create_udf.response.200.language`; string, optional)
  - one of `"python"`, `"rust"`


Source: https://www.arroyo.dev/docs/api/create-udf/index.md
