Mocks

Mock servers in Insomnia

A mock server is a tool used to simulate API endpoints. These can be particularly useful while designing an API. They can be self-hosted or hosted on the cloud.

Cloud-hosted mocks

The Insomnia Cloud mock servers allow you to create a mock endpoint in a few steps. You simply need to provide an endpoint and a sample response. You get a number or free mock requests based on your plan. For more details, see the pricing page.

Learn more about cloud-hosted mock servers →

Self-hosted mocks

Enterprise users can deploy self-hosted mock servers using Insomnia Mockbin. This allows you to have more control over usage for your mocks.

Learn more about self-hosted mock servers →

Auto-generated mocks

Auto-generate a mock server from a natural language prompt and one of the following input types: URL, OpenAPI, or JSON. This feature is optional and can be deactivated.

Learn more about auto-generated mock servers →

Security warnings

  • Always be sure you trust the author of a mock server before calling it, visiting it, or adding it to your code.
  • Like any URL, mock servers can contain malicious content or redirects.
  • To enable easy use from anywhere, especially for front-end feature development, Insomnia’s mock servers have a very permissive CORS configuration (Access-Control-Allow-Origin: *, Access-Control-Allow-Credentials: true). A malicious API could be used to exfiltrate data.

Dynamic mocking

Dynamic mocking expands Insomnia’s mock servers with templates that generate context-aware and realistic responses.
Each response is rendered server-side by the mock server using templates with a safe, restricted tag set.
Insomnia also provides Faker template tags for generating random names, dates, and other test data at runtime.

Dynamic mocking is supported in self-hosted mock servers, and powered by the Insomnia Mockbin service. Learn more about Dynamic mocking

Frequently asked questions

Yes, all plans have access to mocks, with some limitations based on the plan. Enterprise users have unlimited requests on cloud-hosted mock servers and have the option to deploy self-hosted mocks. See the API mocking section of the pricing page for more information.

Yes, you can generate a mock endpoint from a request response. After sending a request, go to the Mock tab in the right panel and select or create a new mock server and route. The generated endpoint will contain the response body, headers, and status.

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!