External Publication
Visit Post

Issue With Costs API Pagination – Invalid Page Token Returned

OpenAI Developer Community March 31, 2026
Source

Thanks for the update. I still can still reproduce the bug though.

Here is what I found:

The current documentation for GET /v1/organization/costs says the next request should use the next_page value from the previous response as the page parameter.

When using grouped Costs queries, the first page returns successfully with has_more=true and a next_page cursor. But when I send that same next_page value in the second request, the API still returns a 400 error saying: The page token is invalid, have you modified the query parameters?

As a comparison, the same endpoint without group_by paginated normally across multiple pages in the same test.

So this does not appear to be fully resolved. From what I observe, the problem seems limited to pagination on grouped /organization/costs queries, rather than pagination on the endpoint in general.

Current workaround: if you need to paginate Costs results, avoid group_by where possible, or keep the grouped query small enough to fit on a single page.

Hope this helps!

Discussion in the ATmosphere

Loading comments...