Back to Builder

Mock API Builder Guide

Complete reference for building mock REST APIs with dynamic data, conditional responses, and shareable URLs.

Quick Start

1

Add an endpoint

Click Add Endpoint and choose an HTTP method and path. For example: GET /users or POST /users/:id.
2

Configure the response

Set the status code, content type, and response body. Use template variables like {{faker.person.fullName}} for dynamic data.
3

Copy the URL

The base API URL is shown in the toolbar. Click Share to copy the builder URL, or use the base URL to make real HTTP requests.

Creating Endpoints

Each endpoint has an HTTP method and a path. Supported methods: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS.

Paths start with / and can include path parameters prefixed with ::

/users
/users/:id
/projects/:projectId/tasks/:taskId

Path parameter values are available in your response body via {{params.id}}, {{params.projectId}}, etc.

Endpoints can be reordered by dragging, and removed with the delete button. You can have multiple endpoints with the same path but different methods.

Response Configuration

Each response has the following settings:

  • Status Code — Any standard HTTP status (200, 201, 400, 404, 500, etc.)
  • Content Type — JSON, plain text, HTML, or XML
  • Custom Headers — Add key-value pairs sent with every response
  • Body — The response body, with support for template variables

Example JSON response body:

{
  "id": "{{uuid}}",
  "name": "{{faker.person.fullName}}",
  "email": "{{faker.internet.email}}",
  "createdAt": "{{now}}"
}

Template Variables

Template variables are placeholders in your response body wrapped in double curly braces. They are replaced with dynamic values when a request is made.

VariableDescriptionExample
{{params.id}}Path parameter value/users/:id → "42"
{{query.page}}Query string parameter?page=2 → "2"
{{headers.authorization}}Request header value"Bearer token123"
{{body.name}}Request body field (JSON){"name":"Jane"} → "Jane"
{{uuid}}Random UUID v4"a1b2c3d4-e5f6-..."
{{now}}Current ISO 8601 timestamp"2026-03-02T12:00:00.000Z"
{{timestamp}}Current Unix epoch (seconds)"1772236800"
{{faker.*}}Faker.js generated dataSee Faker Reference below

Faker Data Generation

Use {{faker.<method>}} to generate realistic fake data. Values are regenerated on every request. For numeric methods, pass a range: {{faker.number.int(1,100)}}.

Person

MethodExample Output
{{faker.person.fullName}}John Smith
{{faker.person.firstName}}John
{{faker.person.lastName}}Smith
{{faker.person.jobTitle}}Software Engineer
{{faker.person.bio}}Short bio text

Internet

MethodExample Output
{{faker.internet.email}}john@example.com
{{faker.internet.username}}john_doe42
{{faker.internet.url}}https://example.com
{{faker.internet.ip}}192.168.1.1
{{faker.internet.password}}aB3dEf9Gh

Number

MethodExample Output
{{faker.number.int(1,1000)}}427
{{faker.number.float(0,100)}}73.42

Lorem

MethodExample Output
{{faker.lorem.sentence}}Lorem ipsum dolor sit amet.
{{faker.lorem.paragraph}}A full paragraph...
{{faker.lorem.word}}consequatur

Image

MethodExample Output
{{faker.image.avatar}}https://avatars.githubusercontent.com/...
{{faker.image.url}}https://picsum.photos/...

Location

MethodExample Output
{{faker.location.city}}San Francisco
{{faker.location.country}}United States
{{faker.location.zipCode}}94102
{{faker.location.streetAddress}}123 Main St
{{faker.location.latitude}}37.7749
{{faker.location.longitude}}-122.4194

Commerce

MethodExample Output
{{faker.commerce.price}}29.99
{{faker.commerce.productName}}Ergonomic Chair
{{faker.commerce.productDescription}}A comfortable chair...

Company

MethodExample Output
{{faker.company.name}}Acme Corp
{{faker.company.catchPhrase}}Innovative solutions

Date

MethodExample Output
{{faker.date.past}}2024-03-15T...
{{faker.date.future}}2027-08-22T...
{{faker.date.recent}}2026-02-28T...

Phone

MethodExample Output
{{faker.phone.number}}+1-555-123-4567

Finance

MethodExample Output
{{faker.finance.amount}}542.32
{{faker.finance.currency}}USD
{{faker.finance.bitcoinAddress}}3J98t1Wp...

Datatype

MethodExample Output
{{faker.datatype.boolean}}true
{{faker.datatype.uuid}}a1b2c3d4-...

String

MethodExample Output
{{faker.string.uuid}}a1b2c3d4-...
{{faker.string.alphanumeric}}abc123

Other

MethodExample Output
{{faker.animal.type}}dog
{{faker.color.human}}blue
{{faker.food.dish}}Spaghetti
{{faker.music.genre}}Rock
{{faker.science.chemicalElement}}Hydrogen

Response Modes

Default (Single Response)

Each endpoint returns one response every time. This is the default mode when you add a single response to an endpoint.

Sequence Mode

Add multiple responses and assign each a sequence order. Each request returns the next response in the sequence, cycling back to the first after the last.

Use case: Test retry logic by returning a 500 error on the first call and a 200 success on the second.

Response 1 (order 0): 200 OK  → {"status": "success"}
Response 2 (order 1): 500    → {"error": "Internal Server Error"}

Request #1 → 200 OK
Request #2 → 500 Internal Server Error
Request #3 → 200 OK  (cycles back)

Conditional Mode

Add conditions to responses to match requests by query parameters, headers, or body content. Condition values support regex patterns. The first matching condition wins; unmatched requests fall through to the response with no condition.

Use case: Return different user lists based on a status query parameter.

Response 1: condition query.status = "^active$"
  → {"data": [...active users...]}

Response 2: no condition (fallback)
  → {"data": [...all users...]}

Sharing & Documentation

Sharing: Click Share in the toolbar to copy the builder URL. The entire configuration is compressed and encoded in the URL — no account or database required. Anyone with the link can open and edit the mock API.

Base API URL: The toolbar shows the live API base URL. Append any endpoint path to make real HTTP requests. For example, if you defined GET /users, you can curl the base URL + /users.

Interactive Docs: Click Docs in the toolbar to open a Swagger-style documentation page for your mock API. It shows all endpoints, their methods, expected parameters, and response examples. Use the Test Request button to send live requests directly from the docs page.

Templates

Start from a pre-built template to save time. Templates are available in the sidebar when you have no endpoints configured.

REST CRUD

Full CRUD with faker data, conditional & sequence responses

GET/usersGET/users/:idPOST/usersPUT/users/:idDELETE/users/:id

Health Check

GET /health endpoint

GET/health

Auth Endpoints

Login, refresh, and logout

POST/auth/loginPOST/auth/refreshPOST/auth/logout

Frequently Asked Questions

Do I need to install anything to use the Mock API Builder?

No. The Mock API Builder runs entirely in your browser. There is nothing to install, no sign-up required, and no server to configure.

How do I share my mock API with others?

Click the Docs button in the toolbar to generate an interactive documentation page for your API. Share the docs URL with your team — they can explore endpoints, view response examples, and send test requests directly from the page.

What is a template variable?

Template variables are placeholders like {{faker.person.fullName}} or {{params.id}} that get replaced with dynamic values each time a request is made. They let you generate realistic, context-aware responses.

Can I return different responses based on the request?

Yes. Use Conditional mode to match requests by query parameters, headers, or body content. Each condition maps to a different response, with a fallback for unmatched requests.

How does sequence mode work?

In Sequence mode, each successive request returns the next response in the list. After the last response, it cycles back to the first. This is useful for testing retry logic or simulating intermittent errors.

Does CORS work with mock API responses?

Yes. All mock API responses include CORS headers automatically, so you can call them from any origin including localhost during development.

Can AI agents use the Mock API Builder programmatically?

Yes. AI agents can construct configuration URLs programmatically using the wire format, or use the interactive documentation page to explore and test endpoints.