API mocks are useful for simulating an API endpoint. For example, when building a front end while the backend API is under construction and unstable, Insomnia allows us to customize responses from a set of API paths to simulate a static API. This mocked URL can then replace our front end API backend URL.
Any logged-in user can create API mocks, accessible at mock.insomnia.rest. These mocks can be collaborated on with a team and accessed by anyone.
Enterprise plans have access to self-hosted mocks, providing unrestricted access and more control over usage.
Configuration details can be found at GitHub - Kong Insomnia Mockbin, and the Docker image is available at ghcr.io/kong/insomnia-mockbin:master.
From the request collection screen, on the response pane to the right, we can use the Mock Response tab to extract the most recent response and API path from the currently selected request to build an API mock. This feature is a time-saver when we already have our response structures within Insomnia that we would like to make available from our API mock.