Skip to main content


Front-end development often relies on back-end API, and it is difficult to start the front-end work without the back-end API in place. Thats why we have Mock to deal with this issue. With Mock, front-end and back-end can cooperate concurrently. While back-end API is getting ready, front-end developers can utilize Mock to generate dummy data for development and debugging.

1. Mock Overview

Mock can automatically generate dummy data based on API or data structure definition, Mock rule configuration, and Mock expectation configuration. In addition, Mock provides flexibility to construct various APIs based on users’ needs.

In most scenarios, Apidog can generate user-friendly data by default.

How to Generate User-Friendly Mock Data Efficiently with Apidog?

  • Apidog can generate mock rules based on data structure and data type in the API definition.
  • Apidog has a built-in smart mock, which generates mock rules based on field name and field data type. For example, if a string field contains “image”, “time”, “city”, etc... in its name, Apidog will generate a url,string or name according to its field.
  • Based on built-in mock rules, Apidog can automatically identify fields, such as image, avatar, username, cell phone number, URL, date, time, timestamp, email, province, city, address, and IP, to generate user-friendly dummy data.
  • In addition to the built-in mock rules, users can also customize rules to meet various personalization needs. It supports string field matching using regular expressions or wildcards.

Below is an example of mock data generated by Apidog without any configuration:


The Difference Between Local and Cloud Mock Service

When you are running Apidog desktop app, you can use the local mock service.

When you are running Apidog web app, you can use the remote mock service.

2. URL Mock Request URL

The request method needs to be consistent with the API definition.

If your project ID is 18600, mock API ID is 89343, path is /user/123, and request method is POST, your mock URL is:

// Local Mock Address

// Cloud Mock Address

After defining the API and data structure, you can visit the URL above to visit the Mock data API without any additional manual configuration.

Mock URL

Local Mock:

  • Path:{project_id}-{version_id}-{service_id}/{api_path}
  • Example:
  • ID:{project_id}-{version_id}-{service_id}/{api_path}
  • Example:

Cloud Mock

  • Path:{project_id}-{version_id}-{service_id}/{api_path}
  • Example:
  • ID:{project_id}-{version_id}-{service_id}/{api_path}
  • Example:
  • Project ID: You can view it in Project Settings.
  • Version ID: The default version ID is 0. Which is the main version.
  • Service ID: You will only need to specify the service ID when there are multiple services in the project. Otherwise, use default for the default service.
  1. When the mock service runs locally, the URL IP address is If other machines need to access the mock data, simply change to intranet ip. If its still not accessible, please check whether the firewall is blocking port 3658 for the mock.
  2. If there are multiple APIs with the same method and path, please use one of the following methods to specify API to avoid possible path conflicts:
    1. API Path method:Additional query parameter ( ?apidogApiId={api_id}).
    2. API ID mode: No additional setup is required.
  3. If the API path does not start with /, you will not be able to use API path method. Use API ID instead.
  4. The mock service is turned on by default. No additional setup is required.
  5. The base URL in mock service is fixed. No manual modification is allowed.

Mock Feature in previous version

It is currently still backward compatible, but it will be deprecated in the future version.

  • Path:{project_id}/{api_path}
  • Example:
  • ID:{project_id}/{api_path}
  • Example:[](

Get API mock URL

Go to API details - View in Apidog to find the corresponding mock URLs.


3. Custom Mock Rule

Apidog also supports custom Mock Rule to meet your various business requirements.

Define mock rule in data structure definition

When defining schemas, you can set mock rules manually. We support Faker.js Data Placeholder Definition (DPD).

Data field advanced settings

You can also use the maximum, minimum, enumerated, pattern, and format values set in the advanced settings of the data field.


Advanced Mock

Advanced Mock is the most flexible mock. You can use custom schemas (not limited by the data structure of the API). The API can return different data based on the different request parameters.

Smart Mock

Smart Mock comes in when you do not provide mock rules for the fields in the return response (or data structure), the system will automatically generate realistic mock data without any manual configuration.

4. Mock Rule Priority

The priority of mock rule is as followed:

  1. Expectations in Advanced Mock of the API Detailed Settings (based on API parameters)
  2. Mock rules in the data structure.
  3. The Maximum, minimum, enumerated, pattern, and format values in the advanced settings of the data field.
  4. Custom mock rules defined in project settings - smart mock.
  5. Built-in mock rules in project settings - smart mock.
  6. The data type field in the data structure.

Automatically the system will default to mock the data structure of the first response in the API definition. If you want to mock other responses, you can get the mock URL of other responses in the Mock module of the API Detail Settings - View page.