---
title: "Function Files"
description: "REST endpoints for function files. Bearer-auth required."
section: "API"
group: "REST"
order: 32
---

## GET /api/function-files

List function files.

**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.
- `version_id` (optional): Optional version narrower. Admins see every file when omitted; non-admin callers must scope by version.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "versionId": "<...>",
      "name": "<...>",
      "source": "<...>",
      "createdAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}
```

## POST /api/function-files

Create function file

**Request body**

```json
{
  "versionId": "string",
  "name": "string",
  "source": "string"
}
```

**Response**

```json
{
  "id": "string",
  "versionId": "string",
  "name": "string",
  "source": "string",
  "createdAt": "string"
}
```

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

Get a function file by ID.

**Path parameters**

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

**Response**

```json
{
  "id": "string",
  "versionId": "string",
  "name": "string",
  "source": "string",
  "createdAt": "string"
}
```

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

Update function file

**Path parameters**

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

**Request body**

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

**Response**

```json
{
  "id": "string",
  "versionId": "string",
  "name": "string",
  "source": "string",
  "createdAt": "string"
}
```

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

Delete a function file.

**Path parameters**

- `id` (required): Function file to delete.

**Response**

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