Skip to main content

Functions API

Custom HTTP function endpoints. All HTTP methods supported.

Custom Functions

ALL /api/functions/:functionName

Executes a user-defined HTTP function. Any HTTP method can be used (GET, POST, PUT, DELETE, etc.).

curl https://your-project.edgebase.dev/api/functions/my-function \
-H "Authorization: Bearer <accessToken>" \
-H "Content-Type: application/json" \
-d '{"input": "data"}'

Auth: Depends on function implementation. Functions can access auth from the context to check authentication.

Request/Response: Entirely determined by the function implementation. The function receives the full HTTP request and returns a custom response.


SQL Endpoint

POST /api/sql

Execute raw SQL against a table's Durable Object SQLite database.

Auth: Service Key required (X-EdgeBase-Service-Key header).

FieldTypeRequiredDescription
namespacestringYesDatabase namespace (e.g., "shared")
idstringNoInstance ID for dynamic DB blocks
sqlstringYesSQL query
paramsarrayNoParameter bindings

Request example:

{
"namespace": "shared",
"sql": "SELECT * FROM posts WHERE status = ?",
"params": ["published"]
}

Response 200 — Result array.

warning

Raw SQL bypasses access rules. Only use with Service Key from trusted server-side code.