Functions API
Edge functions run your code in a fast microVM (fn-invoker). Function code lives in GCS; env is exposed as { name, value } pairs and the per-org function API token is never returned in clear. The endpoint and namespace fields are computed virtuals.
Concept guides: Functions overview and Scheduled functions.
All routes require authentication; role floors are noted per endpoint.
The function object
Section titled “The function object”FunctionDetail:
| Field | Type | Notes |
|---|---|---|
id | number | |
name | string | null | |
runtime | string | null | e.g. nodejs:18. |
timeout | number | null | ms. |
memory | number | null | MB. |
organizationId | string | BIGINT → string. |
currentVersion | number | null | |
description | string | null | |
namespace | string | Computed: org-{organizationId}. |
endpoint | string | Computed: /v1/functions/{name}/invoke. |
env | EnvVar[] | { name, value }. |
createdAt / updatedAt | string | null |
FunctionListItem is the compact list shape: id, name, runtime, currentVersion, endpoint, createdAt, updatedAt.
List functions
Section titled “List functions”GET /v1/functions
Page-paginated list of the org’s edge functions.
Auth: any member. Query (FunctionListQuery): page (default 1), pageSize (default 20, max 100).
Response (FunctionListPage): { items: FunctionListItem[], total: number }.
curl "https://api.pandastack.io/v1/functions?page=1&pageSize=20" \ -H "Authorization: Bearer $PANDASTACK_TOKEN"Get the function auth token (masked)
Section titled “Get the function auth token (masked)”GET /v1/functions/token
Returns the org’s function auth token, masked.
Auth: any member. Response: { token }.
Create a function
Section titled “Create a function”POST /v1/functions
Creates an edge function from a code ZIP. Send multipart/form-data with the code file plus the fields below (the fields map to CreateFunctionInput).
Auth: member. Content-Type: multipart/form-data.
| Field | Type | Required | Notes |
|---|---|---|---|
| code / file | file (ZIP) | yes | The function source archive. |
name | string | yes | 1–63 chars; ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$. |
runtime | nodejs | python | no | Default nodejs. |
timeout | number | no | 1000–900000 ms (capped at 15 min); default 60000. |
memory | number | no | 128–2048 MB; default 256. |
description | string | no | Max 500. |
env | EnvVar[] | no | Default []. |
Response: FunctionDetail.
curl -X POST https://api.pandastack.io/v1/functions \ -H "Authorization: Bearer $PANDASTACK_TOKEN" \ -F "name=hello" \ -F "runtime=nodejs" \ -F "memory=256" \ -F "code=@function.zip"Deploy a new version
Section titled “Deploy a new version”POST /v1/functions/:name/deploy
Deploys a new function version from a code ZIP.
Auth: member. Content-Type: multipart/form-data (code ZIP). Response: FunctionDetail.
Get a function
Section titled “Get a function”GET /v1/functions/:name
Auth: any member. Returns FunctionDetail.
Update function config
Section titled “Update function config”PATCH /v1/functions/:name
Auth: member. Body (UpdateFunctionInput) — all optional:
| Field | Type | Notes |
|---|---|---|
timeout | number | 1000–900000 ms. |
memory | number | 128–2048 MB. |
description | string | null | Max 500. |
env | EnvVar[] |
Returns FunctionDetail.
List versions
Section titled “List versions”GET /v1/functions/:name/versions
Auth: any member. Response: FunctionVersion[] — each { id, functionId, version, current, createdAt, updatedAt }.
Roll back
Section titled “Roll back”POST /v1/functions/:name/rollback
Roll back to a prior version.
Auth: member. Body: { "version": number }. Response: FunctionDetail.
Delete a function
Section titled “Delete a function”DELETE /v1/functions/:name
Deletes the function and its GCS code.
Auth: member. Response: { success: true }.
Invoke a function
Section titled “Invoke a function”POST /v1/functions/:name/invoke
Invokes a function through the fn-invoker microVM. The body accepts either a raw JSON payload or a { params } envelope (InvokeFunctionInput, where params defaults to {}).
Auth: any member. Response (InvokeFunctionResult):
| Field | Type | Notes |
|---|---|---|
status | success | error | |
result | unknown | null | Function return value. |
error | string | null | Error message if it failed. |
durationMs | number | null | |
version | number | null | Version that ran. |
curl -X POST https://api.pandastack.io/v1/functions/hello/invoke \ -H "Authorization: Bearer $PANDASTACK_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "params": { "name": "Ada" } }'{ "success": true, "data": { "status": "success", "result": { "greeting": "Hello, Ada" }, "error": null, "durationMs": 42, "version": 3 }}List invocations
Section titled “List invocations”GET /v1/functions/:name/invocations
Auth: any member. Query (InvocationListQuery): page (default 1), pageSize (default 20, max 100). Response (InvocationListPage): { items: FunctionInvocation[], total }.
FunctionInvocation: { id, duration (ms), status (success|error), error, stdout, stderr, timestamp }.
Function metrics
Section titled “Function metrics”GET /v1/functions/:name/metrics
Invocation metrics bucketed over time.
Auth: any member. Query (FunctionMetricsQuery): fromMs, toMs (both optional, non-negative epoch ms).
Response (FunctionMetrics):
| Field | Type | Notes |
|---|---|---|
timestamps | string[] | ISO bucket starts. |
invocations | number[] | Per-bucket count. |
errors | number[] | Per-bucket error count. |
latency | (number | null)[] | Avg ms per bucket (null = no data). |
Scheduled functions
Section titled “Scheduled functions”A scheduled function runs an existing edge function on a cron. It is a lightweight cronjob — the payload is the function’s params.
List scheduled functions
Section titled “List scheduled functions”GET /v1/scheduled-functions
Auth: any member. Response: ScheduledFunction[].
Get a scheduled function
Section titled “Get a scheduled function”GET /v1/scheduled-functions/:id
Auth: any member. Response: ScheduledFunction:
| Field | Type | Notes |
|---|---|---|
id | number | |
name | string | |
functionId | number | |
functionName | string | null | |
organizationId | string | |
cronSchedule | string | 5-field cron. |
timezone | string | |
enabled | boolean | |
params | record | null | Payload passed on each run. |
lastRunAt / nextRunAt | string | null | |
lastStatus / lastError | string | null | |
totalRuns | number | |
createdAt / updatedAt | string | null |
Create a scheduled function
Section titled “Create a scheduled function”POST /v1/scheduled-functions
Auth: member. Body (CreateScheduledFunctionInput):
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | yes | 1–63 chars; ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$. |
function | number | string | yes | The function by id (positive int) or name. |
cronSchedule | string | yes | 1–120 chars, 5-field cron (e.g. */5 * * * *). |
timezone | string | no | 1–64 chars, default UTC. |
enabled | boolean | no | Default true. |
params | record | no | Default {}. |
Response: ScheduledFunction.
curl -X POST https://api.pandastack.io/v1/scheduled-functions \ -H "Authorization: Bearer $PANDASTACK_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "nightly-report", "function": "hello", "cronSchedule": "0 2 * * *", "timezone": "UTC", "params": { "type": "daily" } }'Update a scheduled function
Section titled “Update a scheduled function”PATCH /v1/scheduled-functions/:id
Auth: member. Body (UpdateScheduledFunctionInput) — all optional: cronSchedule, timezone, enabled, params. Response: ScheduledFunction.
Delete a scheduled function
Section titled “Delete a scheduled function”DELETE /v1/scheduled-functions/:id
Auth: member. Response: { success: true }.
Run now
Section titled “Run now”POST /v1/scheduled-functions/:id/run
Runs the schedule immediately (out-of-band test); does not touch next_run_at.
Auth: member. Response: InvokeFunctionResult (same shape as invoke).
Related
Section titled “Related”- Cronjobs API — full container-based scheduled runs (vs. lightweight scheduled functions).
- Usage & limits API — function invocation counts and plan gating.