Skip to Content
Xeonr Developer Docs
API Specification

Versions

A function's versions: deploy (create a version) and roll back (set the active version). Reachable with a team API key.

postCreate a version (deploy)

Builds a new version from exactly one `source`, and makes it the active version unless `skipActivate` is set. `archive` is an uploaded zip of at most 64 MiB (base64 in JSON), imported into the workspace first; an archive that is not a valid zip, or that the buildpack cannot build, is `INVALID_ARGUMENT`. `workspace` deploys what is already in the function's workspace; a function with no files yet is `FAILED_PRECONDITION`. `git` fetches the connected repository at `ref` (a branch, tag or commit) for this deploy only, falling back to the configured branch and then the repository's default branch; a function with no repository, a credential that cannot be obtained, or no branch to deploy is `FAILED_PRECONDITION`, and a fetch that fails is `INTERNAL` with the reason in the message. `redeploy` clones an existing version's stored snapshot: without `rebuild` the existing image is reused with the function's current environment and secrets (this is how an env or secret change goes live, and needs a `VERSION_STATE_READY` source version); with `rebuild` the snapshot is built again, which is how a failed build is retried. The source version is never changed, and one belonging to another function is `NOT_FOUND`. `skipActivate` applies to `archive` and `workspace` only; with the other sources they always activate. A static version is `VERSION_STATE_READY` at once and activated before the response. A Node.js or Go version comes back `VERSION_STATE_BUILDING`: the image builds in the background (for up to 30 minutes) and the version is activated when the build succeeds, unless a newer version is already live. Follow it with `GetVersion` and `GetBuildLog`. Needs the editor role in the owning team. A `function.deploy` or `function.redeploy` event is recorded. A deployment with no platform configured answers `UNIMPLEMENTED`. Callable with a console session or a team API key (`Authorization: Bearer xk_…`). **Required scopes:** `functions:functions:edit`

postGet a version

Returns one version of the function: its state, build outputs, source ref and commit, and the failure reason of a failed build. Poll it to follow a build. `versionId` is required; a version that belongs to another function is `NOT_FOUND`. Needs the viewer role in the owning team. Callable with a console session or a team API key (`Authorization: Bearer xk_…`). **Required scopes:** `functions:functions:read`

postList a function's versions

Lists the function's versions, newest first: the deploy history. Pages default to 50 versions and are capped at 500 (`limit`). Pass `nextCursor` back as `cursor`; an empty `nextCursor` means the last page. Needs the viewer role in the owning team. Callable with a console session or a team API key (`Authorization: Bearer xk_…`). **Required scopes:** `functions:functions:read`

postSet the active version

Points the function's traffic at an already-built version and returns the version that is now active. Nothing is rebuilt, so setting an older version is an instant rollback, and setting the version that is already active changes nothing. Only a `VERSION_STATE_READY` version can be activated (`FAILED_PRECONDITION` otherwise), and an old container version built before app versions were recorded must be redeployed instead. A version of another function is `NOT_FOUND`. Needs the editor role in the owning team. A `function.promote` event is recorded. Callable with a console session or a team API key (`Authorization: Bearer xk_…`). **Required scopes:** `functions:functions:edit`

Get a function's traffic stats POST

Returns the function's edge traffic as a series of buckets, oldest first: requests, 4xx and 5xx responses, cold starts, and p50 and p95 latency. `rangeSec` defaults to 24 hours and is capped at 14 days. `stepSec` is raised to the five-minute storage resolution, and coarsened so that at most about 500 points come back. Buckets with no traffic are returned as zeros. The series is not paged: it is bounded by the point cap. Needs the viewer role in the owning team. Callable with a console session or a team API key (`Authorization: Bearer xk_…`). **Required scopes:** `functions:functions:read`

Create a version (deploy) POST

Builds a new version from exactly one `source`, and makes it the active version unless `skipActivate` is set. `archive` is an uploaded zip of at most 64 MiB (base64 in JSON), imported into the workspace first; an archive that is not a valid zip, or that the buildpack cannot build, is `INVALID_ARGUMENT`. `workspace` deploys what is already in the function's workspace; a function with no files yet is `FAILED_PRECONDITION`. `git` fetches the connected repository at `ref` (a branch, tag or commit) for this deploy only, falling back to the configured branch and then the repository's default branch; a function with no repository, a credential that cannot be obtained, or no branch to deploy is `FAILED_PRECONDITION`, and a fetch that fails is `INTERNAL` with the reason in the message. `redeploy` clones an existing version's stored snapshot: without `rebuild` the existing image is reused with the function's current environment and secrets (this is how an env or secret change goes live, and needs a `VERSION_STATE_READY` source version); with `rebuild` the snapshot is built again, which is how a failed build is retried. The source version is never changed, and one belonging to another function is `NOT_FOUND`. `skipActivate` applies to `archive` and `workspace` only; with the other sources they always activate. A static version is `VERSION_STATE_READY` at once and activated before the response. A Node.js or Go version comes back `VERSION_STATE_BUILDING`: the image builds in the background (for up to 30 minutes) and the version is activated when the build succeeds, unless a newer version is already live. Follow it with `GetVersion` and `GetBuildLog`. Needs the editor role in the owning team. A `function.deploy` or `function.redeploy` event is recorded. A deployment with no platform configured answers `UNIMPLEMENTED`. Callable with a console session or a team API key (`Authorization: Bearer xk_…`). **Required scopes:** `functions:functions:edit`