A laptop, a phone and a hand writing in a notebook on a wooden desk, banner image on the Mock API Runner page

Herramientas / Build suite

Mock API Runner

Define routes - method, path, status, JSON body - and dry-run requests against them in the browser.

Define the API you are about to build - one route per block: method, path, status, JSON body - then fire requests at it in the page and see exactly what your front end will receive, before the backend exists.

Open the tool
Screenshot of the Mock API Runner tool

What it does

What it does.

Block route definitions

Method, path, status and JSON body per block; path params with :id syntax.

Real request matching

Method + path matching with params extracted and shown.

Latency simulation

A configurable delay makes loading states testable.

Fetch snippets

Each route generates the exact fetch() call for your front end.

How it works

How to use it.

Step 1

Define routes as blocks: METHOD /path STATUS, then the JSON body.

Step 2

Send a request with the tester; check status, body and params.

Step 3

Copy the fetch snippet into your front end.

FAQ

Path params?

Use :name in the route path; the tester extracts actual values.

Persistent?

Definitions live in the page; copy them out to keep them.

CORS or real HTTP?

Requests run in-page against your definitions; no network is involved.

Open Mock API Runner

Worked example

Real output, from the tool itself.

This is what Mock API Runner returned for its built-in example input, captured from the tool itself.

You enter

Input

GET /users 200
{"users":[{"id":1,"name":"Priya"},{"id":2,"name":"Dan"}]}

GET /users/:id 200
{"id":1,"name":"Priya","plan":"pro"}

POST /users 201
{"id":3,"created":true}

GET /health 200
{"ok":true}

Simulated latency (ms)

120

Input

GET

Input

/users/2

The tool returns

fetch('/users', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({/* request body */})})
  .then(r => r.text().then(t => t ? JSON.parse(t) : null));
Try it with your own input

More in the Build suite

Font Pairing LabWebhook TesterPricing Page BuilderLanding Page MakerStatus Page Starter
A wooden desk with glasses, a coffee cup, a plant and the edge of a laptop, banner image on the Mock API Runner page

Try it now.

Mock API Runner runs in your browser. No account needed.

Pipeline

From routes to response

Write route blocksPick method andpathWait the simulatedlatencyMatch against theroutesShow status, timeand body
Write route blocksPick method and pathWait the simulated latencyMatch against the routesShow status, time and body
All inside the tab.

Pipeline

Reading a route block

Split the text onblank linesRead the firstline as method,path, statusRead the rest asthe JSON bodyParse the body tocheck itKeep the route orreport an error
Split the text on blank linesRead the first line as method,path, statusRead the rest as the JSON bodyParse the body to check itKeep the route or report an error
Blocks are split on blank lines.

Before After

Route errors

In the blockResultFirst line has no statusBody is not valid JSONBody left emptyError: first line must bemethod, path, statusError: invalid JSON bodyAccepted, body becomes emptyobject
In the block to ResultFirst line has no statusError: first line must be method,path, statusBody is not valid JSONError: invalid JSON bodyBody left emptyAccepted, body becomes empty object
Each names the block number.

Pipeline

Matching a request

Skip routes withanother methodSplit both pathson slashesSkip if segmentcounts differCompare eachsegmentTake the firstroute that fits
Skip routes with another methodSplit both paths on slashesSkip if segment counts differCompare each segmentTake the first route that fits
First match wins.

Before After

Segment counts

RequestResult/users/2 against /users/:id/users against /users/:id/users/2/x against/users/:idMatchNo matchNo match
Request to Result/users/2 against /users/:idMatch/users against /users/:idNo match/users/2/x against /users/:idNo match
Both paths must have the same depth.

Input To Output

Parameter capture

Route/users/:idRequest/users/2Param idequals 2Route bodyreturnedParams shownon the resultlineMatcherInOut
InRoute /users/:idRequest /users/2MatcherParam id equals 2Route body returnedParams shown on the result lineOut
What /users/2 yields.

Before After

Matched or not

RequestBox shownRoute foundNo route foundBodyGreen edge, status andpretty JSONRed edge, 404, names themethod and pathPretty JSON, two-spaceindent
Request to Box shownRoute foundGreen edge, status and pretty JSONNo route foundRed edge, 404, names the method andpathBodyPretty JSON, two-space indent
Two result boxes.

Pipeline

Reading the latency box

Read the text as awhole numberUse 0 if it is nota numberNever below 0Wait that longbefore matching
Read the text as a whole numberUse 0 if it is not a numberNever below 0Wait that long before matching
Bad input falls back safely.

Pipeline

Building a fetch snippet

Take the routepathFill params fromthe last test ifit matchedAdd method optionsif not GETAdd a JSON contenttype headerChain a JSON parse
Take the route pathFill params from the last test ifit matchedAdd method options if not GETAdd a JSON content type headerChain a JSON parse
One per route.

Before After

Snippet by method

RouteSnippetGET routePOST routePUT routePlain fetch of the pathFetch with method, headerand body placeholderFetch with method, headerand body placeholder
Route to SnippetGET routePlain fetch of the pathPOST routeFetch with method, header and bodyplaceholderPUT routeFetch with method, header and bodyplaceholder
Only non-GET routes get options.

Before After

Params in snippets

Snippet statePath in snippetBefore any testAfter testing /users/2Path shows :idPath shows 2
Snippet state to Path in snippetBefore any testPath shows :idAfter testing /users/2Path shows 2
Filled after a matching test.

Pipeline

Running a snippet against the mock

Build the snippettextReplace fetch withthe mockRun itShow status, timeand parsed dataOr show thefailure message
Build the snippet textReplace fetch with the mockRun itShow status, time and parsed dataOr show the failure message
The real fetch is swapped out.

Before After

ok flag

StatusokStatus 200Status 201Status 404 routeok trueok trueok false
Status to okStatus 200ok trueStatus 201ok trueStatus 404 routeok false
Derived from the status.

Authored Tiles

What stays local

RoutesLatencyResponsesSnippets run
RoutesLatencyResponsesSnippets run
No real request is made.

Support Matrix

Method by what it adds

Method optionContent type headerBody placeholderGETPOSTPUTDELETE
GETnone of thesePOSTMethod optionContent type headerBody placeholderPUTMethod optionContent type headerBody placeholderDELETEMethod optionContent type headerBody placeholder
Snippet extras per method.

Before After

Reading one route line

PartValueMethodPathStatusGET/users/:id200
Part to ValueMethodGETPath/users/:idStatus200
The first line of the GET user block.

Support Matrix

Methods by where they work

In a route blockIn the tester menuGETPOSTPUTDELETEPATCH
GETIn a route blockIn the tester menuPOSTIn a route blockIn the tester menuPUTIn a route blockIn the tester menuDELETEIn a route blockIn the tester menuPATCHIn a route block
Route blocks take five methods, the tester menu four.

Before After

What each starter route returns

RouteResponseGET /usersGET /users/:idPOST /usersGET /health200, two users200, one user with a plan201, created is true200, ok is true
Route to ResponseGET /users200, two usersGET /users/:id200, one user with a planPOST /users201, created is trueGET /health200, ok is true
Four routes, four bodies.

Before After

Path parameters captured

Route and requestParams/users/:id with /users/2/users/:id with /users/7/orders/:oid/items/:n with/orders/9/items/3id = 2id = 7oid = 9, n = 3
Route and request to Params/users/:id with /users/2id = 2/users/:id with /users/7id = 7/orders/:oid/items/:n with/orders/9/items/3oid = 9, n = 3
Colon segments become named values.

Before After

The result line

CaseLine shownMatch with a paramMatch without a paramNo match200 - N ms - params: id = 2200 - N ms404 - N ms - no routematches the method and path
Case to Line shownMatch with a param200 - N ms - params: id = 2Match without a param200 - N msNo match404 - N ms - no route matches themethod and path
Three possible lines.

Before After

Latency box input

TypedWaited1200abc-5120 msNo waitNo waitNo wait
Typed to Waited120120 ms0No waitabcNo wait-5No wait
Typed text to wait used.

Bar Compare

Time shown is at least the delay

Delay 5050 millisecondsDelay 120120 millisecondsDelay 300300 millisecondsDelay 10001000 milliseconds
Delay 5050 millisecondsDelay 120120 millisecondsDelay 300300 millisecondsDelay 10001000 milliseconds
Delay typed against the least time shown.

Input To Output

A mock response object

Route statusRoute bodytextstatus numberok flagtext() promisejson() promiseMock responseInOut
InRoute statusRoute body textMock responsestatus numberok flagtext() promisejson() promiseOut
Built from the matched route.

Before After

Rejected requests

RequestOutcomeGET /nopeDELETE /usersPOST /healthRejected: no matching mockroute for GET /nopeRejected: no DELETE routeRejected: no POST route for/health
Request to OutcomeGET /nopeRejected: no matching mock route forGET /nopeDELETE /usersRejected: no DELETE routePOST /healthRejected: no POST route for /health
Each names the method and path.

Before After

Starter requests and answers

RequestAnswerGET /usersGET /users/2POST /usersGET /healthDELETE /users/2200, two users200, Priya on the pro plan201, created200, ok404, no route
Request to AnswerGET /users200, two usersGET /users/2200, Priya on the pro planPOST /users201, createdGET /health200, okDELETE /users/2404, no route
The sample routes against five requests.

Bar Compare

Path segments per starter route

/users1 segments/users/:id2 segments/health1 segments
/users1 segments/users/:id2 segments/health1 segments
Routes match only at equal depth.

Bar Compare

Top-level keys in starter bodies

GET /users1 keysGET /users/:id3 keysPOST /users2 keysGET /health1 keys
GET /users1 keysGET /users/:id3 keysPOST /users2 keysGET /health1 keys
Keys in each JSON body.

Support Matrix

Starter routes by status

200201GET /usersGET /users/:idPOST /usersGET /health
GET /users200GET /users/:id200POST /users201GET /health200
Which routes return which status.

Before After

Copy last response

StateClipboardAfter a matchAfter a missBefore any requestThe pretty JSONThe 404 text lineEmpty text
State to ClipboardAfter a matchThe pretty JSONAfter a missThe 404 text lineBefore any requestEmpty text
What lands on the clipboard.

Bar Compare

Routes returning each status

Status 2003 routesStatus 2011 routes
Status 2003 routesStatus 2011 routes
How many of the four routes return each.