Functions Module
Invoke custom backend functions viabase44.functions.
Contents
- Method
- Invoking Functions (Frontend, File Upload, Service Role, REST API)
- Writing Backend Functions (Basic, Service Role, Secrets, Errors)
- Setup Requirements
- Authentication Modes
Methods
invoke
functionName: Name of the backend functiondata: Optional object of parameters (sent as JSON, or multipart if contains File objects)- Returns the RAW axios response — the JSON your function returned lives on
.data, not on the top-level object. The resolved value is{ data, status, headers, … }. - Throws on a non-2xx response. The error body is at
err.response.data.
fetch
Response object. Use when you need streaming responses, custom HTTP methods, or raw response access.
path: Function path (e.g.,/streaming_demoor/my-function/endpoint)init: Optional native fetch options (RequestInit)- Returns: Native
Responseobject
Invoking Functions
From Frontend
Streaming Response (using fetch)
Custom HTTP Methods (using fetch)
With File Upload
With Service Role (Backend)
Via REST API (curl)
Functions can be called via HTTP POST to your app domain:Writing Backend Functions
Backend functions run on Deno. Must export usingDeno.serve().
Function Directory Structure
A backend function is a folder underbase44/functions/ with an entry.ts or entry.js file:
base44/functions/ to the folder containing entry.ts. For example, base44/functions/process-order/entry.ts deploys as process-order, and base44/functions/orders/process/entry.ts deploys as orders/process.
For complete setup and deployment instructions, see functions-create.md in base44-cli.
Basic Structure
With Service Role Access
Using Secrets
Error Handling
Setup Requirements
- Enable Backend Functions in app settings (requires appropriate plan)
- Create function files in
base44/functions/ - Configure secrets via app dashboard for API keys
Authentication Modes
| Mode | Context | Permissions |
|---|---|---|
| User | base44.functions.invoke() | Runs under calling user’s permissions |
| Service Role | base44.asServiceRole.functions.invoke() | Admin-level access |
createClientFromRequest(req) to get a client that inherits the caller’s auth context.
Type Definitions
How to get typed function names: The Base44 CLI can generate an augmentation ofFunctionNameRegistry from your project. For how to run it, use the base44-cli skill.

