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.