REST API
Functions
List, create, update, schedule, delete and run a project's functions with the REST API.
:function is the function's name or id. Every change creates a new draft version.
GET /api/projects/:id/functions
GET /api/projects/:id/functions/:function
POST /api/projects/:id/functions
PATCH /api/projects/:id/functions/:function
DELETE /api/projects/:id/functions/:function
POST /api/projects/:id/functions/:function/invoke#Create a function
| Field | Type | Default | Description |
|---|---|---|---|
name | string | — | Lowercase letters, digits, -, _. before and after create the special functions. |
code | string | — | The complete source file |
http | boolean | true | Expose over HTTP at <project url>/<name> |
method | string | GET (POST without HTTP) | GET, POST, PUT, PATCH, DELETE |
visibility | string | public | public, private or internal (HTTP functions) |
mcp | boolean | public HTTP functions | Offer it as an MCP tool |
beforeAfter | boolean | true | false skips before and after |
callable | boolean | true | false: other functions can't call it (only schedules, MCP and the console). Always true with a public API |
schedule | object? | null | When it runs on its own — see below |
cache | object? | null | { "seconds": 300 } to turn on edge caching (GET only) |
language | string? | project's | javascript or python |
description | string | "" | Up to 500 characters |
inputSchema | object? | null | JSON Schema of the input |
outputSchema | object? | null | JSON Schema of the response |
exampleQuery, exampleBody | string? | null | Prefill the console's Test / Run |
curl -X POST https://wispfn.com/api/projects/$PROJECT/functions \
-H "Authorization: Bearer $WISP_API_KEY" -H "content-type: application/json" \
-d '{"name":"ping","code":"export async function handler() { return { status: 200, body: { pong: true } }; }"}'Returns { "function": { … }, "version": 7, "deploy": { … } }.
A function without HTTP is always private and uses POST; it can't be cached. before and after are never exposed: http, mcp and schedule are refused for them.
#Update settings and schedule
PATCH with any of the fields above except code (use Code):
{ "schedule": { "cron": "0 9 * * 1", "timezone": "Europe/Berlin", "description": "Mondays at 9", "enabled": true } }Set schedule to null to remove it. Schedules run the published version. Turning http on makes the function public unless you send visibility.
#Run a function
POST /functions/:function/invoke runs it now — private ones and those without HTTP too — against the draft ("mode": "test") or the live version. See Runtime.