# Simulation

## Overview

Simulations are JSON files that contains pairs of HTTP requests and their corresponding HTTP responses, also known as request/response pairs.

The simulation file, once created, defines what the API simulation will look like and how it will respond to requests. You load the simulation file into a Hoverfly service in order to have a real running API Simulation.

A simulation file consists of a number of request/response pairs. The request part defines "matchers" that you configure to match the pattern of an incoming HTTP request. For example your matcher might be configured to match on an incoming GET request with a path that matches a particular regular expression that you define. When a matcher makes a match, Hoverfly returns the corresponding response that is paired with that request matcher.

Hoverfly Cloud manages simulations created by you or your team (for Enterprise accounts) in one place.

We currently provides 4 convenient ways of creating a simulation:

* [Capture real service activities](/create-simulations/create-simulations.md#capture-real-service-activities)
* [Manual design using the Simulation Editor](/create-simulations/create-simulations.md#manual-design-using-the-simulation-editor)
* [Convert from a Swagger Specification](/create-simulations/create-simulations.md#convert-from-a-swagger-specification)
* [Upload from an existing Hoverfly simulation file](/create-simulations/create-simulations.md#upload-from-an-existing-simulation-file)

A simulation is only a configuration file, you use it by [importing it into a virtual service](/work-with-services.md#start-a-service).

## Key features

Hoverfly simulation supports these commonly used Service Virtualization features:

* Strict or loose HTTP request matching based on URL, method, body and header combinations.
* Build dynamic response using templating using handlebars syntax. Read more [here](/create-simulations/using-templating-in-simulations.md).
* Simulate different responses to the same request based on the current state of a service (Stateful Simulation).
* Render data from a data-source using a provided key. Read more [here](/create-simulations/using-data-sources-in-simulations.md).
* Add fixed or lognormal delay to the response.

Hoverfly Cloud also provides an easy-to-use Simulation Editor to let you create/edit simulation data without any knowledge of the [Hoverfly simulation schema](https://hoverfly.readthedocs.io/en/latest/pages/reference/simulationschema.html).

The editor gives you auto-completion and suggestions for things like response status code, header names, request matchers and state keys. You can work with the JSON/XML/HTML body using the embedded code editor which provides syntax highlighting and validation. The code editor also supports auto-completion of templating functions, and automatic conversion of encoded body. Batch processing is possible with the global find-and-replace rules.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloud.hoverfly.io/create-simulations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
