# How to use dynamic variables in Heartbeat configuration

**URL:** https://discuss.elastic.co/t/how-to-use-dynamic-variables-in-heartbeat-configuration/380450
**Category:** Beats
**Tags:** heartbeat
**Created:** [July 25, 2025, 2:05am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-variables-in-heartbeat-configuration/380450 "2025-07-25T02:05:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![openapiplatform25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/openapiplatform25/32/144313_2.png) [@openapiplatform25](https://discuss.elastic.co/u/openapiplatform25)
#### Post date: [July 25, 2025, 2:05am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-variables-in-heartbeat-configuration/380450/1 "2025-07-25T02:05:37Z")

</div>

Hi,

I'd like to use dynamic variables in the Heartbeat configuration, specifically for request parameters.

In our use case, the API we monitor requires a different parameter for each request. This value must be unique each time and is typically generated and stored in a database with a unique key (UK), so duplication is not allowed.

Here’s an example of what we want to achieve:

```yaml
heartbeat.monitors:
  - type: http
    urls: ["http://example.com"]
    timeout: 5s
    check.request:
      headers:
        RequestKey: {{date}}

```

In this case, I would like the `{{date}}` variable to be replaced with something like `20220101000000000` at request time.

This is just a simplified example. Ideally, we want to use either:

- built-in system variables (like timestamps),
- or fetch values from an external file or environment.

To summarize:  
**Is there any built-in or supported way to inject dynamic or external variables into Heartbeat monitor configurations?**

Thanks in advance!

---

<div class="post-metadata">

### Author: ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)
#### Post date: [July 25, 2025, 10:47am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-variables-in-heartbeat-configuration/380450/2 "2025-07-25T10:47:28Z")

</div>

Hello @openapiplatform25

Welcome to the community.

I found a similar post :

> [@Set dynamic headers in every request](https://discuss.elastic.co/t/set-dynamic-headers-in-every-request/319118):
>
> Hi, We are monitoring a series of machines with heartbeat and we have a special casuistic in which we need heartbeat to send the timestamp in which the request is made, we don't care if by headers, params, or query params. Is it possible in each execution to add the dynamic timestamp to a header for example? By using javascript or elastic variables. Something like: check.request: method: GET headers: 'Content-Type': 'application/json' 'X-Heartbeat-Timestamp': {{time…

If you need a unique key for each document i was wondering if we can use an ingest pipeline & fingerprint processor to add unique key based on timestamp for each record like below :

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/e/5ee0e81c8d4b6f76a3a49bc9cb9d29f97e05924c.png)

Thanks!!

---

<div class="post-metadata">

### Author: ![openapiplatform25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/openapiplatform25/32/144313_2.png) [@openapiplatform25](https://discuss.elastic.co/u/openapiplatform25)
#### Post date: [August 11, 2025, 6:59am UTC](https://discuss.elastic.co/t/how-to-use-dynamic-variables-in-heartbeat-configuration/380450/3 "2025-08-11T06:59:46Z")

</div>

Hello @Tortoise

Thank you for your answer.  
There seems to be no way to use Heartbeat

As you refer to, I need to think about how to use Synthesis.  
Thank you.
