Copy a Function
Creates a copy of an existing function with a new name. The copied function will have all the same configuration, schema, and settings as the source function, but with a new name and optionally new display name and tags. The function can optionally be copied to a different environment within the same account.
Authenticate using API Key in request header
In: header
Name of the function to copy from. Must be a valid existing function name.
Name for the new copied function. Must be unique within the target environment.
Optional display name for the copied function. If not provided, defaults to the source function's display name with " (Copy)" appended.
Optional environment name to copy the function to. If not provided, the function will be copied within the same environment.
Optional array of tags for the copied function. If not provided, defaults to the source function's tags.
Response Body
curl -X POST "https://api.bem.ai/v2/functions/copy" \ -H "Content-Type: application/json" \ -d '{ "sourceFunctionName": "invoice-processor", "targetFunctionName": "invoice-processor-v2" }'{
"functionID": "string",
"functionName": "string",
"versionNum": 0,
"type": "transform",
"usedInWorkflows": [
[
{
"workflowID": "w_1234567890",
"workflowName": "My Workflow",
"currentVersionNum": 1,
"usedInWorkflowVersionNums": [
1,
2,
3
]
}
]
],
"displayName": "string",
"tags": [
"billing",
"finance",
"automated"
],
"outputSchemaName": "Freight Load Schema",
"outputSchema": {
"type": "object",
"required": [
"tenders"
],
"properties": {
"tenders": {
"type": "array",
"items": {
"type": "object",
"required": [
"loadReference",
"origin",
"destination",
"weightTons",
"loadType",
"desiredDeliveryDate",
"bidSubmissionDeadline",
"submitter"
],
"properties": {
"origin": {
"type": "string",
"description": "The starting point of the shipment."
},
"loadType": {
"type": "string",
"description": "The type of goods being shipped."
},
"submitter": {
"type": "object",
"required": [
"name",
"position",
"contactInfo"
],
"properties": {
"name": {
"type": "string",
"description": "Name of the person submitting the tender."
},
"position": {
"type": "string",
"description": "Position of the submitter within their company."
},
"contactInfo": {
"type": "object",
"required": [
"email"
],
"properties": {
"email": {
"type": "string",
"format": "email",
"description": "Email address of the submitter."
},
"phone": {
"type": "string",
"description": "Phone number of the submitter."
}
}
}
}
},
"weightTons": {
"type": "number",
"description": "The weight of the load in tons."
},
"destination": {
"type": "string",
"description": "The endpoint of the shipment."
},
"loadReference": {
"type": "string",
"description": "Unique identifier for the load tender."
},
"desiredDeliveryDate": {
"type": "string",
"format": "date",
"description": "The preferred date for the shipment to be delivered."
},
"bidSubmissionDeadline": {
"type": "string",
"format": "date",
"description": "The deadline for submitting bids."
}
}
}
}
}
},
"emailAddress": "eml_2c9AXFXHwiaL4vPXDTOS171OJ8T@pipeline.bem.ai",
"tabularChunkingEnabled": false,
"independentDocumentProcessingEnabled": false
}{
"message": "invalid request body: missing required field 'transformationIDs'",
"code": 400,
"details": {
"field": "transformationIDs",
"reason": "required field missing"
}
}