Hello,
- "So I followed the instruction in the error message and added { allowRedirect: true } to the request."
You can also reduce the page size to avoid hitting the limit.
I mean reducing the value of your pageSize parameter (as it appears to be set to the max: 500).
- "Now I see the getAuditsQueryTransactionIdResults is getting a 302 response, but the response doesn't contain a Location header. I'm not sure if the lack of a Location header is the reason, but getAuditsQueryTransactionIdResults is throwing an exception that looks like this: {"id":"83e71391-0d7f-4e54-9fce-b5e4344a3c88","pageSize":500,"cursor":...,"downloadUrl":...}"
I unfortunately couldn't reproduce it in my org as I don't have enough audit events. I mean I don't have enough activity in it to reach the limit.
But yes, if you do not see a Location header in the 302 response, with the Javascript SDK, that is likely the reason why you are getting this exception, with the content of the response body being carried in the error.
At this time, you will have to extract the downloadUrl from the exception (if present - that's a 302) and make a query to that url, or reduce the pageSize and do paging using cursor (to avoid hitting the limit).
- "Should the "GET /api/v2/audits/query/{transactionId}" API be updated to include a Location header when a 302 response is returned?"
It is still worth opening a ticket to request the Location header to be added to the 302 response.
But I can't say if this will be accepted or not. As you wrote in your comment related to the RFC, it it states "The server SHOULD generate a Location header field in the response containing a URI reference for the different URI.", that's not a MUST....
- "Should the (JavaScript) SDK function AuditApi.getAuditsQueryTransactionIdResults be updated so that if a 302 response is received, it automatically follows the redirect (instead of throwing an exception)?"
Unfortunately, there is nothing that can be done in the Javascript SDK in regards to this.
The SDK uses axios as the http client underneath. And in the SDK, Axios will automatically follow a redirect if a 30x reponse is received with a Location header in it (can't be blocked when use in a browser app - only in node.js app). That's what happens with the getOutboundContactlistExport endpoint (GET /api/v2/outbound/contactlists/{contactListId}/export), when download query parameter is set to true.
And a 30x response, if not able to be redirected, will raise an error in axios client.
The reason is also because the Platform API SDKs are automatically generated based on the Platform API Swagger definition (https://api.mypurecloud.com/api/v2/docs/swagger), so it'd be difficult to introduce a specific handling just for this endpoint in the SDK building process.
So it'd be useful if you could open a ticket (on the Platform API) to request the addition of the Location header in that endpoint response.
If this is accepted, it will solve this SDK limitation/constraint.
Otherwise, I'll try to think about what's possible. But I can't promise anything on this.
But at this time, this will modify both success response and error response and for all API endpoints.
I could possibly introduce a global setting as well that only applies to the error/exception (and that doesn't modify success response behavior) - something like apiClient.setReturnExtendedErrorResponses(true)
Regards,
------------------------------
Jerome Saint-Marc
Senior Development Support Engineer
------------------------------
Original Message:
Sent: 05-24-2026 21:54
From: Nick Tait
Subject: AuditApi.getAuditsQueryTransactionIdResults() woes
A couple of years ago I developed an application that uses the Genesys Cloud JavaScript SDK to query for audit events...
Today I discovered that getAuditsQueryTransactionIdResults was throwing an exception: {"message":"Response is too large. Set parameter allowRedirect to true to receive download url","code":"forbidden","status":403,"contextId":"...","details":[],"errors":[]}
It seems that if the response size is greater than a certain size (1 MB?) Genesys Cloud doesn't return the results in the HTTP response, but instead provides a mechanism for the results to be downloaded separately. So I followed the instruction in the error message and added { allowRedirect: true } to the request.
Now I see the getAuditsQueryTransactionIdResults is getting a 302 response, but the response doesn't contain a Location header. I'm not sure if the lack of a Location header is the reason, but getAuditsQueryTransactionIdResults is throwing an exception that looks like this: {"id":"83e71391-0d7f-4e54-9fce-b5e4344a3c88","pageSize":500,"cursor":...,"downloadUrl":...}
NB: The HTTP specification (https://www.rfc-editor.org/info/rfc9110/#name-302-found) states: The server SHOULD generate a Location header field in the response containing a URI reference for the different URI. The user agent MAY use the Location field value for automatic redirection...
I have a couple of questions:
- Should the "GET /api/v2/audits/query/{transactionId}" API be updated to include a Location header when a 302 response is returned?
- Should the (JavaScript) SDK function AuditApi.getAuditsQueryTransactionIdResults be updated so that if a 302 response is received, it automatically follows the redirect (instead of throwing an exception)?
Thanks,
Nick.
#PlatformSDK
------------------------------
Nick Tait
Genesys Consultant
------------------------------