POST /api/v2/flows/executions 400 Bad Request on variable mapping

Hey folks,

I’m trying to kick off an Architect flow from our external WFM dashboard. We want to trigger a specific adherence check flow when a supervisor clicks a button in our app. I’ve got the OAuth token handled via client credentials, so auth isn’t the issue here.

The problem is the payload. The docs for /api/v2/flows/executions are a bit vague on the exact structure for input variables. I’m getting a 400 Bad Request every time I try to pass the agent ID.

Here is the request body I’m sending:

{
 "flowId": "abc-123-flow-id",
 "inputs": {
 "agentId": "xyz-456-agent-id"
 }
}

And here is the error response:

{
 "errors": [
 {
 "code": "invalid_request",
 "message": "Invalid input variables for flow execution"
 }
 ]
}

I’ve double-checked the flowId and it’s correct. The flow is published and active. I even tried using the executionId parameter, but that seems to be for resuming, not starting.

I’m using the Python SDK genesyscloud.flows.api.FlowsApi.create_flow_execution(). The method signature looks like it expects a FlowExecutionRequest object. I’m constructing it like this:

from genesyscloud.flows.models import FlowExecutionRequest

request = FlowExecutionRequest(
 flow_id="abc-123-flow-id",
 inputs={"agentId": "xyz-456-agent-id"}
)

api_response = flows_api.create_flow_execution(body=request)

The error message doesn’t tell me which variable is wrong. I assumed the key in the inputs dict should match the variable name defined in the Architect flow. In the flow, I have a variable named agentId of type String.

Am I missing a namespace? Do I need to prefix it with something like flow.agentId? Or is the structure of the inputs object different than a simple key-value pair?

Any help would be great. I’ve been stuck on this for two days.