Skip to main content

Options API

Resolves a workflow's runtime options — most notably the credit cost — without submitting the task. The executor's options() method is only invoked for workflows registered with enablePreflight: true; otherwise the response falls back to the workflow's statically configured monetization (if any) and is {} when none is configured.

See also: Runtime Options, Monetization. From the client library, call options().

Path​

POST /workflows/<TASK_NAME>/options

Request Body​

{
"params" : {} // your task command
}

Response Body​

{
"status" : "success",
"response" : {
"monetization" : { "toolId" : "example_tool" }, // resolved tool id
"usageAmount" : 3, // resolved usage amount
"credits" : 30, // total credits to charge for the task, after any discount
"originalCredits" : 40, // price before the discount, when there is one
"roundCredits" : true, // present when the task bills in whole credits
"minCredits" : 50, // minimum balance the task requires, if any
"hasEnoughCredits" : false, // present only with minCredits: whether the user holds it
"permission" : "pro_model", // permission the task requires, if any
"hasPermission" : false, // present only with permission: whether the user's tier grants it
"missingPermissions" : ["pro_model"], // present only when hasPermission is false
"rateLimitVerdict": { "overLimit": false, "retryAfterSeconds": 0 } // rate limit verdict if the task has one set
}
}

cURL Example​

curl --location '{BASE_URL}/workflows/<TASK_NAME>/options' \
--header 'Authorization: Bearer <USER_TOKEN>' \
--header 'x-app-authorization: Bearer <CLIENT_TOKEN>' \
--header 'platform: website' \
--header 'x-touchpoint: <touchpoint>' \
--data '{
"params": {}
}'