Build with MockBite in minutes
Use API keys to access private endpoints, generate fake users and track usage per key. These examples target the local backend at http://localhost:8080.
Check if the API is online.
Capture an early access lead.
Internal BFF route to issue an API key for logged-in users.
Inspect the authenticated user and API key metadata.
Generate a fake user and track usage for the API key.
Read the total request count logged for the API key.
Create an API key
Keys are now securely generated via NextAuth. Follow these steps to provision your key:
- Log in to the MockBite platform.
- Navigate to your Dashboard.
- Open Settings (⚙️) and click Generate new API Key.
Call the private endpoint
Send your API key with the Bearer authorization scheme.
curl "http://localhost:8080/v1/fake-user?country=Brazil&role=Backend%20Engineer&company=MockBite&seed=lucas" \
-H "Authorization: Bearer df_your_api_key"Open the console
Paste the generated key in the dashboard to inspect account metadata and usage.
curl http://localhost:8080/v1/usage \
-H "Authorization: Bearer df_your_api_key"Customize fake users
Override the generated user country.
Override the generated user role.
Override the generated user company.
Select a deterministic name and email variation.
Example payloads
Each authenticated request to /v1/fake-user is logged for usage tracking.
{
"name": "Maya Chen",
"email": "maya@mockbite.dev",
"company": "MockBite",
"country": "Brazil",
"role": "Backend Engineer"
}The /v1/usage endpoint returns aggregate metrics for the authenticated API key.
{
"total_requests": 12,
"last_24h": 5,
"last_request_at": "2026-06-21T20:45:00Z",
"by_endpoint": [
{
"endpoint": "/v1/fake-user",
"requests": 12
}
]
}Abuse prevention
The API applies a fixed-window rate limit per client IP. Defaults are configured by environment variables and can be tuned per deploy.
Common failures
The request body could not be parsed.
A private endpoint was called without Authorization.
The provided API key was not found or did not match.
The client exceeded the configured request window.
Simulate network issues
You can add x-mockbite-latency (in ms) or x-mockbite-status (HTTP code) headers to any request to simulate slow or failing endpoints.
Adds a 1500ms delay to the response.
Forces the endpoint to return a 503 Service Unavailable error.
Model Context Protocol
MockBite supports the Model Context Protocol (MCP) to manage your mock APIs directly from your editor (Claude Desktop, Cursor, Antigravity, etc). Configure it in the Dashboard.
Why use MCP?
Integrating Mockbite with your local AI agent drastically improves your workflow by keeping you inside the editor.
- Zero Context Switching: You don't need to open the browser to create or manage endpoints.
- AI Generation: You can tell your AI 'Build a complete e-commerce backend API' and it will do it.
- Instant Integration: The AI generates the mock and immediately writes the frontend code to consume it.
Isolated MCP Keys
MCP uses special PATs (Personal Access Tokens) that are strictly scoped. They cannot be used to invoke your mock APIs from a production app; they exist only to manage the endpoints.
Example Prompt
Try typing this in your AI agent: 'Use the mockbite tool to create a REST API for a task manager. Generate 5 endpoints: GET /tasks, POST /tasks, etc. Include realistic fake payloads and a 500ms latency to simulate real network conditions.'