mockfly logo

Getting started

Starting to create a mock API is very simple. You can sign in with your Google or Github account. We also give you the option to sign in as a guest, but keep in mind that your data won't be permanent. Guest sign-in is intended for you to test the tool without registering, though we're sure you'll register once you see how much you like it.

Create a projectLogin page

Once you're signed in, you'll be on the main screen. Mockfly operates through projects. You can have as many projects as you want and can invite your colleagues to collaborate with you.

The first thing we need to do is create a project. You will see a screen similar to this:

Create project

If we click on the "Create one" button, a modal will pop up where we just have to fill in a text field indicating the name for our project. In this example, we've named it "My first project".

Once we hit the "Create" button, the project we just made will appear.

Project created

If you want to create more projects, you can click on the button in the top right corner with the "+" symbol. As mentioned, you can have as many projects as you need and invite as many friends as you want.

Project Options

As you can see, a project has several options and different pieces of information:

Project created

1. Project name:

This is the name we've given to the project. If you don't like it, you can change it anytime you want :)

2. Namespace:

The namespace is your project's "identifier". You'll use it for HTTP requests. Your mock API's HTTP requests should go to{namespace}. This namespace can be changed, and we'll see how later on.

3. Users:

A list of users in the project will appear. This list shows the users who can add, edit, and delete endpoints. The crown icon by a user indicates that they are the project administrator, who has special privileges such as editing the project name, editing the namespace, and deleting the project.

4. Invite users:

You can invite your friends to the project so they can collaborate with you in creating a mock API. To invite friends, press the "+" button within the project, and a modal will appear. In this modal, enter your friend's email or Github @handle, e.g., @mockflydev. However, note that your friends must be previously registered on Mockfly to invite them.

5. Edit project:

In this option, you can edit the project's name. As we mentioned earlier, only the project admin can do this.

6. Edit namespace:

You can edit your project's namespace to make it more user-friendly. Instead of a URL like "", you can change it to "" for easier recall when pointing your project to consume the mock API.

7. Show API key:

This option reveals the API key for our project. This API key allows us, for example, to use the chrome extension to add endpoints more quickly.

8. Enter the project:

To start creating our first endpoints, click on the project card, and it will take you to a screen where you can select: "Endpoints".

9. Duplicate project:

If you have a project that is very similar to another one and you don't want to have to recreate all the endpoints of your mock API server one by one, what you can do is duplicate it. Duplicating it will create a project exactly like the one you have with the same endpoints, rules, etc., and will add a 'duplicated' at the end of the project name which you can then modify.

Endpoints Page

Create an Endpoint

To create an endpoint, simply click on the button in the bottom left corner:

Create endpoint

This will open a modal asking for the endpoint path, e.g., /users and the HTTP method. As an example, let's create an endpoint with the path /users and a GET method. Once everything is ready, click the "Create" button to make the endpoint.

Editing an Endpoint

When you want to edit an endpoint, you can adjust various parts of it:

Edit endpoint
  1. Method: You can edit the HTTP method of our endpoint. Choose from the following HTTP verbs: GET, PUT, POST, PATCH, DELETE, OPTIONS. The change is made automatically.
  2. Path: Change the endpoint path. You can even add dynamic parameters using this format, for example: /users/:id.
  3. Delay: Set a delay in milliseconds. This will delay the API's response by the time set.
  4. Response: For a single endpoint, we can have multiple responses. This selector lets you toggle between them. However, Mockfly will always return the one set as default.
  5. Status code: Specify the status code with which you want the mock API to respond. This is handy for testing various scenarios.
  6. Add response: Create another response to return a different status code or body.
  7. Delete response: Delete the currently viewed response. However, there always needs to be at least one.
  8. Set response as default: By pressing this button, the displayed response is set as default, which means it's the one Mockfly will return.

Duplicate endpoint

When we have endpoints that are very similar but differ in some data, and we would go much faster if we could duplicate an endpoint and then modify it. This can be done by using the contextual menu of the endpoint. If we right-click, a contextual menu will open where we can duplicate our endpoint or delete it.

Endpoint context menu

If we select 'Duplicate', an endpoint identical to the one we had selected will be created, maintaining the rules, method, etc., but it will add a suffix 'duplicated' to the end of the path that we should modify.

Editing body

Now that we have an endpoint named /users, we can edit the body using the integrated code editor. For this test, I'll edit the body with the following JSON:

[{"id": 1, "name": "Sergio"}, { "id": 2, "name": "test" }]

Look in the top left corner, and you'll see a saving indicator. When it reads "Saved", it means all data has been saved. Typically, it's fast, and you may not even notice you're editing an endpoint. ;)

Test my endpoint

Once my endpoint is set up with a decent body, I can test it. I have several options. The first, available only for GET requests, is the "Try it" button. This will open a new browser tab and show the response of the created endpoint. Note, this only works if the URL doesn't have dynamic parameters, like /users/:id.

Another option is to click the button on the left with the link icon, which will copy the base URL of your project to the clipboard. Then, add the path of your endpoint to this base. For example:

Body history

At times, we make alterations to our mocks only to later wish to revert to the previous version. For this purpose, there's a tab labeled 'History' where you can track the changes made to your endpoint's mock. It operates similar to Git's 'diff' feature. Simply click on the change you wish to review, and it will display what was modified compared to the previous version. This way, you can keep track of the alterations made to your endpoint's response

Body history

Endpoint logs

Do you want to know if you're calling the endpoint of your mock API correctly? In the "Logs" tab, you can view the calls made to that specific endpoint. It will display the timestamp, the route, and the status code of the response. This way, you can track the calls made to your endpoint. It's not real-time (yet), but you can refresh the logs by clicking the "Refresh Logs" button.

Endpoint logs

Can't remember where you returned a specific string? You can easily find it with the advanced text search feature in your mock endpoint responses.

Advanced search

To use the advanced search, simply press "cmd + f" or "ctrl + f" and a search bar will appear where you can type the text you want to find. This will display a list of endpoints along with their responses and the line where a match with the entered text has been found. Keep in mind that it is case sensitive. Once you click on a result, it will take you to that endpoint, select the correct response, and highlight the line in green.

Keep in mind that this feature is only for premium users.

Active users in a project

You can see which users are active in a project at the same time as you, as Mockfly displays users who are connected at the same time as you. It's a functionality very similar to the user view in Google Docs, which provides a list of active users in a project. This will allow you to know if there's any user in your project who might be making changes at the same time as you.

Active users