Skip to content
excalibase
api-reference
Edge Functionsbeta

API Reference

Self-hosted only. This is the function runtime's own API. It is not served on Excalibase Cloud: /deploy, /invoke/{id}, /delete/{id}, /scripts, /stats and /health answer 404 on api.excalibase.io. On the cloud, deploy from Studio or the MCP deploy_function tool and call POST https://api.excalibase.io/functions/v1/{projectId}/{id}; see the introduction.

Base URL: http://deno-runtime.serverless.svc.cluster.local:8000 (in-cluster) or http://localhost:24006 (port-forwarded)

Health

GET /health
{
  "status": "healthy",
  "scripts": 3,
  "uptime": 45123.456
}

Deploy Function

POST /deploy
X-Runtime-Secret: <the runtime's secret>
{
  "id": "hello",
  "code": "export default (req) => Response.json({ message: 'Hello' });"
}
FieldRequiredDescription
idYesUnique function identifier
codeYesBundled JavaScript whose default export is (req: Request) => Response

Response (201):

{
  "id": "hello",
  "url": "/invoke/hello"
}

Redeploying with the same id replaces the function once the new version is ready. Code that does not load, or has no default handler, answers 400 with the reason, and the version already deployed keeps answering:

{ "error": "index.ts must use export default (req: Request) => Response; found only named exports: invite" }

Invoke Function

POST /invoke/{id}

The body is the request to hand the handler; the answer is its response:

curl -X POST /invoke/hello \
  -H "Content-Type: application/json" \
  -H "X-Runtime-Secret: $RUNTIME_SECRET" \
  -d '{"method": "POST", "url": "/hello", "headers": {}, "body": "{}"}'
{ "status": 200, "headers": { "content-type": "application/json" }, "body": "{\"message\":\"Hello\"}" }

A handler that returns a plain value instead of a Response is sent as JSON. A handler that throws answers {"status": 500, "body": "{\"error\":\"internal error\"}"}; the message is in GET /logs/{id}.

Logs

GET /logs/{id}?since=<epoch ms>

The function's recent console output, thrown errors and refused deploys:

{ "logs": [{ "level": "error", "msg": "function failed: Error: ...", "ts": 1760000000000 }] }

Delete Function

DELETE /delete/{id}

Terminates the Worker and frees memory.

{ "status": "deleted", "id": "hello" }

List Functions

GET /scripts
{
  "scripts": [
    {
      "id": "hello",
      "invocations": 42,
      "uptime": 123456,
      "lastInvoked": "2026-03-28T18:35:22.885Z"
    }
  ]
}

Server Stats

GET /stats
{
  "totalScripts": 3,
  "maxScripts": 500,
  "scripts": [...]
}

Error Responses

Function not found:

{ "error": "Script not found: unknown-id" }

Execution timeout:

{ "error": "Execution timeout (30s)" }

Handler missing (deploy, 400):

{ "error": "index.ts must use export default (req: Request) => Response; found no exports" }

Deploy limit reached:

{ "error": "Max scripts limit reached (500)" }