How to Create a JSON Mock API Endpoint in Under 2 Minutes

A quick, practical tutorial showing you how to create a JSON mock API endpoint in under two minutes using Mockable — no coding required.

How to Create a JSON Mock API Endpoint in Under 2 Minutes

Why You Need a JSON Mock API Endpoint Right Now

Whether you are prototyping a new feature, writing a tutorial, building a demo, or unblocking your frontend team, having a JSON mock API endpoint available instantly is invaluable. In this tutorial you will see how to go from zero to a working mock API URL in under two minutes — no coding, no server, no DevOps.

Prerequisites

  • A free Mockable account (sign up takes 30 seconds)
  • A browser
  • The JSON response you want to return

Step 1: Create a New Mock Service (30 seconds)

After logging in, click New Mock Service. Enter a name — for example, my-project-api. Mockable generates a unique subdomain for your service: https://my-project-api.mockable.io. Every endpoint you create lives under this domain.

Step 2: Add Your First Endpoint (60 seconds)

Click Add Response and fill in the form:

  • HTTP Method: GET
  • Path: /users
  • HTTP Status: 200
  • Content-Type: application/json
  • Response Body:
[
  {
    "id": 1,
    "name": "Alice Johnson",
    "email": "alice@example.com",
    "role": "admin",
    "createdAt": "2024-11-15T09:30:00Z"
  },
  {
    "id": 2,
    "name": "Bob Smith",
    "email": "bob@example.com",
    "role": "user",
    "createdAt": "2025-01-03T14:20:00Z"
  }
]

Click Save.

Step 3: Test Your Mock API Endpoint (30 seconds)

Open a new browser tab and visit https://my-project-api.mockable.io/users. You should see your JSON response returned immediately. Alternatively, test it with cURL:

curl https://my-project-api.mockable.io/users

Or in Postman: create a new GET request, paste the URL, and hit Send.

Useful Variations to Know

Return a 404 Not Found

Add a second endpoint with path /users/999, status 404, and body:

{ "error": "User not found" }

Simulate a POST Endpoint

Change the method to POST and set path /users with status 201 and body:

{ "id": 3, "message": "User created successfully" }

Add Response Delay

Enable the delay option and set it to 800 milliseconds to simulate a realistic network call. This is useful for testing loading spinners and timeout handling.

Custom Response Headers

Add a X-Rate-Limit-Remaining: 99 header to simulate rate-limiting headers from a real API.

How to Use Your Mock Endpoint in a JavaScript App

const response = await fetch('https://my-project-api.mockable.io/users');
const users = await response.json();
console.log(users); // Array of user objects

Replace the Mockable URL with your real API URL when the backend is ready — no other changes needed.

Conclusion

Creating a JSON mock API endpoint takes literally under two minutes with Mockable. There is no better way to unblock your development workflow, validate a UI concept, or set up reliable automated tests. The free tier is generous enough for individual developers and small teams.

Create your free mock API now and have a working endpoint before you finish your coffee.