Docs

Functions

Write Python functions, deploy them, and call them over HTTP with secrets, logs and versions.

Updated Oct 13, 2026Open in console

Functions run your server-side code — webhooks, payments, calls to AI APIs, anything that needs a secret. Each function gets an HTTPS endpoint, versioned deploys, logs and its own secrets. Functions run Python 3 in an isolated sandbox.

Edge Functions editorEdge Functions editor
Edge Functions: edit the code, Save & deploy, and use the tabs to run it, read logs, see versions, set secrets, schedules and settings.

Write a function

Define handler(event, context). event is the JSON body of the request; context tells you who called and which version is running. Return any JSON value.

import os

def handler(event, context):
    caller = context["caller"]          # {"user_id", "role": "authenticated" | "anon" | "service_role", "app_roles"}
    if caller["role"] == "anon":
        return {"error": "sign in first"}
    name = (event or {}).get("name", "world")
    return {"message": f"Hello, {name}!", "version": context["version"]}
context keyValue
callerWho made the request: user id, role and app roles.
project_idThe project.
function_name, version, deploy_idWhich deploy is running.
invocation_idUnique id for this call — also shown in logs.

Deploy

sov fn deploy ./hello --name hello --note "first version"
sov fn versions hello
sov fn rollback hello        # back to the previous version

Every deploy creates a new version. Owners and admins are notified when a deploy succeeds or fails; a failed deploy never replaces the version that is serving traffic.

Call it

const result = await sovaria.functions.call('hello', { name: 'Ada' })

By default only signed-in users can call a function. Make it public (for webhooks from Stripe, GitHub, etc.) in the function's settings — then verify the sender inside your code, for example by checking the webhook signature.

Secrets

Store API keys as secrets; they are encrypted, never shown again after saving, and available to your code as environment variables.

sov secrets set hello --name OPENAI_API_KEY --value sk-...
sov secrets list hello            # values are masked
sov secrets import hello .env

Network access

Functions can only reach the hosts you allow in the function's settings (for example api.openai.com). Everything else is blocked, which stops a compromised dependency from sending your data elsewhere.

Logs and limits

  • Logs: Functions → your function → Logs, or sov fn logs hello. Each line carries the invocation id.
  • Timeout, memory and invocations per month depend on your plan.
  • Use --async (or functions.invokeAsync) for long work; poll the job or let it notify your app through realtime.
Something unclear or missing on this page?Tell us