How to use Mockify
Mockify turns a short description into mock JSON and a temporary API endpoint. This page shows how to call that endpoint from your code, what the answer looks like, and what limits apply.
Open the generatorQuick start
- Open the generator and describe your data in the prompt, press a template, or add your own fields.
- Choose how many records you need and press Generate.
- Copy the endpoint link. It ends with /api/mock/ and a long id.
- Send a GET request to that link from your code. No login and no API key are needed.
Do not write real personal data in your prompt. The Terms of Service ask you not to submit personal or sensitive information.
The endpoint answers with the records in a data array, and some details about them in metadata:
{
"data": [
{ "id": 1, "first_name": "Layla", "last_name": "Haddad", "email": "[email protected]" },
{ "id": 2, "first_name": "Omar", "last_name": "Said", "email": "[email protected]" }
],
"metadata": {
"prompt": "2 users with id, first_name, last_name and email",
"totalRecords": 2,
"generatedAt": "2026-01-15T09:30:00.000Z",
"expiresAt": "2026-01-15T15:30:00.000Z"
}
}Fetch example
fetch is built into browsers and into Node 18 and newer. Replace YOUR_ID with the id from your link, or paste your whole link.
const res = await fetch("https://www.mockify.online/api/mock/YOUR_ID");
const json = await res.json();
if (!res.ok) {
// for example 404: { "error": "This mock endpoint has expired or does not exist." }
throw new Error(json.error);
}
console.log(json.data); // the records (an array)
console.log(json.metadata.totalRecords); // how many recordsAxios example
Install axios with npm install axios. It puts the JSON body in res.data, so the records are in res.data.data.
import axios from "axios";
try {
const res = await axios.get("https://www.mockify.online/api/mock/YOUR_ID");
console.log(res.data.data); // the records (an array)
console.log(res.data.metadata.expiresAt); // when the endpoint expires
} catch (error) {
// axios throws for 404 and other error statuses
console.log(error.response?.data?.error ?? error.message);
}curl example
curl is useful to check an endpoint from the terminal before you write any code.
# the JSON answer curl -s "https://www.mockify.online/api/mock/YOUR_ID" # the status code and headers too curl -i "https://www.mockify.online/api/mock/YOUR_ID"
React example
This component loads the records when it mounts and shows a loading state and an error message. It assumes your records have id, first_name, last_name and email, which is what the Users template creates.
import { useEffect, useState } from "react";
const API_URL = "https://www.mockify.online/api/mock/YOUR_ID";
export default function UserList() {
const [users, setUsers] = useState([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState("");
useEffect(() => {
const controller = new AbortController();
async function load() {
try {
const res = await fetch(API_URL, { signal: controller.signal });
const json = await res.json();
if (!res.ok) throw new Error(json.error || "Request failed");
setUsers(json.data);
} catch (err) {
if (err.name !== "AbortError") setError(err.message);
} finally {
if (!controller.signal.aborted) setLoading(false);
}
}
load();
return () => controller.abort();
}, []);
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error}</p>;
return (
<ul>
{users.map((user) => (
<li key={user.id}>
{user.first_name} {user.last_name} ({user.email})
</li>
))}
</ul>
);
}What happens when the endpoint expires
An endpoint works for 6 hours after you generate it. On the generator page you can press “Keep 24 hours” once, and the endpoint then lasts until 24 hours after it was created.
After that, the data is deleted and the address answers with status 404 and this JSON. The same answer comes for an id that never existed:
HTTP/1.1 404 Not Found
{ "error": "This mock endpoint has expired or does not exist." }Endpoints are kept in the memory of the server. If the server restarts, endpoints can disappear before their time. Generate a new one when that happens.
Limits
- Records: 1 to 50 per generation.
- Prompt: up to 500 characters.
- Custom fields: up to 15, with names of up to 40 characters. With custom fields, records are flat objects (no nested objects or arrays).
- Records times fields: at most 400 values per generation.
- Generations: 10 every 15 minutes for each IP address. After that the server answers 429 until the window passes.
- Endpoint life: 6 hours, or 24 hours after one extension.
- Storage: the server holds up to 1000 endpoints at once. When it is full, generating answers 503 and you can try again later.
These limits apply to generating data. Reading an endpoint with GET is not rate limited by Mockify.
Troubleshooting
- CORS error in the browser: endpoints allow requests from any origin, so a CORS error usually hides another problem. Check that the address is correct and starts with https://, then open it in a new tab to see the real answer.
- 404 with “expired or does not exist”: the endpoint has expired, the id has a typo, or the server restarted. Generate a new one.
- Empty or unexpected data: when you only write a prompt, the AI chooses the keys and may return a different number of records. Name the fields in the prompt, or add custom fields: the server then checks the keys, types and number of records before it saves the data.
- 429 “Too many requests”: you used the 10 generations of the 15 minute window. Wait a few minutes.
- 502 “The AI gave bad data”: the AI answer could not be used. Press Generate again.