Coinbase Prime broken pagination on /v1/portfolios/${portfolioId}/transactions

Hello Coinbase Team

I think the pagination is broken on the following endpoint of the Coinbase Prime API /v1/portfolios/${portfolioId}/transactions.

As we can see on this screenshot the property “has_next” to false is set to false while the cursor has a value

URL used: 'https://api.prime.coinbase.com/v1/portfolios/3e227c54-7577-4914-aa33-77218be64790/transactions?start_time=2009-01-03T00%3A00%3A00.000Z&end_time=2023-06-23T12%3A22%3A17.471Z&limit=100&sort_direction=DESC'

If I try to query the same endpoint with the previously returned cursor I get some results

URL used: 'https://api.prime.coinbase.com/v1/portfolios/3e227c54-7577-4914-aa33-77218be64790/transactions?start_time=2009-01-03T00%3A00%3A00.000Z&end_time=2023-06-23T12%3A22%3A17.471Z&cursor=eyJjcmVhdGVkX2F0IjoiMjAyMy0wNS0wMlQxNDowMTo0OS41MTRaIiwibGFzdF9yZXR1cm5lZF9pZCI6IjM0ZTllZDBmLTM5NDMtNGI0MC1iYjc0LTY5MWFjZjRlZDY0MCIsIm5leHRfdHdzX2lkIjoiNTM4YTRkMjctODg3My00ZWI2LWJjZTMtMTY5YmNhOTY5ZmViIn0%3D&limit=100&sort_direction=DESC',

Have a nice week-end !

Hello guys

Do you have any update on this issue ?

Hi @CharlesRA

Thank you for using Coinbase forum, we are happy to help you.

It appears that the pagination is working correctly. The endpoint /v1/portfolios/${portfolioId}/transactions is using cursor pagination, which allows you to fetch additional results after the current page of results. To retrieve more results, subsequent requests should specify which direction to paginate based on the data previously returned. You can do this by adding the cursor=<next_cursor> parameter to your request.

Hope this helps you, have a good day.

I think main problem is that has_next is /was false even when there is next_cursor

Hi @muktupavels

If your initial request returns a pagination value with a non-null next_cursor, you should repeat the identical request again while adding a cursor=<next_cursor> query parameter to get the next page of results. Repeat until is next_cursor=‘’ to paginate through all the results.

Documentation says:

A boolean flag indicating whether there is more data available to page through

In one or other way there is problem, no? That flag should not be false if there are next page.

Anyway I don’t use Prime API, just wanted to point that problem seems to be with has_next flag.

There is definitely an issue with the has_next set to false. It should be set to true since there are other transactions with the cursor given by the API.