Copy a Function

Hand off to an LLM

Copy a function to a new name within the same environment.

Forks the source function's current configuration into a brand-new function. The copy starts at versionNum: 1 regardless of how many versions the source has — version history is not carried over.

Useful for experimenting with schema or prompt changes against a stable production function without disturbing existing callers.

The destination name must be unique in the environment. A copy does not migrate workflows: existing workflow nodes continue to reference the original function.

POST
/v3/functions/copy
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

application/json

curl -X POST "https://api.bem.ai/v3/functions/copy" \  -H "Content-Type: application/json" \  -d '{    "sourceFunctionName": "string",    "targetFunctionName": "string"  }'
{
  "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
  }
}
{
  "message": "string",
  "code": 0,
  "details": {}
}

See also