Documentation

Everything you need to start mocking APIs in minutes.

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 login

Restart 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:

ToolDescription
create_mock_apiCreate a mock API from a natural language description
list_mock_apisList all your mock APIs
get_mock_apiGet details of a specific mock API
update_mock_apiUpdate name, description, schemas, or persistence settings using AI
test_mock_apiExecute a mock API and see sample response (supports persistence control)
delete_mock_apiDelete a mock API
list_persisted_dataList stored responses for a persisted mock API
delete_persisted_dataDelete stored responses or clear all persisted data
create_mock_projectCreate a multi-API project from a description
list_mock_projectsList all your mock projects
get_mock_projectGet project details with all APIs
add_api_to_projectAdd a new API to an existing project
delete_mock_projectDelete 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.

ParameterHeaderDescription
?_mock_status=500X-Mock-StatusReturn any HTTP error (400-599) with a realistic error body
?_mock_delay=2000X-Mock-DelayAdd latency in milliseconds (1-30000) before responding
?_mock_error=timeoutX-Mock-ErrorHang 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.

ModeSpeedBest For
fast~1sDevelopment, rapid iteration, high-volume testing
quality~3sDemos, 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.

StrategyBehavior
anyReturn any cached response (fastest, but input may not match)
matchOnly return cached response if the input matches exactly
not setAlways 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

1

Enable persistence on any mock API via the dashboard toggle or the MCP update_mock_api tool.

2

First request generates a response normally and stores it, keyed by a hash of the input.

3

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:

ValueBehavior
regenerateForce a new response and overwrite the stored entry for this input
skipGenerate a fresh response without reading or writing persisted data
not setReturn 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:

ValueMeaning
persistedReturned from permanent storage — $0 cost
cacheReturned from 7-day cache — $0 cost
generatedFreshly generated by AI — counts as a request

Persistence vs Caching

PersistenceCaching
DurationForever (until deleted)7 days
MatchingExact input hashExact or any
StorageOne entry per unique inputLast 20 responses
ManagementDashboard, MCP tools, APIAutomatic
Opt-inYes (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

PlanRequestsResetMock APIs
Free100 / dayMidnight UTC3
Hobby ($9/mo)10,000 / monthBilling cycleUnlimited
Pro ($19/mo)100,000 / monthBilling cycleUnlimited

When you hit your limit, the API returns 429 Too Many Requests with a reset_at timestamp telling you when your quota refreshes.