MockApiHub — Documentation

Everything you need to call the API, test endpoints, and drop code into your app.

Get Started

  1. Confirm your base URL: https://mockapihub.com
  2. Hit your first endpoint: https://mockapihub.com/api/users
  3. Open the Playground to try requests interactively. Playground

Base URL

By default, requests are served from the same origin.

https://mockapihub.com

Endpoints

Writes (POST / PATCH / DELETE) return a realistic, shape-correct response but data is not persisted. The next GET returns the same deterministic data as before.
MethodPathDescription
GET/api/usersList users (search & paginate)
GET/api/users/:idGet user by ID
POST/api/usersCreate a user — not persisted, returns the new shape.
PATCH/api/users/:idUpdate a user — not persisted, echoes the patch.
DELETE/api/users/:idDelete a user — not persisted, returns { success: true, id }.
GET/api/users/:id/postsList posts authored by this user.
GET/api/users/:id/todosList todos owned by this user.
GET/api/postsList posts (search & paginate)
GET/api/posts/:idGet post by ID
GET/api/posts/:id/commentsList comments on this post.
GET/api/productsList products
GET/api/recipesList recipes
GET/api/todosList todos
GET/api/commentsList comments

OpenAPI & Postman

Try every endpoint live, download the spec, or import it into Postman in one click.

Auth

Almost all endpoints are public, but some may require keys. In that case, send:

Authorization: Bearer <access_key>

Examples

cURL

BASH
curl "https://mockapihub.com/api/users"

JavaScript (fetch)

JS
await fetch("https://mockapihub.com/api/posts")
  .then(r => r.json())

Python

PY
import requests
res = requests.get("https://mockapihub.com/api/users")
print(res.json())
Documentation — MockApiHub