Product Docs

Everything needed to run FakeAPI seriously.

FakeAPI is a Mongo-backed, TypeScript-first listener for reserved sandboxes. Each namespace receives a one-time token, then every request sent to that namespace can carry its own fakeresponse. The server simply listens, logs the interaction, and returns the response the client asked to hear.

NamespaceFirst-come, first-served sandbox root
TokenShown once on registration, used for login and API management
ListenerNo server-side inline service creation is required

Quick Start

Bring the service up, reserve a namespace, store the one-time token, and start sending requests that contain fakeresponse. You can run locally with Node or with Docker Compose.

docker compose up --build -d Open: https://fakeapi.vexlo.ca Local dev: http://localhost:3000

Auth and Namespace Flow

The namespace is the client root and the token is the lightweight management credential. The token is shown only once during registration and must be kept by the client.

curl -X POST https://fakeapi.vexlo.ca/api/auth/reserve \ -H 'content-type: application/json' \ -d '{ "namespace": "vexlo-demo" }'
curl -X POST https://fakeapi.vexlo.ca/api/auth/login \ -H 'content-type: application/json' \ -d '{ "namespace": "vexlo-demo", "token": "your-token" }'

Inline Mode

Use inline mode by embedding fakeresponse in the request body. This is the fastest way to stub a login, profile fetch, pricing lookup, or any fixed contract response.

curl -X POST https://fakeapi.vexlo.ca/vexlo-demo/auth/login \ -H 'content-type: application/json' \ -d '{ "email": "[email protected]", "password": "secret", "fakeresponse": { "statusCode": 200, "headers": { "content-type": "application/json" }, "body": { "result": true, "message": "login successful" } } }'

Record Mode

Use record mode when behavior should depend on prior requests. Each rule can move a flow to the next state. Clients should keep and resend x-fakeapi-session to continue a scenario over time.

curl -X POST https://fakeapi.vexlo.ca/api/console/namespaces/vexlo-demo/endpoints \ -H 'authorization: Bearer your-token' \ -H 'content-type: application/json' \ -d '{ "version": "1", "category": "auth", "title": "Send OTP", "method": "POST", "path": "/auth/send-otp", "mode": "record", "recordRules": [ { "flowKey": "login", "requiredState": "START", "nextState": "OTP_SENT", "description": "first state transition", "response": { "statusCode": 200, "body": { "status": "otp_sent" } } } ] }'

Console Experience

  • Register or log in from a dedicated auth screen.
  • See a live list of requests received by the namespace.
  • Inspect request and response payloads per interaction.
  • Copy requests back out as cURL, fetch, or Axios snippets.
  • View errors when a request forgot to include fakeresponse.

AI Export Endpoints

When a real implementation is about to start, use the AI export APIs to retrieve the entire mock contract, metadata, and flow hints in a machine-friendly shape.

curl -X POST https://fakeapi.vexlo.ca/api/ai/export \ -H 'content-type: application/json' \ -d '{ "namespace": "vexlo-demo", "token": "your-token" }'

Runtime Route Format

All runtime mocks are served under the reserved namespace path. A legacy versioned route also works, but versioning is optional. Example:

curl -X POST https://fakeapi.vexlo.ca/vexlo-demo/auth/login \ -H 'content-type: application/json' \ -d '{ "email": "[email protected]", "password": "secret", "fakeresponse": { "statusCode": 200, "body": { "result": true, "message": "login successful" } } }'

This maps to the path shape /:namespace/* and also supports /:namespace/v:version/*.