Docs

JavaScript: Functions

Call edge functions from your app, deploy and version them, run them asynchronously, read logs, and manage their access, settings and bindings with @sovaria/sdk.

Updated Oct 16, 2026

Functions run your server code next to your data. Apps call them with functions.call; the management methods (deploy, versions, logs, settings) are for your team and CI.

as the callerfunctions.call()JSON bodyGatewayauth + functionaccessYour functionsandboxed, withits secretsYour dataSQL, documents,storage
import { createClient } from '@sovaria/sdk'

const sovaria = createClient('https://<project-ref>.sovaria.in', '<anon-key>')

const total = await sovaria.functions.call<{ total: number }>('order-total', { cartId })
console.log(total.total)

Calling

sovaria.functions.call

Call a function the way an app does: POST {projectUrl}/functions/v1/{name} with the signed-in user's token (or no token for functions marked public).

sovaria.functions.call(functionName: string, payload?: JsonValue = {}): Promise<T>

Returns the function's result.

Parameters

functionNamestringrequired
The function's name.
payloadJsonValueoptionaldefault {}
JSON body your function receives.
Returns
Promise<T> — Whatever the function returns (typed with the generic).
HTTP
POST /functions/v1/{…}
  • Runs as the signed-in user (or anonymously) — the function's access setting decides who may call it.

sovaria.functions.invoke

Invoke.

sovaria.functions.invoke(
  functionName: string,
  payload: JsonValue,
  options?: { projectId?: string; deployId?: string; executionProfile?: 'standard' | 'heavy' },
): Promise<JsonObject>

Parameters

functionNamestringrequired
payloadJsonValuerequired
options{ projectId?: string; deployId?: string; executionProfile?: 'standard' | 'heavy' }optional
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/{…}/invoke

sovaria.functions.invokeAsync

Invoke async.

sovaria.functions.invokeAsync(
  functionName: string,
  payload: JsonValue,
  options?: { projectId?: string deployId?: string executionProfile?: 'standard' | 'heavy' simulation?: boolean },
): Promise<JsonObject>

Parameters

functionNamestringrequired
payloadJsonValuerequired
options{ projectId?: string deployId?: string executionProfile?: 'standard' | 'heavy' simulation?: boolean }optional
Returns
Promise<JsonObject> — { invocation_id } — poll invocationStatus for the result.
HTTP
POST /api/v1/fn/{…}/invoke/async

sovaria.functions.invocationStatus

Invocation status.

sovaria.functions.invocationStatus(invocationId: string, projectId: string): Promise<JsonObject>

Parameters

invocationIdstringrequired
projectIdstringrequired
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/invocations/{…}

sovaria.functions.simulate

Simulate.

sovaria.functions.simulate(
  functionName: string,
  payload: JsonValue,
  options?: { projectId?: string; deployId?: string; executionProfile?: 'standard' | 'heavy' },
): Promise<JsonObject>

Parameters

functionNamestringrequired
payloadJsonValuerequired
options{ projectId?: string; deployId?: string; executionProfile?: 'standard' | 'heavy' }optional
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/{…}/simulate

Deploying and versions

sovaria.functions.plan

Validate a bundle and get a signed plan bound to its exact bytes.

sovaria.functions.plan(bundle: Blob, name: string, projectId?: string): Promise<JsonObject>

Parameters

bundleBlobrequired
namestringrequired
projectIdstringoptional
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/plan

sovaria.functions.deploy

Plans, then applies exactly the planned bundle (Forge refuses anything else).

sovaria.functions.deploy(bundle: Blob, name: string, projectId?: string): Promise<JsonObject>

Parameters

bundleBlobrequired
A zip Blob with your code (the CLI builds it for you: sov fn deploy).
namestringrequired
Function name.
projectIdstringoptional
Defaults to the client's project.
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/deploy
  • Plans first and applies exactly the planned bundle, so what you reviewed is what runs.

sovaria.functions.status

Status.

sovaria.functions.status(deployId: string, projectId?: string): Promise<JsonObject>

Parameters

deployIdstringrequired
projectIdstringoptional
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/{…}/status

sovaria.functions.versions

Versions.

sovaria.functions.versions(
  functionName: string,
  options: { projectId: string; limit?: number; offset?: number },
): Promise<JsonObject>

Parameters

functionNamestringrequired
options{ projectId: string; limit?: number; offset?: number }required
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/{…}/versions

sovaria.functions.promote

Promote.

sovaria.functions.promote(
  functionName: string,
  options: { projectId: string version?: number deployId?: string reason?: string },
): Promise<JsonObject>

Parameters

functionNamestringrequired
options{ projectId: string version?: number deployId?: string reason?: string }required
projectId, the version (or deployId) to make live, optional reason.
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/{…}/promote

sovaria.functions.rollback

Rollback.

sovaria.functions.rollback(
  functionName: string,
  options: { projectId: string version?: number reason?: string },
): Promise<JsonObject>

Parameters

functionNamestringrequired
options{ projectId: string version?: number reason?: string }required
projectId, optional version to go back to, reason.
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/{…}/rollback

sovaria.functions.history

History.

sovaria.functions.history(
  functionName: string,
  options: { projectId: string mode?: 'invoke' | 'simulate' limit?: number offset?: number },
): Promise<JsonObject>

Parameters

functionNamestringrequired
options{ projectId: string mode?: 'invoke' | 'simulate' limit?: number offset?: number }required
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/{…}/history/invocations

sovaria.functions.simulationDiff

Simulation diff.

sovaria.functions.simulationDiff(
  functionName: string,
  options: { projectId: string leftInvocationId: string rightInvocationId: string },
): Promise<JsonObject>

Parameters

functionNamestringrequired
options{ projectId: string leftInvocationId: string rightInvocationId: string }required
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/{…}/history/simulation-diff

Settings and logs

sovaria.functions.list

List.

sovaria.functions.list(
  options: { projectId: string; limit?: number; offset?: number },
): Promise<JsonObject>

Parameters

options{ projectId: string; limit?: number; offset?: number }required
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/functions

sovaria.functions.get

Get.

sovaria.functions.get(name: string): Promise<JsonObject>

Parameters

namestringrequired
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/functions/{…}

sovaria.functions.getSource

Get source.

sovaria.functions.getSource(name: string): Promise<JsonObject>

Parameters

namestringrequired
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/functions/{…}/source

sovaria.functions.update

Update.

sovaria.functions.update(name: string, body: JsonObject): Promise<JsonObject>

Parameters

namestringrequired
bodyJsonObjectrequired
Settings to change — public access, allowed outbound hosts, limits.
Returns
Promise<JsonObject>
HTTP
PATCH /api/v1/fn/functions/{…}

sovaria.functions.delete

Delete.

sovaria.functions.delete(name: string): Promise<JsonObject>

Parameters

namestringrequired
Returns
Promise<JsonObject>
HTTP
DELETE /api/v1/fn/functions/{…}

sovaria.functions.logs

Logs.

sovaria.functions.logs(
  name: string,
  query?: { limit?: number; offset?: number; status?: string },
): Promise<JsonValue>

Parameters

namestringrequired
query{ limit?: number; offset?: number; status?: string }optional
limit, offset, status (e.g. error).
Returns
Promise<JsonValue>
HTTP
GET /api/v1/fn/functions/{…}/logs

sovaria.functions.jobs

Jobs.

sovaria.functions.jobs(
  functionName: string,
  options: { projectId: string; status?: string; limit?: number; offset?: number },
): Promise<JsonObject>

Parameters

functionNamestringrequired
options{ projectId: string; status?: string; limit?: number; offset?: number }required
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/{…}/jobs

sovaria.functions.getPolicy

Get policy.

sovaria.functions.getPolicy(name: string): Promise<JsonObject>

Parameters

namestringrequired
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/functions/{…}/policy

sovaria.functions.setPolicy

Set policy.

sovaria.functions.setPolicy(name: string, body: JsonObject): Promise<JsonObject>

Parameters

namestringrequired
bodyJsonObjectrequired
Returns
Promise<JsonObject>
HTTP
PUT /api/v1/fn/functions/{…}/policy

sovaria.functions.getBindings

Get bindings.

sovaria.functions.getBindings(name: string): Promise<JsonObject>

Parameters

namestringrequired
Returns
Promise<JsonObject>
HTTP
GET /api/v1/fn/functions/{…}/bindings

sovaria.functions.setBindings

Set bindings.

sovaria.functions.setBindings(name: string, body: JsonObject): Promise<JsonObject>

Parameters

namestringrequired
bodyJsonObjectrequired
Returns
Promise<JsonObject>
HTTP
PUT /api/v1/fn/functions/{…}/bindings

GitHub

sovaria.functions.githubRepositories

Github repositories.

sovaria.functions.githubRepositories(body: JsonObject): Promise<JsonObject>

Parameters

bodyJsonObjectrequired
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/github/repositories

sovaria.functions.githubImport

Github import.

sovaria.functions.githubImport(body: JsonObject): Promise<JsonObject>

Parameters

bodyJsonObjectrequired
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/github/import

sovaria.functions.githubCommit

Github commit.

sovaria.functions.githubCommit(body: JsonObject): Promise<JsonObject>

Parameters

bodyJsonObjectrequired
Returns
Promise<JsonObject>
HTTP
POST /api/v1/fn/github/commit

More

sovaria.functions.request

Request.

sovaria.functions.request(
  method: string,
  path: string,
  options?: RequestOptions = {},
): Promise<JsonValue>

Parameters

methodstringrequired
pathstringrequired
optionsRequestOptionsoptionaldefault {}
Returns
Promise<JsonValue>
Something unclear or missing on this page?Tell us