wispfnDocs
Function SDK

Every field of the request your handler receives and the response it returns.

#Handler signatures

JavaScript
export async function handler(req) { return { status: 200, body: {} }; }
Python
def handler(req):           # or: async def handler(req)
    return {"status": 200, "body": {}}

In Python, req is a dict: use req["query"], req["body"].

#Request

FieldTypeDescription
methodstringGET, POST, PUT, PATCH or DELETE
pathstringThe path after the host, e.g. /orders/1042
subpathstringThe path after the function name, e.g. /1042 (empty when none)
queryobjectQuery parameters as strings
headersobjectRequest headers with lower-case names
bodyanyParsed JSON for JSON requests, otherwise text, or null
rawBodystringThe body as received; base64 when isBase64Encoded
isBase64EncodedbooleanWhether rawBody is base64 (binary bodies)
modestring"test" for ?test requests, otherwise "live"
ipstringThe caller's IP address
apiKeyobject?{ id, name } when the project requires API keys
callerobject?{ projectId, kind } for calls from your own code (kind: endpoint for your project's code, schedule, mcp or console)

The test query parameter is removed from query.

#Response

FieldTypeDescription
statusnumberHTTP status. Defaults to 200.
headersobjectResponse headers
bodyanyObjects and arrays → JSON; strings → text; bytes → binary

#Response headers Wisp adds

HeaderMeaning
x-wisp-modetest or live
x-wisp-versionThe version that answered
x-wisp-duration-msHow long your code ran
x-wisp-cacheEdge cache status for cached functions
ratelimit-*, retry-afterWhen rate limits apply

CORS headers are added to every response, and OPTIONS preflight requests are answered for you.