Functions

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 type field 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:

Common Updates by Type

Transform Functions

  • Modify outputSchema to extract additional fields
  • Update outputSchemaName for clarity
  • Toggle tabularChunkingEnabled for spreadsheet processing

Analyze Functions

  • Update outputSchema for different visual extraction needs
  • Modify outputSchemaName

Route Functions

  • Add, remove, or modify entries in the routes array
  • Update route description for better classification
  • Change target functionName or functionID
  • Set isErrorFallback: true for fallback routes

Split Functions

  • Update printPageSplitConfig or semanticPageSplitConfig
  • Modify item classes and their target functions

Join Functions

  • Update outputSchema for the merged output structure
  • Modify description

Payload Shaping Functions

  • Update shapingSchema JMESPath expression

Enrich Functions

  • Update config settings

Version Comparison

After updating, use the regression testing endpoint (POST /v2/functions/regression) to compare the new version against previous versions using historical data.

PUT
/v2/functions/{functionName}
x-api-key<token>

Authenticate using API Key in request header

In: header

Path Parameters

functionName*string

The unique name of the function to update

Request Body

application/json

functionName?string

Name of function. Must be UNIQUE on a per-environment basis.

displayName?string

Display name of function. Human-readable name to help you identify the function.

tags?array<>

Array of tags to categorize and organize functions.

outputSchemaName?string

Name of output schema object.

outputSchema?object

Desired output structure defined in standard JSON Schema convention.

tabularChunkingEnabled?boolean

Whether tabular chunking is enabled on the pipeline. This processes tables in CSV/Excel in row batches, rather than all rows at once.

Response Body

application/json

curl -X PUT "https://api.bem.ai/v2/functions/string" \  -H "Content-Type: application/json" \  -d '{    "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
}