CXone Reporting API v2 agent state history query returns 400

Getting 400 Bad Request when querying agent state history. The payload looks correct but the service rejects it. Here is the JSON body I’m sending:

{
 "timePeriod": {
 "from": "2023-10-25T00:00:00.000Z",
 "to": "2023-10-26T00:00:00.000Z"
 },
 "filter": {
 "agentIds": ["12345"]
 }
}

The error response just says Invalid request body. I’ve checked the OData docs and the schema seems right. What am I missing?