On this page
1. Create a local environment #
Install the current desktop release from Mockoon's official download page. Open the application and click New environment. Save the environment data file when prompted. This file holds the routes and responses you configure. Official first-API tutorial.
Use a filename such as website-demo.json so you can identify the mock later. The new environment should appear in the application with an initial GET route. Start with a separate small environment instead of changing a mock another project already depends on.
The environment file is JSON, but it is the server's configuration. It is different from the JSON response body you'll enter in step three. Data-file documentation explains what the environment contains.
2. Set the local address and create a route #
Open Environment Settings and check the port. A new environment starts at 3000, although Mockoon increments the port when other environments are already open. For this walkthrough, use 3000 if it's available. Leave the API prefix empty. Port and prefix instructions.
In the listening-hostname field, enter 127.0.0.1 for a mock you'll call only from this computer. Mockoon otherwise listens on all available network adapters. Restart the environment if you change this setting while it is running. Listening-hostname instructions.
Use the route-add menu and choose Http route, or edit the initial route. Set the method to GET and the path to /projects. You should see the route in the environment's route list. With no prefix and port 3000, its address will be http://127.0.0.1:3000/projects.
3. Enter a small JSON body and its header #
In the response-body field, enter this fictional example:
[
{"id": 1, "title": "Sample website", "status": "draft"},
{"id": 2, "title": "Example catalogue", "status": "ready"}
]
The objects are demonstration data. Replace their fields with the response shape your website expects when you adapt the mock.
Add a response header with key Content-Type and value application/json. Keep the response status at 200 for this first route. The body and header should now appear in that route's response configuration. Body and header setup.
If you alter the example, check its syntax before blaming the website for a parsing error. Our JSON viewer and editor list covers tools for reading a longer response. CodeBeautify is another option for inspecting a small JSON document.
4. Add a delay for the loading screen #
Enter 1000 in the response's delay field. The value is milliseconds, so this adds one second before the response. That gives your website a delay to handle when you connect it to the endpoint. Delay configuration.
Use a fixed body for now. Random data introduces another variable when you're trying to confirm that the request reaches the right route. First make the basic response predictable; add templating after the page handles it correctly.
5. Start the server and request the endpoint #
Click the green play arrow in the header. Open http://127.0.0.1:3000/projects in a browser or request it from an API client. You should receive the two sample objects. Starting and calling the server.
If you chose another port, use that value in the URL. If you added a prefix, include it before /projects. Match the method as well: opening the URL in a browser sends GET, which is the method configured here.
Postman can display the response status and headers alongside the body. You should see status 200 and a JSON Content-Type. A browser displaying the data confirms the basic route is reachable; the website still needs its development API address pointed at this endpoint.
6. Inspect the request in Logs #
Click Logs at the top of the window. Select the request for /projects and inspect its incoming request and outgoing response. Mockoon records the method, path, headers and body, so this is the place to compare what your website sent with what the route expects. Logging instructions.
A browser may also request a favicon. Use the path to identify the actual API call instead of treating every log row as another call to /projects.
When you connect the website, inspect the log again. If the browser request succeeds but the website's request never appears, check the API base URL in the development configuration. If a request appears with another method or path, correct that mismatch before editing the response body.
7. Locate the configuration for later reuse #
Right-click the environment and choose Show data file in explorer/finder. You should find the JSON environment file saved in step one. That is the file to share with someone who will open the mock in Mockoon. File-location controls.
Give the recipient the expected address, method and path as well as the file. A short instruction such as “start the environment, then GET /projects on its configured port” is enough for this example. Include any prefix if you add one later.
Known problems with files and template variables #
An externally edited environment doesn't refresh
In July 2026, a developer asked for a reload button because external edits weren't appearing. The maintainer explained that desktop monitoring of local files is available but disabled by default; the CLI has --watch. Enable file monitoring in the desktop settings when you want that workflow. Accepted answer.
A global variable seems to return no value
A May 2026 discussion describes a developer setting a global variable but reading it with the local-variable helper. The maintainer recommended getGlobalVar; setVar and getVar operate on local variables. Use matching global helpers when extending your response with shared state. Maintainer reply.
A helper-generated string becomes an object
A January 2026 report showed stringify serializing a value from base64 as an object with a string property. The issue is marked released in version 9.8.0. Update an older application before debugging that template behavior; a plain fixed JSON body avoids it in this walkthrough. Issue and release milestone.
Troubleshooting the first request #
| Problem | Likely cause | What to change |
|---|---|---|
| Connection refused | Server stopped or wrong port | Start the environment and use its configured port |
| Response is 404 | Method, prefix or route path differs | Compare the incoming request in Logs with the route |
| Client can't parse JSON | Body syntax or response header is wrong | Check the body and set Content-Type to application/json |
| Browser opens the endpoint but website fails | Cross-origin request configuration | Enable OPTIONS pre-flight handling and add CORS headers in the environment controls |
| External file edits aren't visible | File monitoring is off | Enable monitoring in settings or reopen the environment |
Variations for website development #
Connect a frontend on a different local origin
In Environment Settings, enable Automatically handle OPTIONS pre-flight requests. In Environment Headers, use Add CORS headers when the frontend needs the documented cross-origin headers. Mockoon's CORS instructions describe both controls. A cross-origin request should then reach the route, where you can inspect it in Logs.
Add an error response to the same route
Click the plus icon beside the response list to add another response. Give it status 500 and a small error body matching the website's expected format. Use the response's flag to choose which response is the default. The blue flag marks the active default when no rules select another response. Multiple-response controls.
Select a response using a request condition
Open the response's Rules tab and click Add rule. Configure a condition using a documented target such as a query parameter or header. Mockoon serves the first matching response, so check the response order when several conditions overlap. Rule controls.
How to create a mock API with Mockoon: final checks #
- The environment file is saved and easy to find.
- GET
/projectsreturns the expected JSON at the configured address. - The client receives status 200 and Content-Type application/json.
- Logs shows the request method and path you intended.
- The website's development configuration points to the mock endpoint.
- Any additional error response has its own intentional default or rule.
Next steps #
Use the free API mocking tools comparison list if you need a hosted URL or editable resource records. Read Mockoon vs WireMock before moving the mock into an automated test workflow. Beeceptor offers a hosted route for small demonstrations, while the Development category covers related tools.
Featured illustration: WebIndexly, created with OpenAI image generation.
Explore more in APIs & Databases
- Browse all APIs & Databases websites
- 8 Best Free API Mocking Tools for Website Projects
- Best Free Database Clients for Everyday SQL Work
- Best Free API Testing Tools for Individual Developers
- Mockoon vs WireMock: A Desktop Editor or Test-Controlled Mocks?
- DBeaver vs DB Browser for SQLite: Which Should You Use?




