Mock a paginated JSON API response

A GET mock that returns a page of three fake records alongside page, per_page, total, and next.

This template returns one page of a paginated JSON collection — three fake records alongside page, per_page, total and next — so you can build list rendering, infinite scroll or a paging client before the real endpoint exists. The records regenerate on every call, which makes it a good test of code that must not assume stable ordering.

Stands in for a third-party API endpoint.

Response payload

{"data":[{"id":"{{faker.uuid}}","name":"{{faker.name}}","email":"{{faker.email}}"},{"id":"{{faker.uuid}}","name":"{{faker.name}}","email":"{{faker.email}}"},{"id":"{{faker.uuid}}","name":"{{faker.name}}","email":"{{faker.email}}"}],"page":1,"per_page":3,"total":42,"next":"{{mock.url}}?page=2"}

Fields worth knowing

Field What it means
data An array of fake records, three per call via {{faker.*}} tokens.
page The current page number, hardcoded to 1.
per_page The page size, hardcoded to 3.
total The total record count across all pages, hardcoded to 42.
next The URL for the next page, built from the {{mock.url}} token so it points at this mock.

Create the mock

curl -X POST https://quickmock.dev/api/mocks \
  -H 'Content-Type: application/json' \
  -d '{
  "method": "GET",
  "response_status": 200,
  "content_type": "application/json",
  "response_body": "{\"data\":[{\"id\":\"{{faker.uuid}}\",\"name\":\"{{faker.name}}\",\"email\":\"{{faker.email}}\"},{\"id\":\"{{faker.uuid}}\",\"name\":\"{{faker.name}}\",\"email\":\"{{faker.email}}\"},{\"id\":\"{{faker.uuid}}\",\"name\":\"{{faker.name}}\",\"email\":\"{{faker.email}}\"}],\"page\":1,\"per_page\":3,\"total\":42,\"next\":\"{{mock.url}}?page=2\"}"
}'

Call it

curl https://quickmock.dev/m/<slug>

What you get

GET /m/<slug> -> 200 a paginated list of 3 fake records
page/per_page/total/next describe the rest of the collection

How this differs from the real thing

The three records are random and regenerate on every call instead of coming from a stable dataset, and next points back at this same mock rather than at a real second page.

Sources

FAQ

Does the next link actually work?
It is followable: next is built from the {{mock.url}} token, so it resolves to this mock's own address. Following it returns the same page again rather than page two — see the next question for how to chain a real second page.
How do I mock a second page?
Create a second mock with page set to 2 and its own next value, then point the first mock's next at it. Two chained mocks are enough to test that your client stops at the end instead of looping.
Why do the records change between calls?
They are generated fresh with faker tokens on each request. That is deliberate: a client that keys list items by array index rather than by id will visibly break, which is exactly the bug worth catching early.

Ready to use it?

Open it in the mock builder to tweak first

Pairs well with this guide: Return realistic fake data

Related templates

← All templates

Last updated: 2026-10-17