NetworkNew

Mock REST API with Fake Users, Posts and Todos

Free fake REST API with users, posts, todos, comments and products for testing

100% client-side — your data never leaves your browserNo data stored or uploadedFree for lifetime · No signup
Base URL
https://techloghub.com/api/mock

CORS is open to every origin, no API key or sign-up. Data is generated, deterministic and identical on every request.

Resources
  • https://techloghub.com/api/mock/users30 records
  • https://techloghub.com/api/mock/posts100 records · filter by userId
  • https://techloghub.com/api/mock/todos100 records · filter by userId, completed
  • https://techloghub.com/api/mock/comments200 records · filter by postId
  • https://techloghub.com/api/mock/products50 records · filter by category
Routes
  • GET/api/mock/{resource}

    List records, up to 100 per page. Total in the X-Total-Count header.

  • GET/api/mock/{resource}?_page=2&_limit=10

    Paginate. _limit is capped at 100; a page past the end returns [].

  • GET/api/mock/{resource}/{id}

    One record, or 404 with a JSON error when the id does not exist.

  • POST/api/mock/{resource}

    Validates the JSON body and returns it with a new id and 201. Not saved.

  • PUT/api/mock/{resource}/{id}

    Returns the body as the replacement record. Not saved.

  • PATCH/api/mock/{resource}/{id}

    Returns the record merged with the body. Not saved.

  • DELETE/api/mock/{resource}/{id}

    Returns 200 and {}. The record is still there on the next GET.

Try it
/api/mock

What is a mock API?

A mock API is a stand-in for a real backend: it answers HTTP requests with realistic, predictable JSON so you can build and test the code that calls an API before the real one exists, without credentials, or without touching production data. Frontend developers use one to wire up lists, detail pages and forms; people learning fetch, axios or React Query use one so the only moving part is their own code; test suites use one for fixtures that never change.

This one is a read-only fake REST API in the style of JSONPlaceholder. It serves five resources — 30 users, 100 posts, 100 todos, 200 comments and 50 products — generated from a seeded random generator, so /api/mock/users/1 returns exactly the same record on every request, every day. Relationships are consistent: every post and todo has a userId between 1 and 30, and every post has two comments (postId 1 owns comments 1 and 2).

Endpoints, pagination and filtering

Lists: GET /api/mock/{resource}. A list returns at most 100 records; use _page and _limit to paginate (GET /api/mock/posts?_page=2&_limit=10 returns posts 11 to 20). _limit above 100 is capped at 100, and a page past the end returns an empty array rather than an error. Each list response carries the total number of matching records in an X-Total-Count header and first, prev, next and last URLs in a Link header, both exposed to browsers through CORS.

Single records: GET /api/mock/{resource}/{id} returns the record, or a 404 with a JSON error body when the id does not exist — useful for testing your not-found handling. Filters: posts?userId=1, todos?userId=1 or todos?completed=true, comments?postId=1 and products?category=books narrow a list by exact match before pagination.

Writes: POST /api/mock/{resource} returns your JSON body with a new id and 201 Created; PUT returns the body as the replacement record; PATCH returns the existing record merged with your fields; DELETE returns 200 and {}. Bodies must be a JSON object of at most 32 KB, otherwise you get a 400 or 413, which makes the API handy for testing validation errors too.

Use it with fetch, axios, Postman and in tests

fetch: const users = await fetch('https://techloghub.com/api/mock/users').then(r => r.json());

Create a post with fetch: await fetch('https://techloghub.com/api/mock/posts', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ title: 'Hello', userId: 1 }) }) — the response is the created object with id 101.

axios: const { data, headers } = await axios.get('https://techloghub.com/api/mock/todos', { params: { userId: 3, _limit: 5 } }); headers['x-total-count'] holds the total for building a pager.

curl: curl -i 'https://techloghub.com/api/mock/products?category=audio'.

Postman or Insomnia: paste any endpoint URL into a new request; no auth or API key is needed. In automated tests, the fixed data lets you assert on exact values (users/1 always has the same name and email), and the 404, 400 and 413 responses cover error paths. For tests that must run offline or in CI without network access, keep a copy of the responses you need as local fixtures or use a request-mocking library such as MSW instead.

Limitations

Nothing you send is stored. A POST returns a new id but a following GET for that id is a 404; a PATCH or DELETE does not change what the next GET returns. That is deliberate — the API is shared by everyone, so it behaves the same for every caller, and the data effectively resets on every request.

There is no search, sorting or nested route such as /posts/1/comments (use comments?postId=1), no authentication to test against, and write requests are rate limited per IP address. The data is generated filler, not real people or products. For a persistent fake backend you control, run json-server locally against your own db.json.

How to use the Mock REST API with Fake Users, Posts and Todos tool

  1. 1

    Pick a resource

    Choose users, posts, todos, comments or products and copy its endpoint URL from the list above.

  2. 2

    Call it from your code

    Use fetch, axios, curl or Postman. No sign-up or API key; CORS allows any origin, including localhost.

  3. 3

    Paginate and filter

    Add _page and _limit (max 100) and filters such as userId or postId; read the total from the X-Total-Count header.

  4. 4

    Test writes and errors

    POST, PUT, PATCH and DELETE return realistic responses without saving anything; unknown ids return 404 and bad JSON returns 400.

Frequently asked questions

Is this mock API free, and do I need an API key?

It is free and needs no key, account or sign-up. CORS is open to every origin, so you can call it from a browser app on localhost as well as from a server or test runner. Write requests are rate limited per IP to keep it fair.

Are POST, PUT, PATCH and DELETE requests saved?

No. They are validated and answered with a plausible response — a POST gets a 201 and a new id — but nothing is persisted, so the next GET returns the original data. Use json-server locally if you need writes that stick.

Does the data change between requests?

No. Records are generated from a fixed seed, so the same id returns the same record every time, which makes the API safe to assert against in tests.

How is this different from JSONPlaceholder?

The idea and the _page/_limit conventions are the same. This API adds a products resource, caps pages at 100 records, returns JSON error bodies for 404, 400 and 413, and sends a Link header for pagination. JSONPlaceholder has nested routes like /posts/1/comments and photos/albums resources, which this one does not.

Can I use it in automated tests or CI?

Yes, as long as the test environment has internet access; GET responses are stable and sent with public cache headers. For hermetic tests that must not depend on the network, record the responses you need as fixtures or mock the requests with a library like MSW.

Related on TechLogHub

Get the next tool before you need it

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.