Skip to Content
Xeonr Developer Docs
API SpecificationFunctions

Create a function

POST
/xeonr.functions.v2.FunctionsService/CreateFunction

Creates a function owned by ownerTeam (a team URN or slug) and assigns its hostname, <name>.fns.xnr.app. Names are never chosen. displayName is required (at most 64 characters, no control characters). kind is required (KIND_NODE, KIND_GO or KIND_STATIC) and cannot be changed later. Settings that do not apply to the kind are refused with INVALID_ARGUMENT: a port, entrypoint, packages or env on a static function, staticDir on a non-static one, mainPackage on a non-Go one.

source says where the code lives, once and for good. Left out, or SOURCE_MODE_PLATFORM, the workspace is scaffolded with a working hello-world project for the kind and is edited in the console. SOURCE_MODE_EXISTING_REPO attaches repo through a team connection, and SOURCE_MODE_NEW_REPO creates the repository through the provider and writes the scaffold into it. A first deploy starts in the background, so the returned function usually has no activeVersionId yet; follow the deploy with ListVersions or GetFunction.

A failure to apply source does not undo the function: it is created, and the reason comes back in sourceError with an OK status so the caller keeps the record. A function.create event is recorded in the team's activity feed.

Needs the editor role in the owning team. A team API key may leave ownerTeam empty to create in its own team, and needs the editor role there; a signed-in user must name the team. Callable with a console session or a team API key (Authorization: Bearer xk_…).

Required scopes: functions:functions:edit

Authorization

BearerAuth
AuthorizationBearer <token>

A team API key, created by a team admin in the console and presented as Authorization: Bearer xk_…. Xeonr Auth issues and verifies it; the secret is shown once at creation and stored only as a hash, and a revoked key stops working within 30 seconds. An existing fnt_… token is accepted the same way.

In: header

Header Parameters

Connect-Protocol-Version*number

Define the version of the Connect protocol

Value in1
Connect-Timeout-Ms?number

Define the timeout, in ms

Request Body

application/json

displayName?string

display_name is what a human calls this function.

Length1 <= length <= 64
kind?not unknown

kind is required: a build never has to guess, and a wrong guess would otherwise surface as a build failure rather than as a question.

Value in"KIND_UNSPECIFIED" | "KIND_NODE" | "KIND_GO" | "KIND_STATIC"
ownerTeam?string

owner_team is the owning Xeonr team (URN or slug). Required for a signed-in user; an API key uses its own team when this is empty.

Match^[A-Za-z0-9:._-]*$
Lengthlength <= 255
build?

BuildConfig is the author's declared intent. Every field is optional, and each applies to only some kinds.

scaling?

ScalingSpec is passed through to the platform. Ignored for static functions, which have nothing to scale. An unset field means the platform's default.

env?
Propertiesproperties <= 128
source?

source says where the code lives. Left out, it is SOURCE_MODE_PLATFORM.

[key: string]?never

Response Body

application/json

application/json

curl -X POST "https://functions.xeonr.io/xeonr.functions.v2.FunctionsService/CreateFunction" \  -H "Connect-Protocol-Version: 1" \  -H "Content-Type: application/json" \  -d '{}'
{
  "function": "map[createdAt:2026-10-22T09:30:00Z displayName:Checkout API functionId:fn-3f9a2c71d4e8b605 kind:KIND_NODE name:amber-heron-3f9a ownerTeam:urn:xeonr:auth:team:0f6b5f8c-3d2a-4c1e-9b7a-6e2d1c4f8a90 updatedAt:2026-10-22T09:30:00Z]",
  "sourceError": "the connection cannot see acme/checkout-api"
}