Stuck on this one. Trying to trigger an Architect flow from a Node.js backend using the Genesys Cloud REST API. The endpoint is POST /api/v2/flows/executions.
Here is the payload I’m sending:
{
"flowId": "e3b2c1a0-4567-89ab-cdef-1234567890ab",
"inputs": {
"customerId": "CUST-99887"
}
}
The response is a 422 Unprocessable Entity. The error body says Invalid flow input: customerId is required.
I’ve checked the flow definition in the UI. The input parameter is named customerId exactly. It’s a string. I’ve even tried camelCase, snake_case, and passing it in the query string just to be sure. Nothing works.
The token has admin:flow and view:flow scopes. I can list flows fine.
Is there a specific casing rule for the inputs object that isn’t documented? Or does the flow ID need to be in a specific environment? The flow is published. I’m pulling my hair out over this syntax mismatch.
The 422 error here is almost certainly a schema mismatch in the inputs object. Genesys Cloud validates the structure against the flow definition strictly. If your flow expects a specific data type or nested structure for customerId, sending a raw string might fail validation if the flow was designed to accept an object or if the field name doesn’t match exactly.
Check the flow definition first. You can fetch the schema for that specific flow using the GET /api/v2/flows/{flowId} endpoint. Look at the inputs array in the response. Each input has a name and a type.
If customerId is defined as a string in the flow, ensure you aren’t accidentally sending an integer or null. If it’s part of a larger object, you need to nest it.
Try this curl command to inspect the flow definition:
curl -X GET "https://api.mypurecloud.com/api/v2/flows/e3b2c1a0-4567-89ab-cdef-1234567890ab" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Accept: application/json"
Look for the inputs section. If the flow expects customerId to be inside a wrapper object, your payload needs to change. For example, if the input name is actually customerData and it expects a JSON object, the payload would look like this:
{
"flowId": "e3b2c1a0-4567-89ab-cdef-1234567890ab",
"inputs": {
"customerData": {
"customerId": "CUST-99887"
}
}
}
Also verify the OAuth scopes. You need flow:execute to trigger flows. Missing scopes usually return 401 or 403, but sometimes the platform behaves oddly with 422 if the token is valid but lacks execution rights on that specific flow type.
If the payload matches the schema exactly, check the flow’s error handling. Sometimes a 422 is returned if the flow itself throws a validation error immediately upon entry, though the body usually contains more detail. Enable debug logging in your Node.js client to see the full response headers.