Visibility and calling functions
Make HTTP functions public, private or internal, and run other functions of your project or workspace from code.
#Visibility
| Visibility | Who can call it |
|---|---|
| Public (default) | Anyone with the URL (and an API key, if required) |
| Private | Only this project: its code, schedules, MCP server and the console |
| Internal | Functions of any project in the same workspace |
| HTTP off | Like private, and it has no URL of its own |
Use private for helpers your functions share, such as a pricing calculation, and internal for services other projects in your workspace use. Private, internal and HTTP-off functions show a 🔒 in the console.
#Run another function
Every function of your project — exposed over HTTP or not — is a method on functions, typed from its schemas in the editor:
import { functions } from 'wisp';
const { total } = await functions.price({ items });from wisp import functions
total = functions.price(items=items)["total"]It throws a WispError when the function fails. GET functions get the input as query parameters. functions.invoke does the same by name and returns the raw response.
#Call over HTTP
HTTP functions are plain HTTP, so you can also call them with fetch or any client. The SDK gives you the URL and, for private and internal functions, the headers that identify your project — without them those functions refuse the call:
import { functions } from 'wisp';
const res = await fetch(functions.url('accounts/users', { id: '42' }), { headers: functions.headers() }); // another projectDuring a ?test request, functions.url and functions.invoke reach the drafts too. Full reference: functions.
#Who called
The called function sees req.caller:
req.caller // { projectId: "p...", kind: "endpoint" }
// kind: "endpoint" (your project's code), "schedule", "mcp" (the project's MCP server) or "console" (Run or Test)If you check credentials in before, let requests with req.caller through.