The Problem with Mock APIs
Every frontend developer has been here: you're building a React dashboard, a mobile app, or prototyping a new feature. You need a backend. But the real API isn't ready yet, or you just need something quick and disposable.
Your options are usually: - JSONPlaceholder — read-only, fixed data, can't POST/PUT/DELETE - Mock Service Worker — great, but requires setup and lives in your codebase - Spin up Express — overkill for a 30-minute prototype - Postman Mock — requires an account and configuration
What if you could just paste JSON and get a live CRUD API in under 60 seconds?
Step 1: Define Your Data
Start with any valid JSON array. This will become your initial database. Here's an example — a simple product catalog:
[
{
"id": 1,
"name": "Wireless Headphones",
"price": 79.99,
"category": "electronics",
"inStock": true
},
{
"id": 2,
"name": "Mechanical Keyboard",
"price": 149.99,
"category": "electronics",
"inStock": true
},
{
"id": 3,
"name": "Standing Desk",
"price": 599.99,
"category": "furniture",
"inStock": false
}
]Step 2: Paste into the Stateful API Tool
Open the Stateful API tool on Antimass Labs. Paste your JSON into the payload editor and hit Deploy. That's it.
You'll instantly receive a unique endpoint URL like:
https://antimasslabs.com/api/mock/abc123
This endpoint is now a fully stateful REST API backed by Redis on Cloudflare's edge network. It supports:
| Method | Endpoint | Action |
|---|---|---|
| GET | /api/mock/{id} | Fetch all items or single item by payload key |
| POST | /api/mock/{id} | Add a new item to the collection |
| PUT | /api/mock/{id} | Update an existing item by key |
| DELETE | /api/mock/{id} | Remove an item from the collection |
Step 3: Test with curl or fetch
Your API is live. Test it immediately:
# GET all items
curl https://antimasslabs.com/api/mock/abc123
# POST a new item
curl -X POST https://antimasslabs.com/api/mock/abc123 \
-H "Content-Type: application/json" \
-d '{"id": 4, "name": "USB-C Hub", "price": 39.99, "category": "electronics", "inStock": true}'
# PUT (update) an item
curl -X PUT https://antimasslabs.com/api/mock/abc123 \
-H "Content-Type: application/json" \
-d '{"id": 2, "name": "Mechanical Keyboard", "price": 129.99, "category": "electronics", "inStock": true}'
# DELETE an item
curl -X DELETE https://antimasslabs.com/api/mock/abc123 \
-H "Content-Type: application/json" \
-d '{"id": 3}'Using with React / Next.js
Here's how to use your mock API in a React component:
'use client';
import { useState, useEffect } from 'react';
const API_URL = 'https://antimasslabs.com/api/mock/abc123';
export default function ProductList() {
const [products, setProducts] = useState([]);
useEffect(() => {
fetch(API_URL)
.then(res => res.json())
.then(data => setProducts(data.payload || []));
}, []);
const addProduct = async (product) => {
await fetch(API_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(product),
});
// Refresh
const res = await fetch(API_URL);
const data = await res.json();
setProducts(data.payload || []);
};
return (
<ul>
{products.map(p => (
<li key={p.id}>{p.name} — ${p.price}</li>
))}
</ul>
);
}Self-Cleaning Endpoints
Every mock endpoint created on Antimass Labs has a 24-hour TTL (time-to-live). After 24 hours, the endpoint and all its data are automatically purged from Redis.
This design is intentional: - No stale mock servers cluttering infrastructure - No accidental production usage — endpoints are clearly temporary - No cleanup required — create, test, forget - Privacy-first — your test data is automatically deleted
Need persistent endpoints? Keep the Stateful API tool open — creating a new deployment resets the TTL. For CI/CD pipelines, simply generate a fresh endpoint at the start of each test run.