Skip to content

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.

FunctionDetail:

FieldTypeNotes
idnumber
namestring | null
runtimestring | nulle.g. nodejs:18.
timeoutnumber | nullms.
memorynumber | nullMB.
organizationIdstringBIGINT → string.
currentVersionnumber | null
descriptionstring | null
namespacestringComputed: org-{organizationId}.
endpointstringComputed: /v1/functions/{name}/invoke.
envEnvVar[]{ name, value }.
createdAt / updatedAtstring | null

FunctionListItem is the compact list shape: id, name, runtime, currentVersion, endpoint, createdAt, updatedAt.


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

Terminal window
curl "https://api.pandastack.io/v1/functions?page=1&pageSize=20" \
-H "Authorization: Bearer $PANDASTACK_TOKEN"

GET /v1/functions/token

Returns the org’s function auth token, masked.

Auth: any member. Response: { token }.

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.

FieldTypeRequiredNotes
code / filefile (ZIP)yesThe function source archive.
namestringyes1–63 chars; ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$.
runtimenodejs | pythonnoDefault nodejs.
timeoutnumberno1000–900000 ms (capped at 15 min); default 60000.
memorynumberno128–2048 MB; default 256.
descriptionstringnoMax 500.
envEnvVar[]noDefault [].

Response: FunctionDetail.

Terminal window
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"

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 /v1/functions/:name

Auth: any member. Returns FunctionDetail.

PATCH /v1/functions/:name

Auth: member. Body (UpdateFunctionInput) — all optional:

FieldTypeNotes
timeoutnumber1000–900000 ms.
memorynumber128–2048 MB.
descriptionstring | nullMax 500.
envEnvVar[]

Returns FunctionDetail.

GET /v1/functions/:name/versions

Auth: any member. Response: FunctionVersion[] — each { id, functionId, version, current, createdAt, updatedAt }.

POST /v1/functions/:name/rollback

Roll back to a prior version.

Auth: member. Body: { "version": number }. Response: FunctionDetail.

DELETE /v1/functions/:name

Deletes the function and its GCS code.

Auth: member. Response: { success: true }.


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):

FieldTypeNotes
statussuccess | error
resultunknown | nullFunction return value.
errorstring | nullError message if it failed.
durationMsnumber | null
versionnumber | nullVersion that ran.
Terminal window
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 }
}

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

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):

FieldTypeNotes
timestampsstring[]ISO bucket starts.
invocationsnumber[]Per-bucket count.
errorsnumber[]Per-bucket error count.
latency(number | null)[]Avg ms per bucket (null = no data).

A scheduled function runs an existing edge function on a cron. It is a lightweight cronjob — the payload is the function’s params.

GET /v1/scheduled-functions

Auth: any member. Response: ScheduledFunction[].

GET /v1/scheduled-functions/:id

Auth: any member. Response: ScheduledFunction:

FieldTypeNotes
idnumber
namestring
functionIdnumber
functionNamestring | null
organizationIdstring
cronSchedulestring5-field cron.
timezonestring
enabledboolean
paramsrecord | nullPayload passed on each run.
lastRunAt / nextRunAtstring | null
lastStatus / lastErrorstring | null
totalRunsnumber
createdAt / updatedAtstring | null

POST /v1/scheduled-functions

Auth: member. Body (CreateScheduledFunctionInput):

FieldTypeRequiredNotes
namestringyes1–63 chars; ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$.
functionnumber | stringyesThe function by id (positive int) or name.
cronSchedulestringyes1–120 chars, 5-field cron (e.g. */5 * * * *).
timezonestringno1–64 chars, default UTC.
enabledbooleannoDefault true.
paramsrecordnoDefault {}.

Response: ScheduledFunction.

Terminal window
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" }
}'

PATCH /v1/scheduled-functions/:id

Auth: member. Body (UpdateScheduledFunctionInput) — all optional: cronSchedule, timezone, enabled, params. Response: ScheduledFunction.

DELETE /v1/scheduled-functions/:id

Auth: member. Response: { success: true }.

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).

  • Cronjobs API — full container-based scheduled runs (vs. lightweight scheduled functions).
  • Usage & limits API — function invocation counts and plan gating.