Update a Function
Update an existing function's configuration.
Updates create a new version of the function. The previous version remains available for reference and rollback purposes.
Important Notes
- The
typefield cannot be changed after creation - Each update increments the version number automatically
- Previous versions can be retrieved via
GET /v2/functions/{functionName}/versions/{versionNum} - Active function calls continue using their original version until completion
Function Type Documentation
For detailed documentation on each function type's updatable fields, see the guides:
| Type | Guide |
|---|---|
transform | Transform Functions Guide |
analyze | Analyze Functions Guide |
route | Route Functions Guide |
split | Split Functions Guide |
join | Join Functions Guide |
payload_shaping | Payload Shaping Functions Guide |
enrich | Enrich Functions Guide |
Common Updates by Type
Transform Functions
- Modify
outputSchemato extract additional fields - Update
outputSchemaNamefor clarity - Toggle
tabularChunkingEnabledfor spreadsheet processing
Analyze Functions
- Update
outputSchemafor different visual extraction needs - Modify
outputSchemaName
Route Functions
- Add, remove, or modify entries in the
routesarray - Update route
descriptionfor better classification - Change target
functionNameorfunctionID - Set
isErrorFallback: truefor fallback routes
Split Functions
- Update
printPageSplitConfigorsemanticPageSplitConfig - Modify item classes and their target functions
Join Functions
- Update
outputSchemafor the merged output structure - Modify
description
Payload Shaping Functions
- Update
shapingSchemaJMESPath expression
Enrich Functions
- Update
configsettings
Version Comparison
After updating, use the regression testing endpoint (POST /v2/functions/regression)
to compare the new version against previous versions using historical data.
Authorization
API Key Authenticate using API Key in request header
In: header
Path Parameters
The unique name of the function to update
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X PUT "https://api.bem.ai/v2/functions/string" \ -H "Content-Type: application/json" \ -d '{ "type": "payload_shaping", "shapingSchema": " { \"id\": invoiceNumber, \"total\": totalAmount, \"vendor_name\": vendor.name, \"item_count\": length(lineItems) }" }'{
"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
}