POST /api/v202609/workbench/script/bills

Dry-runs one JavaScript bill processing rule script against several existing bills without saving any changes

PreviewWorkbenchScriptAgainstBillsV202609 Permissions: BillProcessingRules (Manage)BillsAndBatches (View)
Use this endpoint to see how a script behaves across many bills before making it a rule - for example the last bills on an account - and find the ones it fails on or changes. The script runs against each bill separately, with the same engine and limits as a saved rule. Nothing is persisted. Each result reports whether the script succeeded, its error, and how many properties it changed; to see the changes to one bill, use POST workbench/script/bill/{billId}. Bills that don’t exist or aren’t visible to the user are reported as not found. At most 100 bills per request. Restricted to ENC staff.

Request Headers

Header Value Required Description
ECI-ApiKey string Yes Your API key. See Authentication.
Content-Type application/json Yes All requests must specify JSON content type, including the request body.

Request Body

WorkbenchScriptBatchRequestV202609
Property Description Type
billIds Unique numeric identifiers of the bills to run the script against, one run per bill in the order given. At most 100. Max length of 100 integer[]
script The JavaScript to run against each bill, written as the body of a bill processing rule. Maximum length: 100,000 characters. Max length of 100000 string
Example Request Body application/json
{  "billIds": [
    1
  ],  "script": "string"
}

Responses

200 OK The request succeeded and the response body contains the requested data.

Response Body Parameters

WorkbenchScriptBatchResponseV202609
Property Description Type
results One result per requested bill, in the order the bills were requested WorkbenchScriptBatchResultV202609[]
WorkbenchScriptBatchResultV202609 properties
Property Description Type
billId Unique numeric identifier of the bill integer (int32)
consoleMessageCount How many console messages the script wrote integer (int32)
differenceCount How many bill properties the script changed integer (int32)
differencesTruncated True when the script changed more properties than are counted boolean
errorLine The 1-based script line the error was raised on, when known integer (int32)
errorReason Why the script failed, or why the bill couldn’t be used string
executionTimeMs How long the script took to run, in milliseconds integer (int64)
found False when the bill doesn’t exist or isn’t visible to the user; the script didn’t run boolean
success True when the script ran to completion against the bill boolean
Example Response application/json
{  "results": [
    {    "billId": 1,    "consoleMessageCount": 1,    "differenceCount": 1,    "differencesTruncated": false,    "errorLine": 1,    "errorReason": "string",    "executionTimeMs": 1,    "found": false,    "success": false
  }
  ]
}
400 Bad Request The request was malformed or contains invalid parameters. Check the request body and query parameters.