Create a Function

Hand off to an LLM

Create a function.

The function type (extract, classify, split, join, enrich, or payload_shaping) determines which configuration fields are required — see Function types overview for the per-type contract.

The response contains both functionID and functionName. Either is a stable handle you can use elsewhere; most workflows reference functions by functionName because it's human-readable.

Naming rules

  • functionName must be unique per environment.
  • Allowed characters: letters, digits, hyphens, and underscores.
  • Names cannot be reused after deletion within the same environment for at least the retention window of the previous record.

The new function is created at versionNum: 1. Subsequent PATCH /v3/functions/{functionName} calls produce new versions — the version-1 configuration remains immutable and addressable.

POST
/v3/functions
x-api-key<token>

Authenticate using API Key in request header

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://api.bem.ai/v3/functions" \  -H "Content-Type: application/json" \  -d '{    "functionName": "string",    "type": "extract"  }'
{
  "function": {
    "functionID": "string",
    "functionName": "string",
    "versionNum": 0,
    "usedInWorkflows": [
      {
        "workflowID": "string",
        "workflowName": "string",
        "currentVersionNum": 0,
        "usedInWorkflowVersionNums": [
          0
        ]
      }
    ],
    "displayName": "string",
    "tags": [
      "string"
    ],
    "audit": {
      "functionCreatedBy": {
        "userActionID": "string",
        "userID": "string",
        "userEmail": "string",
        "apiKeyName": "string",
        "emailAddress": "string",
        "createdAt": "2019-08-24T14:15:22Z"
      },
      "functionLastUpdatedBy": {
        "userActionID": "string",
        "userID": "string",
        "userEmail": "string",
        "apiKeyName": "string",
        "emailAddress": "string",
        "createdAt": "2019-08-24T14:15:22Z"
      },
      "versionCreatedBy": {
        "userActionID": "string",
        "userID": "string",
        "userEmail": "string",
        "apiKeyName": "string",
        "emailAddress": "string",
        "createdAt": "2019-08-24T14:15:22Z"
      }
    },
    "type": "transform",
    "outputSchemaName": "string",
    "outputSchema": {},
    "emailAddress": "string",
    "tabularChunkingEnabled": true
  }
}

See also