---
title: "Function Versions"
description: "REST endpoints for function versions. Bearer-auth required."
section: "API"
group: "REST"
order: 34
---

## GET /api/function-versions

List function versions.

**Query parameters**

- `limit` (optional): Page size (1–100, default 100).
- `after` (optional): Keyset cursor — return the page after this row (next page).
- `before` (optional): Keyset cursor — return the page before this row (prev page).
- `ids` (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
- `filter` (optional): Nested filter expression (`<Entity>Filter`): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
- `orderBy` (optional): Multi-key sort (`<Entity>OrderBy[]`): array of `{ field: direction }` applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
- `function_id` (optional): Optional function narrower. Admins see every version when omitted; non-admin callers must scope by function.
- `include_deleted` (optional): Soft-deleted version visibility. `false` (default) — active rows only. `true` — active plus soft-deleted. `only` — soft-deleted only.
- `parent_id` (optional): Shorthand: filter where `parentId` equals this value.
- `input_schema_id` (optional): Shorthand: filter where `inputSchemaId` equals this value.
- `output_schema_id` (optional): Shorthand: filter where `outputSchemaId` equals this value.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "functionId": "<...>",
      "name": "<...>",
      "parentId": "<...>",
      "inputSchemaId": "<...>",
      "outputSchemaId": "<...>",
      "files?": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}
```

## POST /api/function-versions

Create new function version

`functionId` lives in the body — create a version of that function.

**Request body**

```json
{
  "functionId": "string",
  "name?": "string",
  "inputSchemaId": "string",
  "outputSchemaId": "string"
}
```

**Response**

```json
{
  "id": "string",
  "functionId": "string",
  "name": "string",
  "parentId": "string",
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "files?": ["<...>"],
  "createdAt": "string",
  "updatedAt": "string"
}
```

## GET /api/function-versions/{id}

Get a function version by ID.

**Path parameters**

- `id` (required): Function version to retrieve.

**Response**

```json
{
  "id": "string",
  "functionId": "string",
  "name": "string",
  "parentId": "string",
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "files?": ["<...>"],
  "createdAt": "string",
  "updatedAt": "string"
}
```

## PATCH /api/function-versions/{id}

Update function version

**Path parameters**

- `id` (required): The function version's prefixed ID (e.g. `funver_...`).

**Request body**

```json
{
  "name?": "string",
  "inputSchemaId?": "string",
  "outputSchemaId?": "string"
}
```

**Response**

```json
{
  "id": "string",
  "functionId": "string",
  "name": "string",
  "parentId": "string",
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "files?": ["<...>"],
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/function-versions/{id}

Soft-delete a function version.

**Path parameters**

- `id` (required): Function version to soft-delete.

**Response**

```json
{
  "success": "boolean"
}
```

## POST /api/function-versions/{id}/fork

Fork a version (create new version from existing)

**Path parameters**

- `id` (required): The function version's prefixed ID (e.g. `funver_...`).

**Request body**

```json
{
  "name?": "string"
}
```

**Response**

```json
{
  "id": "string",
  "functionId": "string",
  "name": "string",
  "parentId": "string",
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "files?": ["<...>"],
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/function-versions/{id}/purge

Permanently delete a soft-deleted function version.

**Path parameters**

- `id` (required): Soft-deleted function version to permanently delete.

**Response**

```json
{
  "success": "boolean"
}
```

## POST /api/function-versions/{id}/restore

Restore a soft-deleted function version.

**Path parameters**

- `id` (required): Soft-deleted function version to restore.

**Response**

```json
{
  "id": "string",
  "functionId": "string",
  "name": "string",
  "parentId": "string",
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "files?": ["<...>"],
  "createdAt": "string",
  "updatedAt": "string"
}
```

## POST /api/function-versions/{id}/set-default

Set this version as the function's default

**Path parameters**

- `id` (required): The function version's prefixed ID (e.g. `funver_...`).

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "defaultVersionId": "string",
  "source": "custom | system | openapi-op",
  "system": "boolean",
  "createdBy": "string",
  "runtimeUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```
