Skip to main content
Back to Dev generators

Dev

Mock Pagination Metadata Generator

Used by developers, writers, and creators worldwide.

The mock pagination metadata generator produces realistic API pagination blocks in JSON, HTTP Link header, and envelope formats — ready to drop into test fixtures, mock servers, or API docs without touching a real backend. Pagination edge cases are notoriously easy to miss: the first page with no previous link, a last page where items don't fill the full page size, or a single-page result where pagination controls should vanish entirely. Set the format to match your API's actual response shape, generate several blocks at once, and cover all those states in minutes. Frontend devs, backend engineers, and QA teams all use it to stop hand-crafting page numbers by hand.

Loading usage…

Free forever — no account required

How to use

  1. Choose your options above
  2. Click Generate
  3. Copy your result

Detailed instructions

  1. Select the format that matches your API: JSON, Link Header, or Envelope.
  2. Set the count field to the number of pagination blocks you need, typically four to eight for full page-state coverage.
  3. Click Generate to produce the metadata blocks.
  4. Copy individual blocks and paste them into your fixture files, Postman examples, or OpenAPI spec.
  5. For sequential page simulation, assign blocks in order from first to last page in your test setup.

Use Cases

  • Seeding a Postman mock server with first, middle, and last-page states to test UI boundary conditions
  • Populating Storybook stories for a pagination component with realistic total, perPage, and page values
  • Pasting RFC 5988 Link header output into a queryFn to test React Query's next-page fetching logic
  • Adding concrete JSON examples under paginated list endpoints in an OpenAPI or Redoc spec
  • Building Pact contract fixtures that cover empty-last-page and single-result edge cases

Tips

  • Generate exactly four blocks and label them first-page, mid-page, last-page, and single-page to cover every pagination boundary condition in one pass.
  • When using Link header format, run the output through the npm package parse-link-header locally to verify your parsing code handles it before wiring up tests.
  • For Storybook, create one story per pagination state rather than one story with a toggle — it makes visual regression testing far more reliable.
  • Envelope format works best for mobile API contracts because the client parses one JSON body instead of splitting logic between headers and body.
  • If your API uses a different field name like offset or pageIndex instead of page, generate JSON format and do a find-replace before committing to fixtures.
  • Pair this generator with a mock data generator for the data array inside envelope blocks so Storybook stories render fully populated list components.

FAQ

how do I mock pagination data for multiple page states in frontend tests

Set the count input to four or more so you get blocks representing the first page, middle pages, last page, and a single-page result in one go. Each block has different page numbers, totals, and link values, so you can assign one block per test case or Storybook story without manually editing numbers. Drop them directly into fixture files or Postman examples.

what's the difference between JSON, Link header, and envelope pagination formats

JSON format gives you a plain object with page, perPage, total, and totalPages fields — the most common shape for custom REST APIs. Link header output follows RFC 5988 with rel values for first, prev, next, and last, matching what GitHub's API returns and what libraries like parse-link-header can parse. Envelope format wraps a data array alongside meta and links objects, which matches JSON:API and Laravel Paginator conventions.

are the generated totals consistent across blocks if I need to simulate the same dataset

Each block is generated with randomized but realistic values, so totals can differ between blocks. If you need all blocks to represent pages from the same collection, generate a batch, pick one total value, and align the total field across them before committing them to your fixtures. That takes about thirty seconds and gives you a coherent multi-page sequence.