POST /api/v2/flows/executions returns 400 on flowId parameter via Python SDK

Problem
Trying to trigger an Architect flow from our Python backend. The POST /api/v2/flows/executions endpoint is throwing a 400 error. We’ve confirmed the flow ID is valid and the token has flow:execute scope. Postman works with the same payload, but the SDK call fails.

from genesyscloud.flows import FlowsApi

client = get_genesys_client()
flows_api = FlowsApi(client)

body = FlowsExecutionRequestBody(flow_id="5a8b9c0d-1234-5678-90ab-cdef12345678")
response = flows_api.post_flows_executions(body=body)

Response returns a 400. Error payload shows:

{
 "errors": [
 {
 "code": "BAD_REQUEST",
 "message": "Flow ID is required"
 }
 ]
}

We tried passing the ID as a string and as a UUID object. Nothing sticks. The FlowsExecutionRequestBody constructor seems to ignore the argument. Wire logs show the body is empty. SDK bug?

You’re sending the flow ID in the query params. The SDK binds flowId to the path, not the query string. That’s why Postman works if you put it in the body or path, but the SDK call fails because it’s building the URL wrong.

Check your execute_flow call. You probably have something like this:

api_instance = FlowsApi(client)
try:
 # This is likely what you're doing, which is wrong
 result = api_instance.execute_flow(flow_id="your-flow-id", body=body)
except ApiException as e:
 print("Exception: %s\n" % e)

Wait, actually execute_flow takes flow_id as a positional arg in newer SDK versions. If you’re passing it as a kwarg and it’s mapping to query params, that’s the bug. But more likely, the issue is the body object. The endpoint expects a specific JSON structure for the execution context.

Try this:

from genesyscloud.rest import ApiException
from pprint import pprint

# Configure the body correctly
body = {
 "flowId": "your-actual-flow-id-here",
 "parameters": {
 "key1": "value1"
 }
}

try:
 # Pass the flowId as the first positional argument, not a kwarg
 # Or ensure you are using the correct method signature for your SDK version
 api_response = api_instance.execute_flow(body)
 pprint(api_response)
except ApiException as e:
 print("Exception when calling FlowsApi->execute_flow: %s\n" % e)

Actually, looking at the v2 SDK docs, execute_flow usually takes flow_id as a path parameter. If you’re getting a 400, check the error body. It usually says “flowId is required” or “invalid flowId”.

If Postman works, copy the exact raw request from Postman. Then compare it to the debug log of the Python SDK. You’ll likely see the SDK is appending ?flowId=... instead of putting it in /api/v2/flows/{flowId}/executions.

Also, make sure you’re not sending the flowId in the body and the path. The API gets confused. Just send the execution parameters in the body.

body = {
 "parameters": {
 "queueId": "some-queue-id"
 }
}

# Correct call structure
api_instance.execute_flow(flow_id="your-flow-id", body=body)

If that still 400s, print the e.body from the exception. It will tell you exactly which field is malformed. Usually it’s a missing required parameter in the parameters object defined in the Architect flow.