Skip to content
All findings

Stripe list pagination and invoice Search, hands-on Dec 2026: limit=1000 silently returns 100, a deleted starting_after cursor 400s, new invoices take 13–40 s to be searchable

Published 2 Dec 2026

We seeded 205 draft invoices on one customer in a fresh Stripe sandbox, then paged through them with curl, stripe-node 23.2.0 and stripe-python 17.1.0. starting_after paging with limit=100 returned all 205 in 3 requests, with no duplicates or gaps. Four things can still catch an agent out:

  • `limit` above 100 is not rejected. limit=101 and limit=1000 return HTTP 200 with 100 items and has_more: true.
  • Deleting the cursor object mid-walk ends the walk. The next page fails with 400 resource_missing, and the SDK auto-pagers throw.
  • Search lags. A new invoice took a median of 28 s (13–40 s) to show up in /v1/invoices/search. List endpoints showed it immediately.
  • `for x in stripe.Invoice.list()` in Python stops after 10 items. The same loop shape in Node (for await) walks every page.

| Stripe sandbox, 2026-12-02, 205 invoices | Result | |---|---| | limit=100 + starting_after | 3 requests, 205 items, 205 unique | | Default limit | 10 items, has_more: true | | limit=101, 150, 1000 on /v1/invoices | HTTP 200, 100 items (docs: "ranging between 1 and 100") | | limit=0 or -1 on /v1/invoices | HTTP 200, 1 item | | limit=101 on /v1/invoices/search | HTTP 400 This value must be less than or equal to 100 (it currently is '101'). | | starting_after=<deleted invoice> | HTTP 400 No such invoice: 'in_…' (resource_missing) | | curl with -d but no -G | HTTP 400 Received unknown parameter: limit (it was a POST) | | Node for await over the list, default vs limit:100 | 21 vs 3 requests (p50 0.45 s vs 0.61 s per request) | | Python: iterating Invoice.list() directly | 10 items, 1 request (no auto-pagination) | | New invoice → visible in Search, 10 runs | p50 28.2 s, min 13.0 s, max 39.6 s | | Metadata update → new value searchable, 10 runs | p50 21.9 s, max 34.7 s; old value still matched in 5/10 | | Hosted MCP stripe_api_read, 100 invoices | one 214 KB tool result |

Stripe `limit` above 100 is clamped, not rejected (list endpoints only)

The API reference says limit ranges "between 1 and 100". On /v1/invoices we got:

log
limit=101  → HTTP 200 {"n":100,"has_more":true}limit=1000 → HTTP 200 {"n":100,"has_more":true}limit=0    → HTTP 200 {"n":1,"has_more":true}limit=abc  → HTTP 400 Invalid integer: abc

The same happened with Stripe-Version 2020-08-27, 2024-06-20 and 2025-03-31.basil. An agent that sends limit=1000 "to get everything in one call" gets 100 rows and no error. It has to read has_more. The Search endpoint behaves differently and rejects 101 and 0 with a 400. Evidence: curl_limits.log.

A deleted `starting_after` cursor breaks Stripe pagination

We read page 1 (limit=100), deleted its last draft invoice, then asked for page 2 with that id as starting_after:

log
HTTP 400 {"error":{"code":"resource_missing","message":"No such invoice: 'in_1Ui13CGgVEIFVw8NrFizKwQs'","param":"starting_after","type":"invalid_request_error"}}

ending_before with that id fails the same way. stripe-node's for await auto-pager throws StripeInvalidRequestError: [req_…] No such invoice after 100 items. This bites cleanup jobs that delete or void-and-delete while paging. A walker that survives it: on resource_missing, retry with created[lte]=<cursor's created> and skip ids already seen. In our run it recovered all 203 invoices in 5 requests and missed none against a fresh full listing (py_autopage.py, py_autopage.log). Collecting ids first and deleting afterwards also avoids it. Using another object's id (starting_after=cus_… on invoices) gives No such invoice: 'cus_…'.

Auto-pagination in stripe-node vs stripe-python

  • stripe-node 23.2.0: for await (const i of stripe.invoices.list({limit: 100})) walks every page. Leaving out limit still works, but takes 21 requests instead of 3. autoPagingToArray() without a limit throws `You must pass a limit option to autoPagingToArray, and above 10,000 it throws You cannot specify a limit of more than 10,000 items`.
  • stripe-python 17.1.0: for i in stripe.Invoice.list(customer=…) yields the first 10 only. You need .auto_paging_iter(), which also works on StripeClient().v1.invoices.list(...) (3 requests at limit=100).
  • Backwards: with ending_before=<oldest id>, both SDKs yield ascending order (oldest first). Raw curl pages stay newest-first, so the next ending_before is data[0].id, not data[-1].id.

Logs: node_autopage.log, py_autopage.log, curl_pagination.log.

Stripe Search API lag: 13–40 s before a new invoice is searchable

Each run created an invoice with a unique metadata['fresh'] value, then polled /v1/invoices/search about every 1.3 s. Over 10 runs (plus 3 pilot runs at 16, 28 and 31 s), the new invoice appeared after a median of 28.2 s (13.0–39.6 s). GET /v1/invoices showed it on the very next call in 13/13 runs. Stripe's docs say "under normal operating conditions, data is searchable in less than a minute", so this is within spec. It is still far too slow for "create, then search to confirm".

After a metadata update, the new value became searchable after a median of 21.9 s. In 5/10 runs the *old* value still matched at that moment. Deleted draft invoices dropped out quickly. In 4/10 runs they stayed in results for 1.6–16 s with "status": "deleted". Filter on status, or re-fetch by id. Raw: search_freshness.log.

Stripe Search pagination uses `page`/`next_page`, not `starting_after`

/v1/invoices/search returns next_page, an opaque base64 cursor (it decoded to [created, id, …]), and you pass it back as page. Our 3 pages returned 203 rows while expand[]=total_count said 202: the extra row was a just-deleted invoice. Errors as returned:

log
starting_after=…   → Received unknown parameter: starting_afterpage=garbage       → `garbage` isn't a valid page cursor. Pass the `next_page` value returned by your previous search request.query=customer:cus_… (unquoted) → Ensure you have properly quoted values while searching. Try updating your query to `customer:"cus_…"`

A 100-row search page took a median of 1.77 s, against 0.61 s for a 100-row list page. Stripe's docs also say search is "not available to merchants in India". Our sandbox was a US account. Evidence: curl_search.log, latency.log.

Paging Stripe through the hosted MCP or the CLI

mcp.stripe.com accepts a test secret key as Authorization: Bearer (no OAuth needed) and lists 9 generic tools (25.7 KB). stripe_api_read with GetInvoices and limit: 100 put 214 KB of invoice JSON into one tool result, about 2.1 KB per draft invoice, so an agent should ask for small pages. The tool result passes has_more through, so paging stays manual. The CLI (stripe invoices list --limit 1000) also returns one page of 100 with has_more: true and has no auto-paging flag (cli_list.log). Details: webhooks post repro/mcp.

Method, all files and extra numbers: repro/NOTES.md. Outdated if Stripe starts rejecting limit>100 on list endpoints or changes the Search SLA.