Functions

REST endpoints for functions. Bearer-auth required.

GET /api/functions

List functions.

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.
  • workspace_id (optional): Filter to functions in this workspace. When omitted, returns functions across every workspace the caller is a member of (admins see all). System functions are always included.
  • source (optional): Narrow by source. workspace = this workspace's functions plus those visible via installed integrations; system = only global system functions; integration = only functions made visible by installed integrations; omit = union.
  • include_deleted (optional): Soft-deleted function visibility. false (default) — active rows only. true — active plus soft-deleted. only — soft-deleted only.
  • name (optional): Case-insensitive substring match on name.
  • default_version_id (optional): Shorthand: filter where defaultVersionId equals this value.
  • system (optional): Shorthand: filter where system equals this value.
  • created_by (optional): Shorthand: filter where createdBy equals this value.
  • runtime_user_id (optional): Shorthand: filter where runtimeUserId equals this value.
  • retention_tier (optional): Shorthand: filter where retentionTier equals this value.

Response

JSON
{
  "data": [
    {
      "id": "<...>",
      "workspaceId": "<...>",
      "name": "<...>",
      "description": "<...>",
      "defaultVersionId": "<...>",
      "source": "<...>",
      "system": "<...>",
      "createdBy": "<...>",
      "runtimeUserId": "<...>",
      "deletedAt": "<...>",
      "retentionTier": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}

POST /api/functions

Create function

Request body

JSON
{
  "workspaceId": "string",
  "name": "string",
  "description?": "string",
  "source?": "custom | system | openapi-op",
  "inputSchemaId": "string",
  "outputSchemaId": "string"
}

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"
}

GET /api/functions/{id}

Get a function by ID.

Path parameters

  • id (required): Function to retrieve.

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"
}

PATCH /api/functions/{id}

Update function

Path parameters

  • id (required): The function's prefixed ID (e.g. fun_...).

Request body

JSON
{
  "name?": "string",
  "description?": "string",
  "runtimeUserId?": "string"
}

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"
}

DELETE /api/functions/{id}

Soft-delete a function.

Path parameters

  • id (required): Function to soft-delete.

Response

JSON
{
  "success": "boolean"
}

POST /api/functions/{id}/invoke

Invoke a function as a Cloudflare Dynamic Worker

Path parameters

  • id (required): The function's prefixed ID (e.g. fun_...).

Request body

JSON
{
  "args?": {},
  "versionId?": "string"
}

Response

JSON
{
  "ok": "boolean",
  "result?": "any",
  "error": "string",
  "durationMs": "integer"
}

DELETE /api/functions/{id}/purge

Permanently delete a soft-deleted function.

Path parameters

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

Response

JSON
{
  "success": "boolean"
}

POST /api/functions/{id}/restore

Restore a soft-deleted function.

Path parameters

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

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"
}