Agent Scripting API 400 Error during JMeter Load Test with Dynamic Variables

Is it possible to trigger the /v2/agentscripts/scriptinstances endpoint via the Genesys Cloud REST API while maintaining a high concurrency load without hitting payload validation errors?

We are running a stress test in the us-east-1 region using JMeter 5.6.2 to simulate 50 concurrent agent script executions. The goal is to validate the throughput of the Agent Scripting service under load. The test plan uses the POST /v2/agentscripts/scriptinstances endpoint to start instances of a specific script ID.

The request payload includes the scriptId, agentId, and a variables object. The variables are generated dynamically per thread to ensure uniqueness.

{
 "scriptId": "abc-123-def-456",
 "agentId": "dynamic-agent-id",
 "variables": {
 "orderId": "ORD-" + ${__counter(TRUE,)},
 "timestamp": ${__time()}
 }
}

At low concurrency (10 threads), the requests succeed with a 201 Created status. However, when scaling to 50 concurrent threads, approximately 30% of the requests fail with a 400 Bad Request. The error response body is minimal:

{
 "message": "Invalid variable value format",
 "code": "bad.request"
}

The documentation states:

“Variables passed in the request body must adhere to the script definition schema. Numeric fields must be integers or floats, and string fields must not exceed 255 characters.”

The generated values are well within these limits. The orderId is a short string, and timestamp is a long integer. We have verified the script definition in Architect; it expects a String for orderId and a Number for timestamp.

Interestingly, the failures are not consistent across threads. Some threads succeed, while others fail with the same payload structure. We checked the X-Genesys-Request-Id headers, and each request is unique. There are no 429 rate limit errors, just these sporadic 400s.

Could this be a race condition in the validation layer? Or is there a hidden limit on concurrent script instance creations per account? We are using the standard Genesys Cloud API client library in Java 17. Any insights on how to debug this variable validation issue under load would be appreciated.

Make sure you include the scriptInstanceId in the request body, as omitting it causes a 400 validation error rather than a rate limit issue. Refer to the payload schema here: https://developer.genesys.cloud/api-docs/agent-scripting/post-agent-script-instances

The quickest way to solve this is to ensure the payload structure aligns with the performance metrics we track in the dashboard.

Is it possible to trigger the /v2/agentscripts/scriptinstances endpoint via the Genesys Cloud REST API while maintaining a high concurrency load without hitting payload validation errors?

Verification of the schema against the documentation is required before scaling the load test.

{
“scriptInstanceId”: “generated-uuid-here”,
“scriptId”: “your-script-id”,
“metadata”: {
“agentId”: “${JMETER_AGENT_ID}”,
“startTime”: “2023-10-27T14:30:00Z”
}
}

The 400 error usually stems from missing required fields in the JSON body, not concurrency limits. The suggestion about scriptInstanceId is spot on. In my weekly schedule publishing workflows, I often see similar validation failures when dynamic variables aren’t properly formatted as strings or UUIDs. JMeter might be injecting null values or malformed timestamps. Ensure your JMeter variable for agentId matches the exact format Genesys expects. Also, check if your script requires specific metadata fields that are omitted in the base template.

  • Verify scriptInstanceId is a valid UUID format.
  • Confirm startTime uses ISO 8601 format.
  • Check if agentId matches the active agent pool.
  • Review API rate limits for script instances.