REST API - Edge functions#
Sandboxed JavaScript/TypeScript functions executed server-side.
| Endpoint | Method | Description |
|---|---|---|
/projects/{id}/functions | GET | List functions |
/projects/{id}/functions | POST | Create a function |
/projects/{id}/functions/{fnID} | GET | Get one function |
/projects/{id}/functions/{fnID} | PATCH | Update a function |
/projects/{id}/functions/{fnID} | DELETE | Delete a function |
/projects/{id}/functions/{fnID}/deploy | POST | Deploy (make invocable) |
/projects/{id}/functions/{fnID}/invoke | POST | Invoke a deployed function |
Create:
{
"name": "hello",
"runtime": "javascript",
"code": "export default (req) => ({ body: { hello: req.body?.name ?? 'world' } });"
}
JSONInvoke:
{
"method": "POST",
"path": "/greet",
"headers": { "x-custom": "value" },
"body": "{\"name\":\"Asha\"}"
}
JSONFunctions run in a sandboxed runtime with a timeout; invalid syntax is rejected at deploy time.
Security#
- Accepts the project API key (or a project-user session)
- Scoped keys:
functions:read,functions:write