Mock API Builder

Design the fake API your frontend needs before the real backend exists, check every response here, then take it away as a file that runs the mock in your app or on your computer. Nothing is uploaded.

  1. Design the routesStart from a template or add routes: method, path, status, delay and a JSON response with fake data like {{fullName}}.Edit routes ↓
  2. Try them herePress Try it and the page answers like the real API would. No install, no server.Try it ↓
  3. Use it in your appNeed a real URL such as http://localhost:3000? Download mock-server.js and run it with Node.js (one command). Or export MSW, OpenAPI or Postman.Run it ↓

This page has no server of its own, so it can't give you a public URL: the mock runs on your computer or inside your app. Your routes are saved in this browser.

Routes

0

    Edit route

    Template cheat sheet
    WriteGives
    {{fullName}} {{firstName}} {{lastName}} {{email}} {{username}} {{phone}}One made-up person per object, so the name and email match
    {{company}} {{jobTitle}} {{street}} {{city}} {{country}} {{zip}}Work and address details
    {{int 1 100}} {{float 0 5 1}} {{price 5 200}} {{bool 0.8}}Numbers in a range (float: decimals), true with a chance of 80%
    {{pick pending paid shipped}}One of the values (use quotes for spaces: {{pick "in stock" "sold out"}})
    {{uuid}} {{seq}} {{index}}Random UUID; 1, 2, 3… and 0, 1, 2… inside a repeat
    {{date 2024-01-01 2026-12-31}} {{datetime}} {{timestamp}} {{now}}Date, ISO date-time, Unix seconds; now is the time of the request
    {{word}} {{words 3}} {{sentence}} {{paragraph}} {{slug}} {{color}} {{url}} {{ip}}Text and other values
    ["{{repeat 10}}", { … }] ["{{repeat 2 6}}", { … }]An array with 10 (or 2 to 6) copies of the object, each with its own fake values
    {{params.id}} {{query.page 1}} {{body.name}} {{headers.authorization}}Values from the request (path parameter, query string with a default, JSON body, header). {{number query.page 1}} makes it a number

    A value that is only one {{token}} keeps its type ("{{int 1 9}}" becomes a number). Text around a token makes a string: "Hello {{firstName}}".

    Run it on your computer optional: only for a real URL

    Not connected
    1. once; needs Node.js 18 or newer, nothing else. It's plain JavaScript made from your routes; read it first under Export → Node server.
    2. In a terminal, in the folder you saved it to, run:
      node mock-server.js 3000
      If your browser saved it under another name, such as mock-server (1).js, use that name in quotes: node "mock-server (1).js" 3000. After you press Connect, this command shows the real name. Any copy works once you press Connect: the page sends it your current routes. To stop it, press Ctrl+C in that terminal (or Stop server here).
    3. to see if it's running. While connected, your edits here reach the server as you type.

    Your API will be at http://localhost:3000. Open a GET link below in a new tab, run its curl line, or point your app's API base URL at it.

    MethodURL to callAnswers

    Try it

    Pick a route and press Try it, or type a path and press Send.

    Export

    
        

    What is a mock API?

    A mock API answers like the real one, with made-up data, before the real one exists or when you don't want to depend on it. Frontend and mobile developers use one to build screens while the backend is still being written, to show loading states with a slow response, to test what the app does with a 500 or 401, and to run tests that don't break when a shared test server is down. Writing the routes down first is also a cheap way to agree on the API between the frontend and backend teams.

    How to use this builder

    Each route is a method and a path, such as GET /api/users/:id. A segment starting with a colon is a path parameter, and * at the end matches the rest of the path. When several routes match, the most specific one answers: /api/users/me wins over /api/users/:id. Give each route a status code, an optional delay in milliseconds, response headers and a body.

    The body is JSON with template tokens in double curly braces. Fake values like {{email}} come from a seeded generator, so you get the same data every time until you press Shuffle; that keeps screenshots and tests stable. Values from the request, like {{params.id}} or {{body.name}}, are filled in for each call, so GET /api/users/42 answers with id 42. Wrap an object in ["{{repeat 10}}", {…}] to make a list. For a non-JSON response, set a Content-Type header such as text/plain or application/xml and the body is used as text.

    Which export should I use?

    ExportGood forHow to run it
    Node serverA real local API any app can call: web, mobile emulator, Postman, curl. Supports CORS, delays and every route.node mock-server.js (Node 18+, no npm install); add a number such as 4000 for another port
    MSW handlersMocking inside a React, Vue or Angular app and in Jest/Vitest tests, with no server at all.npm i -D msw, then pass handlers to setupWorker or setupServer
    json-serverQuick CRUD: json-server adds create, update, delete, filtering and paging to the lists in db.json.npx json-server db.json
    OpenAPI 3Documentation, client generators and contract mocks such as Prism.npx @stoplight/prism-cli mock openapi.yaml
    Postman collectionSharing with your team; Postman can also host a mock server from the saved examples.Postman → Import

    Fake values in the exports are generated once, when you export, so they match what you saw on this page. Request values (path parameters, query strings, the body and headers) stay dynamic in the Node server and MSW exports.

    Frequently asked questions

    Can I get a public URL for my mock? Not from this page: it is a static website with no server, which is also why nothing you type is uploaded. Run the Node export on your machine (other devices on your Wi-Fi can reach it at your computer's IP address), import the Postman collection and create a Postman mock server, or deploy the Node file to any host that runs Node.

    Is my API design saved? Yes, in this browser only, so it is still here after a reload. Use Save file to keep a copy or move it to another computer, and Copy share link to send it to someone: the whole design is packed into the link itself.

    Why can't my app on localhost call the Try it panel? Try it answers inside this page only. Tick "Also answer fetch() calls on this page" to call the routes from the browser console here; for your own app, use the Node server or MSW export.

    Related tools: API request tester for real APIs, fake data generator for bigger data sets, load tester, JSON to TypeScript types for your mock responses, and HTTP status codes.

    Privacy and browser support

    Privacy and processing

    Everything you type, paste or open is processed by JavaScript in this browser tab. The tool itself makes no network requests, so your input is never sent to DevToolbox or to anyone else.

    Settings and saved work stay in this browser only. The privacy policy lists everything the site stores and lets you delete it.

    Browser support

    Works in current versions of Chrome, Edge, Firefox and Safari, on desktop and on phones.

    After your first visit the site can keep an offline copy, so this page also works without a connection.