---
title: "Create a MultiHTTP check | Grafana Cloud documentation"
description: "Create a MultiHTTP check This tutorial shows how to create your first MultiHTTP check. MultiHTTP checks provide a form-based approach for defining multi-step tests. They’re great for testing workflows, and give you the flexibility to pass data from one request to the next. For example, if you have an e-commerce application, you can create a MultiHTTP check to test a user workflow that would log in to your application, add an item to the shopping cart, check out, and then log out of your application."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Create a MultiHTTP check

This tutorial shows how to create your first MultiHTTP check. MultiHTTP checks provide a form-based approach for defining multi-step tests. They’re great for testing workflows, and give you the flexibility to pass data from one request to the next. For example, if you have an e-commerce application, you can create a MultiHTTP check to test a user workflow that would log in to your application, add an item to the shopping cart, check out, and then log out of your application.

In this tutorial you will:

- Create a MultiHTTP check using the [QuickPizza](https://quickpizza.grafana.com) service. The check will have three requests:
  
  - Log in using a pre-defined `synthetics_multihttp_example`.
  - Add a pizza rating object to the user’s list, then delete it.
  - Log out.
- Set up assertions for each request to ensure they’re working as expected.

## Before you begin

- A Grafana instance with [Synthetic Monitoring set up](/docs/grafana-cloud/testing/synthetic-monitoring/set-up/).

> Note
> 
> This tutorial uses the [QuickPizza](https://quickpizza.grafana.com) service, which is a public shared environment. You can use it and follow along this tutorial, but it’s recommended to avoid high-load tests. The service is also [open source](https://github.com/grafana/quickpizza) if you’d like to deploy a private instance.

## Create a MultiHTTP check

To create a MultiHTTP check:

1. Open your Grafana instance.
2. On the left-hand menu, select **Testing &amp; Synthetics**.
3. Click **Synthetics**.
4. Click **Add new check**.
5. Select **Create Multi Step check**.

After that, you will see the **New Multi Step check** page where you can configure your new check. The first step is to define the check:

1. Fill out **Job name**.

### Log in to an application

The **Requests** section is where you can configure the specific endpoints you want the MultiHTTP check to test.

For this tutorial, the first step is to make a log in request to the `quickpizza.grafana.com` application:

1. Under **Request target**, select **POST** in the methods list.
2. Under **Request target**, enter `https://quickpizza.grafana.com/api/users/token/login?set_cookie=true` in the input field.
3. Click **Request options**
4. Select the **Request Body** tab and fill out the following fields:
   
   1. Under **Content type**, enter `application/json`.
   2. Under **Request body payload**, copy and paste the following payload:
   
   JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```json
   {
     "username": "synthetics_multihttp_example",
     "password": "synthetics_multihttp_example"
   }
   ```

Note that this login call will create a session cookie, which is needed to authenticate subsequent calls. k6 handles the session cookie just as a browser would. It transparently manages the receipt, storage, and transmission of cookies.

### Create an object and extract a variable

The next step is to configure a `POST` call to create a pizza rating in the test application, and then grab the newly created rating ID to use in the next request and delete it.

To create a pizza rating in the test application:

1. Click **+ Add request** below the first request you created in the last step.
2. Under **Request target** set the method to `POST`.
3. Under **Request target** enter `https://quickpizza.grafana.com/api/ratings` in the input field.
4. Click **Request options**.
5. Select the **Request Body** tab and:
   
   - Set **Content type** to `applicaton/json`.
   - Set **Request body payload** to:
   
   JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```json
   {
     "stars": 5,
     "pizza_id": 1
   }
   ```

Before adding the next request, you need to create a variable to store the rating object ID:

1. Click **Set variables**.
2. Click **+ Add variable**.
3. Set **Variable name** to `objectId`.
4. Set **Variable type** to **JSON path**.
5. Set **Variable expression** to `id`.

### Delete an object using previously set variables

To delete the pizza rating you just created in the test application:

1. Click **+ Add request** below the second request you created in the last step.
2. Under **Request target** set the method to `DELETE`.
3. Under **Request target** enter `https://quickpizza.grafana.com/api/ratings/${objectId}` in the input field.
   
   - `${objectId}` is the variable that you created in the previous request. When the check runs, that will get replaced with the value for that variable.

### Log out of an application

The final step is to log out of the application. To do that:

1. Click **+ Add request** below the request you created in the last step.
2. Under **Request target** set the method to `POST`.
3. Under **Request target** in the input field enter `https://quickpizza.grafana.com/api/users/token/logout`.

## Define uptime with assertions

It’s also important to set up **Request Assertions** for each request you create. That way you can have Synthetic Monitoring automatically validate things such as the response code from your request, or that the response body includes a specific property and value.

To set up these assertions you have to go to the **Define uptime** section:

1. Click the **Define uptime** option in the sidebar.

Here you can see the four requests you created in the previous section, and you will set up assertions for each one.

Under the first request titled **POST [https://quickpizza.grafana.com/api/users/token/login](https://quickpizza.grafana.com/api/users/token/login)**:

1. Click **+ Add assertion** below the first request.
2. For the assertion, set:
   
   - **Assertion type** to **Text**.
   - **Subject** to **HTTP status code**.
   - **Condition** to **Equals**.
   - **Value** to `200`.

Under the second request titled **POST [https://quickpizza.grafana.com/api/ratings](https://quickpizza.grafana.com/api/ratings)**:

1. Click **+ Add assertion**.
2. For the first assertion, set:
   
   - **Assertion type** to **Text**.
   - **Subject** to **HTTP status code**.
   - **Condition** to **Equals**.
   - **Value** to `201`.
3. Click **+ Add assertion**.
4. For the second assertion, set:
   
   - **Assertion type** to **JSON path value**.
   - **Expression** to `stars`.
   - **Condition** to **Equals**.
   - **Value** to `5`.

Under the third request titled **DELETE [https://quickpizza.grafana.com/api/ratings/${objectId}](https://quickpizza.grafana.com/api/ratings/$%7bobjectId%7d)**:

1. Click **+ Add assertion**.
2. For this assertion, set:
   
   - **Assertion type** to **Text**.
   - **Subject** to **HTTP status code**.
   - **Condition** to **Equals**.
   - **Value** to `204`.

Under the fourth request titled **POST [https://quickpizza.grafana.com/api/users/token/logout](https://quickpizza.grafana.com/api/users/token/logout)**:

1. Click the **+ Add Assertion** tab.
2. For this assertion, set:
   
   - **Assertion type** to **Text**.
   - **Subject** to **HTTP status code**.
   - **Condition** to **Equals**.
   - **Value** to `200`.

Now, for every check run, Synthetic Monitoring will validate those assertions.

## Set probe locations and frequency

Next, you have to configure the **Probes**, which represent the locations where you want to run your test from, and how frequent you want your check to run:

1. Click **Execution** in the sidebar.
2. Select at least one probe from the **Probe locations** drop-down.
3. You can leave the **Frequency** fields with the default value.

## Test and save your check

You can click **Test** at the end of the screen to have Synthetic Monitoring run your check, and make sure you get a `200 OK` response that shows your check is working correctly. It will test your requests and assertions and show you the results.

When you are happy your check is working correctly click **Submit**.

Your check will now run from the probe locations that you selected, and with the default frequency value. Your check will make sure that the endpoints you configured are working correctly, and if you have any issues, you will be able to see them in your check dashboard.

## Next steps

Now that you have a MultiHTTP check configured, you can:

- Refer to [Create a k6 scripted check](/docs/grafana-cloud/testing/synthetic-monitoring/get-started/create-a-k6-scripted-check/) to see how you can create a similar check that uses the QuickPizza application, but using JavaScript to make your check even more flexible.
- Refer to [Check types](/docs/grafana-cloud/testing/synthetic-monitoring/create-checks/checks/) to get more information about the metrics and options available for the MultiHTTP check type.
- Refer to [Analyze results](/docs/grafana-cloud/testing/synthetic-monitoring/analyze-results/) to learn more about how you can visualize and analyze the data collected by your check
- Refer to [Synthetic Monitoring alerting](/docs/grafana-cloud/testing/synthetic-monitoring/configure-alerts/) to learn how to create and configure alerts in case your check fails.
