Documentation
Everything you need to start mocking APIs in minutes.
On this page
MCP Server
The fastest way to use GetMocked is through the MCP server. Connect it to your AI coding assistant and create, update, and test mock APIs using natural language, without leaving your editor.
Quick Setup
Claude CodeRecommended
One command does everything — login, configure, and register the server.
npx @getmocked/mcp loginRestart Claude Code and you're ready to go.
Cursor
Run npx @getmocked/mcp login first, then add to your project config:
// .cursor/mcp.json
{
"mcpServers": {
"getmocked": {
"command": "npx",
"args": ["@getmocked/mcp"]
}
}
}VS Code (Copilot)
Run npx @getmocked/mcp login first, then add to your VS Code settings:
// .vscode/settings.json
{
"mcp": {
"servers": {
"getmocked": {
"command": "npx",
"args": ["@getmocked/mcp"]
}
}
}
}Available Tools
Once connected, these tools are available to your AI assistant:
| Tool | Description |
|---|---|
create_mock_api | Create a mock API from a natural language description |
list_mock_apis | List all your mock APIs |
get_mock_api | Get details of a specific mock API |
update_mock_api | Update name, description, schemas, or persistence settings using AI |
test_mock_api | Execute a mock API and see sample response (supports persistence control) |
delete_mock_api | Delete a mock API |
list_persisted_data | List stored responses for a persisted mock API |
delete_persisted_data | Delete stored responses or clear all persisted data |
create_mock_project | Create a multi-API project from a description |
list_mock_projects | List all your mock projects |
get_mock_project | Get project details with all APIs |
add_api_to_project | Add a new API to an existing project |
delete_mock_project | Delete a mock project |
Example Workflow
With the MCP server connected, you can talk to your AI assistant naturally:
"Create a mock API that returns a list of users with name, email, and avatar URL"
"Update the users API to also include a role field that's either admin, editor, or viewer"
"Test the users API and show me what the response looks like"
"Create a project called 'E-commerce' with APIs for products, orders, and customers"
REST API
Every mock API gets a unique endpoint URL and API key. Use them like any real API.
Making Requests
curl -X POST https://api.getmocked.ai/m/{userId}/{slug} \
-H "Authorization: Bearer {your-api-key}" \
-H "Content-Type: application/json" \
-d '{"name": "Example input"}'Both POST and GET are supported. For GET requests, pass input as query parameters.
Response
Responses are AI-generated JSON that matches your output schema. The data is realistic and contextually appropriate — not just random values.
Project APIs
APIs inside a project use a slightly different URL:
https://api.getmocked.ai/m/{userId}/{projectSlug}/{apiSlug}Find your exact endpoint URL and API key on each API's Deploy tab in the dashboard.
Error Simulation
Test how your app handles errors by adding query parameters to any mock API request.
| Parameter | Header | Description |
|---|---|---|
?_mock_status=500 | X-Mock-Status | Return any HTTP error (400-599) with a realistic error body |
?_mock_delay=2000 | X-Mock-Delay | Add latency in milliseconds (1-30000) before responding |
?_mock_error=timeout | X-Mock-Error | Hang the connection to test client timeout handling |
Combine them for complex scenarios: ?_mock_status=503&_mock_delay=1500 simulates a slow 503 error.
Delay without a status code returns a normal successful response after the wait — useful for testing loading states and spinners.
Error responses include "simulated": true so you can distinguish them programmatically.
Quality Modes
Control the quality and speed of generated mock data.
| Mode | Speed | Best For |
|---|---|---|
fast | ~1s | Development, rapid iteration, high-volume testing |
quality | ~3s | Demos, screenshots, realistic test data |
Set via the X-Mock-Mode header or ?_mode=fast query param. You can also set a default mode per API in the dashboard. Free tier is limited to fast mode.
Caching
GetMocked caches generated responses for 7 days. Use the cache to get instant responses and consistent data across requests.
| Strategy | Behavior |
|---|---|
any | Return any cached response (fastest, but input may not match) |
match | Only return cached response if the input matches exactly |
| not set | Always generate fresh data (default) |
Set via the X-Mock-Cache header or ?_cache=any query param. Cached responses don't count as generation requests (no AI cost).
Need responses that stick around forever? See Data Persistence for permanent, input-matched storage.
Data Persistence
Data persistence gives your mock APIs sticky responses — enable it on any API and the same input will always return the same output. Persisted responses are stored permanently, cost $0 to serve, and never expire.
How It Works
Enable persistence on any mock API via the dashboard toggle or the MCP update_mock_api tool.
First request generates a response normally and stores it, keyed by a hash of the input.
Subsequent requests with the same input return the stored response instantly — no AI generation, no cost.
Controlling Persistence
Override the default behavior per-request with the X-Mock-Persist header or ?_persist query param:
| Value | Behavior |
|---|---|
regenerate | Force a new response and overwrite the stored entry for this input |
skip | Generate a fresh response without reading or writing persisted data |
| not set | Return persisted response if one exists, otherwise generate and store (default) |
Response Source
Every response includes an X-Mock-Source header so you know where the data came from:
| Value | Meaning |
|---|---|
persisted | Returned from permanent storage — $0 cost |
cache | Returned from 7-day cache — $0 cost |
generated | Freshly generated by AI — counts as a request |
Persistence vs Caching
| Persistence | Caching | |
|---|---|---|
| Duration | Forever (until deleted) | 7 days |
| Matching | Exact input hash | Exact or any |
| Storage | One entry per unique input | Last 20 responses |
| Management | Dashboard, MCP tools, API | Automatic |
| Opt-in | Yes (per API) | Yes (per request) |
Managing Persisted Data
View, edit, and delete persisted entries from the Data tab on any API in the dashboard. You can also manage data programmatically:
MCP tools
Use list_persisted_data and delete_persisted_data from your AI assistant.
REST API
# List persisted entries
curl https://api.getmocked.ai/api/mock-apis/{id}/persisted-data \
-H "Authorization: Bearer {token}"
# Delete a specific entry
curl -X DELETE https://api.getmocked.ai/api/mock-apis/{id}/persisted-data/{inputHash} \
-H "Authorization: Bearer {token}"
# Clear all persisted data
curl -X DELETE https://api.getmocked.ai/api/mock-apis/{id}/persisted-data \
-H "Authorization: Bearer {token}"Rate Limits
| Plan | Requests | Reset | Mock APIs |
|---|---|---|---|
| Free | 100 / day | Midnight UTC | 3 |
| Hobby ($9/mo) | 10,000 / month | Billing cycle | Unlimited |
| Pro ($19/mo) | 100,000 / month | Billing cycle | Unlimited |
When you hit your limit, the API returns 429 Too Many Requests with a reset_at timestamp telling you when your quota refreshes.