GitHub

Documentation

Welcome to the mockapi.run documentation. Our API provides high-quality, predictable mock data for your frontend development needs. Whether you're building a prototype, testing your application, or creating a tutorial, our endpoints are ready to use instantly.

Usage

All endpoints are available over HTTPS at https://mockapi.run/api/*. You can use any standard HTTP client or the fetch API to interact with them.

JAVASCRIPT FETCH
fetch("https://mockapi.run/api/*")
  .then(res => res.json())
  .then(data => console.log(data))

Companies

Company profiles with related products, comments, locations and hiring stats.

GET /companies Open endpoint
Returns a list of companies with profile, hiring and location data.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "name": "Northstar Labs",
    "industry": "developer-tools",
    "verified": true
  }
]
GET /companies/1 Open endpoint
Returns a single company by ID.
SAMPLE RESPONSE
{
  "id": 1,
  "name": "Northstar Labs",
  "slug": "northstar-labs",
  "status": "active",
  "website": "https://northstarlabs.dev"
}
GET /companies?<field>=<value> Open endpoint
The query layer is flexible: use any company field and match by value. Nested fields work too, for example `location.city` or `headquarters.currency`.
SUPPORTED EXAMPLES
{
  "examples": [
    "/companies?industry=developer-tools",
    "/companies?verified=true",
    "/companies?location.country=United States",
    "/companies?headquarters.currency=USD"
  ]
}
GET /companies?fields=id,name,industry,website Open endpoint
Returns only selected company fields.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "name": "Northstar Labs",
    "industry": "developer-tools",
    "website": "https://northstarlabs.dev"
  }
]
GET /companies/1/products Open endpoint
Returns products associated with a specific company.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "companyId": 1,
    "title": "Keychron Studio 60% Keyboard 1"
  }
]
GET /companies/1/comments Open endpoint
Returns comments associated with a specific company.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "companyId": 1,
    "productId": 1,
    "body": "The typing experience feels great for long sessions."
  }
]

Users

User profiles, search, filters, roles and related resources.

GET /users Open endpoint
Returns a list of users with basic profile data.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "name": "Leanne Graham",
    "email": "sincere@april.biz"
  }
]
GET /users/1 Open endpoint
Returns a single user by ID.
SAMPLE RESPONSE
{
  "id": 1,
  "name": "Leanne Graham",
  "username": "Bret",
  "email": "sincere@april.biz",
  "role": "admin"
}
GET /users?<field>=<value> Open endpoint
The query layer is flexible: use any user field and match by value. Nested fields work too, for example `company.name` or `address.city`.
SUPPORTED EXAMPLES
{
  "examples": [
    "/users?role=admin",
    "/users?status=active",
    "/users?company.name=Romaguera-Crona",
    "/users?address.city=Gwenborough"
  ]
}
GET /users?fields=id,name,email Open endpoint
Returns only selected user fields.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "name": "Leanne Graham",
    "email": "sincere@april.biz"
  }
]
GET /users/1/posts Open endpoint
Returns posts created by a specific user.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "title": "Understanding REST APIs"
  }
]
GET /users/1/comments Open endpoint
Returns comments created by a specific user.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "postId": 1,
    "body": "Really useful article!"
  }
]
GET /users/1/todos Open endpoint
Returns todos assigned to a specific user.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "title": "Prepare API mocks 1",
    "completed": false
  }
]

Posts

Blog posts, articles, authors, tags and publishing states.

GET /posts Open endpoint
Returns a list of posts.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "title": "Understanding REST APIs",
    "published": true
  }
]
GET /posts/1 Open endpoint
Returns a single post by ID.
SAMPLE RESPONSE
{
  "id": 1,
  "title": "Understanding REST APIs",
  "body": "REST APIs allow communication between services.",
  "published": true
}
GET /posts?<field>=<value> Open endpoint
The query layer is flexible: use any post field and match by value. Nested fields work too, for example `author.username` or `seo.metaTitle`.
SUPPORTED EXAMPLES
{
  "examples": [
    "/posts?userId=1",
    "/posts?category=frontend",
    "/posts?published=true",
    "/posts?author.username=bret",
    "/posts?seo.metaTitle=Understanding REST APIs"
  ]
}
GET /posts?fields=id,title,slug Open endpoint
Returns only selected post fields.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "title": "Understanding REST APIs",
    "slug": "understanding-rest-apis"
  }
]
GET /posts/1/comments Open endpoint
Returns comments belonging to a specific post.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "userId": 2,
    "body": "Really useful article!"
  }
]

Comments

Comments related to posts, todos, users, products and companies.

GET /comments Open endpoint
Returns a list of comments with post, product, company and author references.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "postId": 1,
    "productId": 1,
    "companyId": 1,
    "userId": 2,
    "body": "Really useful article!"
  }
]
GET /comments/1 Open endpoint
Returns a single comment by ID.
SAMPLE RESPONSE
{
  "id": 1,
  "postId": 1,
  "productId": 1,
  "companyId": 1,
  "userId": 2,
  "body": "Really useful article!",
  "status": "approved"
}
GET /comments?<field>=<value> Open endpoint
The query layer is flexible: use any comment field and match by value. Nested fields work too, for example `author.username` or `post.slug`.
SUPPORTED EXAMPLES
{
  "examples": [
    "/comments?postId=1",
    "/comments?productId=1",
    "/comments?companyId=1",
    "/comments?userId=2",
    "/comments?status=approved",
    "/comments?author.username=bret",
    "/comments?post.slug=understanding-rest-apis"
  ]
}
GET /comments?fields=id,body,userId,postId,productId,companyId Open endpoint
Returns only selected comment fields.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "body": "Really useful article!",
    "userId": 2,
    "postId": 1,
    "productId": 1,
    "companyId": 1
  }
]
GET /comments/1/post Open endpoint
Returns the post associated with a comment.
SAMPLE RESPONSE
{
  "id": 1,
  "title": "Understanding REST APIs"
}
GET /comments/1/product Open endpoint
Returns the product associated with a comment.
SAMPLE RESPONSE
{
  "id": 1,
  "title": "Keychron Studio 60% Keyboard 1"
}
GET /comments/1/user Open endpoint
Returns the author of a comment.
SAMPLE RESPONSE
{
  "id": 2,
  "name": "Ervin Howell"
}
GET /comments/1/company Open endpoint
Returns the company associated with a comment.
SAMPLE RESPONSE
{
  "id": 1,
  "name": "Northstar Labs"
}

Products

Catalog products with pricing, inventory, company ownership and comment relations.

GET /products Open endpoint
Returns a list of products with catalog and pricing data.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "companyId": 1,
    "title": "Keychron Studio 60% Keyboard 1",
    "price": 129.99,
    "stock": 42
  }
]
GET /products/1 Open endpoint
Returns a single product by ID.
SAMPLE RESPONSE
{
  "id": 1,
  "companyId": 1,
  "title": "Keychron Studio 60% Keyboard 1",
  "slug": "keychron-studio-60-keyboard-1",
  "brand": "Keychron",
  "price": 129.99,
  "status": "active"
}
GET /products?<field>=<value> Open endpoint
The query layer is flexible: use any product field and match by value. Nested fields work too, for example `seller.name` or `shipping.freeShipping`.
SUPPORTED EXAMPLES
{
  "examples": [
    "/products?companyId=1",
    "/products?brand=Keychron",
    "/products?category=mechanical-keyboards",
    "/products?featured=true",
    "/products?seller.name=Northwind Devices",
    "/products?shipping.freeShipping=true"
  ]
}
GET /products?fields=id,title,price,stock Open endpoint
Returns only selected product fields.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "companyId": 1,
    "title": "Keychron Studio 60% Keyboard 1",
    "price": 129.99,
    "stock": 42
  }
]
GET /products/1/company Open endpoint
Returns the company associated with a specific product.
SAMPLE RESPONSE
{
  "id": 1,
  "name": "Northstar Labs"
}
GET /products/1/comments Open endpoint
Returns comments associated with a specific product.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "productId": 1,
    "userId": 2,
    "body": "The typing experience feels great for long sessions."
  }
]

Todos

Task management items assigned to users and linked with comment activity.

GET /todos Open endpoint
Returns a list of todos assigned to users.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "userId": 1,
    "title": "Prepare API mocks 1",
    "completed": false
  }
]
GET /todos/1 Open endpoint
Returns a single todo by ID.
SAMPLE RESPONSE
{
  "id": 1,
  "userId": 1,
  "title": "Prepare API mocks 1",
  "completed": false,
  "priority": "high"
}
GET /todos?<field>=<value> Open endpoint
The query layer is flexible: use any todo field and match by value. Nested fields work too, for example `assignedTo.username` or `metadata.pinned`.
SUPPORTED EXAMPLES
{
  "examples": [
    "/todos?userId=1",
    "/todos?completed=false",
    "/todos?priority=high",
    "/todos?assignedTo.username=bret",
    "/todos?metadata.pinned=true"
  ]
}
GET /todos?fields=id,title,completed,userId Open endpoint
Returns only selected todo fields.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "title": "Prepare API mocks 1",
    "completed": false,
    "userId": 1
  }
]
GET /todos/1/user Open endpoint
Returns the user assigned to a specific todo.
SAMPLE RESPONSE
{
  "id": 1,
  "name": "Leanne Graham",
  "username": "Bret"
}
GET /todos/1/comments Open endpoint
Returns comments associated with a specific todo.
SAMPLE RESPONSE
[
  {
    "id": 1,
    "userId": 2,
    "body": "Really useful article!"
  }
]