Mock REST API

Create a Mock REST API Online

Create hosted REST endpoints with your own JSON responses. Use GET, POST, PUT, PATCH or DELETE and connect your frontend to a working API before the production backend is ready.

No backend server or local mock server required.

Working example

Give your frontend a real REST endpoint now

Suppose your application needs a /products endpoint, but the backend team has not built it yet. Create the route in Forge API and return the JSON structure your frontend expects.

GET/products200 OK

https://apis.getforgeapi.com/YOUR_PROJECT_KEY/products

GET /products responsejson
[
  {
    "id": 1,
    "name": "Wireless Headphones",
    "price": 79.99,
    "inStock": true
  },
  {
    "id": 2,
    "name": "Mechanical Keyboard",
    "price": 109.99,
    "inStock": true
  }
]

Use the endpoint

Call your mock REST API like a normal backend

Forge API gives you a hosted HTTPS URL, so your application uses a normal HTTP request rather than importing hard-coded test data into the frontend.

Frontend examplets
const API_BASE_URL =
  "https://apis.getforgeapi.com/YOUR_PROJECT_KEY";

const response = await fetch(`${API_BASE_URL}/products`);

if (!response.ok) {
  throw new Error(`API request failed: ${response.status}`);
}

const products = await response.json();
Terminalbash
curl https://apis.getforgeapi.com/YOUR_PROJECT_KEY/products

REST methods

Mock the routes your application expects

Create resource-style routes using the HTTP methods planned for your production REST API.

MethodExample routeFrontend scenario
GET/productsLoad a list of products
POST/productsTest a create-product form
PUT/products/1Test replacing a resource
PATCH/products/1Test a partial update
DELETE/products/1Test deletion and confirmation UI

Test real UI states

Test more than the happy path

A useful mock API should help you build the states users see when requests are slow or unsuccessful, not just return perfect data every time.

Custom JSON responses

Return the exact objects, arrays and nested fields your interface expects.

HTTP status codes

Build frontend behaviour for successful and unsuccessful requests.

Response delays

Keep loading states visible long enough to design and test them properly.

Response headers

Model additional HTTP response behaviour required by your integration.

GET/products
Status
500
Delay
1500ms
Error responsejson
{
  "error": "Unable to load products"
}

Build the UI before the failure happens

Use predictable responses to design loading indicators, error messages, retry buttons and empty states before connecting to production services.

Move to production later

Keep your API base URL in one place

Your frontend should depend on the API contract, not the temporary backend implementation. Keep the base URL centralized and use the same endpoint paths throughout the application.

During developmentts
const API_BASE_URL =
  "https://apis.getforgeapi.com/YOUR_PROJECT_KEY";
Application requeststs
fetch(`${API_BASE_URL}/products`);
fetch(`${API_BASE_URL}/users`);
fetch(`${API_BASE_URL}/orders`);

When the real REST API is ready, change the base URL:

Productionts
const API_BASE_URL =
  "https://api.example.com";

Your components can stay unchanged

If the production API uses the same routes and response shapes, switching from Forge API can be as simple as replacing the base URL.

Frequently asked questions

Mock REST API questions

What is a mock REST API?

A mock REST API provides HTTP endpoints that imitate the routes and responses of a production REST API. It lets frontend and mobile development continue before the real backend is available.

How do I create a mock REST API without a backend?

Create the routes your application expects, choose the HTTP methods, define the JSON responses and use the generated Forge API URLs from your frontend.

Which REST API methods can I use?

Forge API supports GET, POST, PUT, PATCH and DELETE endpoints.

Can I use a mock REST API with React or Next.js?

Yes. Forge API endpoints are standard hosted HTTPS URLs and can be called from React, Next.js, React Native, Vue, Angular and other applications.

Can I test error and loading states?

Yes. Controlled responses let you test different frontend states, including unsuccessful responses and delayed responses.

What happens when my real backend is ready?

If the production backend uses the same routes and response shapes, you can replace the Forge API base URL with the production API URL without rewriting your components.

Build your frontend before the backend is ready

Create REST endpoints with your own routes and JSON responses and connect your application to a hosted API URL.