# API Error: Invalid pagination cursor (invalid_cursor / cursor expired)

**Code:** `invalid_cursor` · **Category:** API · **Seen on:** REST API

The page token or cursor you passed is malformed, expired, or was generated for a different query.

## Meaning

Cursor pagination returns an opaque token (next_cursor, starting_after, pageToken) that encodes where the next page starts. The server rejects it if it was edited, URL-encoded wrongly, older than its retention window, or reused with different filters or sort order.

Slack returns invalid_cursor, Google APIs “Invalid page token”, others “cursor is invalid or expired”.

## Common causes

- Filters, sort or page size changed between pages
- Cursor too old (expired)
- Cursor decoded/modified or double URL-encoded
- Cursor from one endpoint used on another

## Quick fix

1. Restart the listing without a cursor
2. Keep every other parameter identical while paging
3. Pass the cursor exactly as received, URL-encoding it once

## Detailed fix by platform

### Node.js

1. 

```javascript
let cursor;
do {
  const res = await api.list({ limit: 100, status: 'active', cursor });  // same filters every call
  handle(res.data);
  cursor = res.next_cursor;
} while (cursor);
```


## How to diagnose

1. **Params** — Same filters/sort as the first page?
2. **Age** — How long since the cursor was issued?
3. **Encoding** — Compare the cursor sent with the one received

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/api/invalid-pagination-cursor)
