# Correlation

{% embed url="<https://www.youtube.com/watch?v=1knf6Ou_phY>" %}

Correlation allows you to link steps together. For instance, you can design a test scenario to evaluate your authentication process by taking the following steps: First, obtain the authentication token from the response of a login request. Then, insert the extracted token into subsequent requests. This short example demonstrates how correlation works in practice.

#### Capture Value from the Response

1. Click the ***More*** button located to the right of the step and open the "Step Details" section.

   <figure><img src="https://2539979715-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FugegoRCn84wtxrIelgft%2Fuploads%2FmbSwQfviZSrch1Ui5a5X%2Fimage.png?alt=media&#x26;token=c8f52039-4e64-4f43-81eb-ad417fa79dd4" alt=""><figcaption><p>Step Detail Button </p></figcaption></figure>
2. To capture a value from the response of a step, go to the "Capture" tab in the "Step Detail" section and follow these steps:

   * Give a unique name to a variable that you will use to access the captured value in subsequent requests.
   * Select whether to extract the value from the response body or response headers.
   * Choose the appropriate extraction type based on where you extract the value.
   * If you're extracting from the response body, you can use JSON path, XML path, or regular expressions to extract the value.
   * If you're extracting from response headers, you can extract the entire header value or a part of the header value by using regular expressions.

   <div><figure><img src="https://2539979715-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FugegoRCn84wtxrIelgft%2Fuploads%2FUAZ9a8YlKo61gVCfLjjm%2Fimage.png?alt=media&#x26;token=7754db95-af39-43a8-bfff-e52242586ca7" alt=""><figcaption></figcaption></figure> <figure><img src="https://2539979715-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FugegoRCn84wtxrIelgft%2Fuploads%2FmpULA3LbbiQzvDgFFN2x%2FScreenshot%202023-04-17%20at%2019.32.08.png?alt=media&#x26;token=be4faa8a-d042-4b8e-9357-0442c3ddd39d" alt=""><figcaption></figcaption></figure></div>

#### Use Captured Value in Requests

You can use the format {{captured\_variable\_name}} to insert a value that was previously captured into various parts of subsequent requests. This includes the URL, the request body, query parameters, headers, and authentication information.

<figure><img src="https://2539979715-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FugegoRCn84wtxrIelgft%2Fuploads%2FJtho1KjE92O1YdYK0cuk%2Fimage.png?alt=media&#x26;token=bc359682-fd42-4073-9e2d-af96e5d3aed3" alt=""><figcaption></figcaption></figure>
