Skip to main content

How do cursors work?

Written by Aymeric Gibon
Updated this week

To retrieve more than 50,000 items from our premium endpoints (such as Get Artists or Get Songs), you must transition from Offset-based pagination to Cursor-based pagination.

Every response includes a cursor value that acts as a direct pointer to the next page of results. Depending on your performance needs, you can implement one of two strategies:

1. Sequential Fetching (simpler, slower)

In this linear approach, you fetch one page at a time. Each response provides the "key" to the next set of data.

  • Process: Request Page A β†’ Extract cursor β†’ Request Page B using that cursor.

2. Hybrid Parallel Fetching (much faster, but more involved)

You can combine cursors with offsets to continue parallelising after the 50,000-item limit.

  • Phase 1: Parallelise requests using Offsets for the first 50,000 items.

  • Phase 2: Capture the cursor from the 50,000th item (the final page of your first batch).

  • Phase 3: Use that cursor to "unlock" the next 50,000 items, which can then be parallelised again using offsets starting from the new cursor point.

  • Repeat until you have all the results you need.

Note : If you are using the Python SDK, this process is handled for you.

Did this answer your question?