Ultrahost/ docs

Functions are how the other building blocks meet. A function can read documents, check a policy, and call a model with credentials that never reach the browser.

Paths in the tables are relative to https://api.ultrahost.com/v1/projects/{projectId}. Pagination, idempotency, and errors are described in Conventions.

Create

SDKRESTDescription
functions.create(name, config)POST /functionsCreate a function
functions.get(name)GET /functions/{name}Retrieve configuration
functions.list()GET /functionsList functions
functions.update(name, config)PATCH /functions/{name}Update configuration
functions.delete(name)DELETE /functions/{name}Delete a function
functions.deploy(name, artifact)POST /functions/{name}/deploymentsDeploy code
functions.listVersions(name)GET /functions/{name}/versionsList deployed versions
functions.rollback(name, version)POST /functions/{name}/rollbackRoll back a deployment
ts
await admin.functions.create("process-invoice", config);
await admin.functions.deploy("process-invoice", artifact);

Deploy and rollback are admin operations. rollback moves the active version. It follows the same idea as schemas: history stays, the pointer changes.

Configure

SDKRESTDescription
functions.setSecrets(name, secrets)PUT /functions/{name}/secretsConfigure secrets
functions.setEnvironment(name, variables)PUT /functions/{name}/environmentConfigure environment variables

Cron targets a function by name. The function does not need its own scheduler.

Use

SDKRESTDescription
functions.invoke(name, input?)POST /functions/{name}/invokeRun and wait for the result
functions.invokeAsync(name, input?)POST /functions/{name}/invoke-asyncStart a background execution
functions.getExecution(id)GET /functions/executions/{id}Execution status
functions.cancelExecution(id)POST /functions/executions/{id}/cancelRequest cancellation
functions.logs(name, options?)GET /functions/{name}/logsExecution logs
functions.metrics(name, options?)POST /functions/{name}/metrics/queryPerformance metrics
ts
const result = await ultrahost.functions.invoke("process-invoice", {
  invoiceId: "INV-123"
});
ts
const execution = await ultrahost.functions.invokeAsync("generate-report", {
  reportId: "monthly-sales"
});

const status = await ultrahost.functions.getExecution(execution.id);

Async execution uses the same idea as operations: an id you can read until the work finishes. useFunction(name) is the React hook for functions exposed to the client. Logs and metrics are for operators, not for the public UI.