Function

CreateFunction registers a new serverless function and creates its initial code commit. Functions run as TypeScript modules in a sandboxed runtime; see initial_content for the entry-file signature and SDK import.

The new function is unpublished. To make the commit the default runnable version (and have the function appear as runnable in the Functions UI), call UpdateFunction with function.published_commit_id set and update_mask=["published_commit_id"].

post/api/v1/functions

Request

  • Base URL
    https://example.conductor.one
  • URL
    https://example.conductor.one/api/v1/functions
  • Auth
    HTTP bearer and OAuth 2
    Client credentials
    Token URL: /auth/v1/token

Request body

browserEnabledboolean

browser_enabled creates the function as browser-capable. See Function.browser_enabled. Rejected on FUNCTION_TYPE_ANY: browser support is code-mode-only today.

commitMessagestring

The commit message describing the initial code submission.

descriptionstring

A description of what the function does.

displayNamestring

The human-readable name for the function.

functionType'FUNCTION_TYPE_UNSPECIFIED' | 'FUNCTION_TYPE_ANY' | 'FUNCTION_TYPE_CODE_MODE' | 'FUNCTION_TYPE_CONNECTOR'

The type of function to create. Use FUNCTION_TYPE_ANY for user functions — that is the type the Functions UI lists. Do not use any other value.

initialContentobject

File map for the initial code commit. Keys are file paths in the function root (e.g. "main.ts", "main.test.ts"); values are file contents as bytes.

Runtime: TypeScript. The entry file MUST be "main.ts" exporting a default async handler:

import { JSONObject } from "@c1/functions-sdk"; export default async function main(input: JSONObject): Promise<JSONObject> { return { ok: true, echo: input }; }

The handler MUST return a JSON object — not a primitive, array, or null.

Response

Successful response

Changes

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • warning

      added the new FUNCTION_TYPE_CONNECTOR enum value to the // response property for the response status

    • info

      added the new optional request property

    • info

      added the new FUNCTION_TYPE_CONNECTOR enum value to the request property

    • info

      added the optional property // to the response with the status