# Continue a snapshot-pinned read

> Pass the cursor and warehouse generation from the same page to retrieve the next slice.

Canonical URL: https://quantset.dev/docs/guides/pagination
Full LLM API Contract: https://api.quantset.dev/llms-full.txt

> ## For AI agents
> The QuantSet API is at https://api.quantset.dev. Send the key in the `X-API-Key` header. The sandbox key `mw_demo` needs no signup and reads the sample listings.
> No key yet? An agent can open an account on its own: https://api.quantset.dev/skill.md
> Connect an MCP client to https://api.quantset.dev/mcp. Client setup is at https://api.quantset.dev/agents.md.
> Start with https://api.quantset.dev/llms.txt or read the full reference at https://api.quantset.dev/llms-full.txt. The OpenAPI file is https://api.quantset.dev/openapi.json. Add `.md` to any docs URL to get that page as Markdown.

Pass the cursor and warehouse generation from the same page to retrieve the next slice.

## Fetch another price page

Start with ticker, dates and a limit. If next_cursor is null, the read is complete. Otherwise copy it unchanged into cursor, copy snapshot_id and repeat the original filters, limit and representation. Use URL encoding for both values.

```
import os
import requests

url = "https://api.quantset.dev/api/v1/prices"
headers = {"X-API-Key": os.getenv("QUANTSET_API_KEY", "mw_demo")}
filters = {"ticker": "NVDA", "limit": 5}
first = requests.get(url, headers=headers, params=filters, timeout=15)
first.raise_for_status()
page = first.json()
if page["next_cursor"] is not None:
    params = {**filters, "cursor": page["next_cursor"], "snapshot_id": page["snapshot_id"]}
    second = requests.get(url, headers=headers, params=params, timeout=15)
    second.raise_for_status()
```

## Assemble the result

Daily bars are ascending within each page, and subsequent pages reach further back. Prepend each older page to build ascending history. Other endpoints document their own ordering. A limit alone does not imply cursor support.

## Handle a changed snapshot

On 409 snapshot_changed, discard partial pages and restart the query. On 422 invalid_cursor, check the filters, operation and snapshot_id. CSV reads carry the generation in X-Warehouse-Snapshot-Id and the continuation in X-Next-Cursor when more rows exist.

---

## QuantSet Ecosystem & Integrations (https://quantset.dev/integrations)

- **MCP Clients & 7 Skills:** `npx quantset init` & `npx skills add quantset/skills` (Claude, Claude Code, Cursor, ChatGPT, Codex, Hermes, OpenClaw, Block Goose, Cline, Docker MCP Toolkit — `https://api.quantset.dev/mcp`)
- **Python SDK & Agent Frameworks:** `pip install "quantset[pandas]"` · `from quantset.tools import build_agent_functions, langchain_tools, crewai_tools` (PydanticAI, LangGraph, LangChain, CrewAI, Agno, AutoGen, Google ADK, OpenAI Agents SDK)
- **TypeScript SDK & Vercel AI / Mastra:** `npm install quantset` · `import { createQuantsetTools } from "quantset/tools"` (Node 20+, Bun, Deno, Cloudflare Workers, Vercel Edge)
- **Spreadsheets & Workspaces:** Google Sheets (`=QUANTSET()` & `=IMPORTDATA()`), Microsoft Excel Power Query (`?format=csv`), Notion MCP & n8n/Make webhooks (`https://quantset.dev/docs/guides/google-sheets-excel-notion-stock-templates`)
- **Drop-In Migrations & Machine Payments:** FMP `/stable/*` & `/v3/*` adapter (`https://quantset.dev/docs/switch/fmp`), `yfinance` migration (`https://quantset.dev/docs/switch/yfinance`), autonomous signup (`https://api.quantset.dev/skill.md`), and `x402` Base USDC.
