MockBite Iconmockbite
API documentation

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.

GET /health

Check if the API is online.

Public
POST /waitlist

Capture an early access lead.

Public
POST /auth/register

Internal BFF route to issue an API key for logged-in users.

Internal
GET /me

Inspect the authenticated user and API key metadata.

Bearer API key
GET /v1/fake-user

Generate a fake user and track usage for the API key.

Bearer API key
GET /v1/usage

Read the total request count logged for the API key.

Bearer API key
Step 1

Create an API key

Keys are now securely generated via NextAuth. Follow these steps to provision your key:

  1. Log in to the MockBite platform.
  2. Navigate to your Dashboard.
  3. Open Settings (⚙️) and click Generate new API Key.
Step 2

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"
Step 3

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"
Query params

Customize fake users

country

Override the generated user country.

role

Override the generated user role.

company

Override the generated user company.

seed

Select a deterministic name and email variation.

Responses

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
    }
  ]
}
Rate limit

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.

RATE_LIMIT_MAX controls the request count.
RATE_LIMIT_WINDOW_SECONDS controls the time window.
X-RateLimit-Limit Maximum requests allowed in the current window.
X-RateLimit-Remaining Requests still available before the window resets.
X-RateLimit-Reset Unix timestamp for the current window reset.
Retry-After Seconds until retrying after the limit is exceeded.
Errors

Common failures

400 invalid json payload

The request body could not be parsed.

401 missing bearer token

A private endpoint was called without Authorization.

401 invalid api key

The provided API key was not found or did not match.

429 rate limit exceeded

The client exceeded the configured request window.

Latency & Chaos

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.

x-mockbite-latency: 1500

Adds a 1500ms delay to the response.

x-mockbite-status: 503

Forces the endpoint to return a 503 Service Unavailable error.

Local Integration

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.

Advantages

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.
Security

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.

Workflow

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.'