📂 API Providers > Build an Airnode

# Heartbeat (optional)

At the end of an Airnode's run (every minute), Airnode can make an HTTP POST request to a specified URL. This is both to signal that the Airnode is alive and working (useful especially right after the deployment) and also as a notification every time it runs (self-operates).

  1. Airnode gathers on-chain requests targeting the API it supports.

  2. The required API operation for each request is called.

  3. A response is sent to each request.

  4. Finally Airnode makes a request to the heartbeat URL (HTTP POST). This could be to an operation within the API Airnode supports or to any cloud REST endpoint such as a monitoring service.

Turn on the optional heartbeat functionality by setting all fields in the config.json section for nodeSettings.heartbeat.

{
  ois:{...},
  triggers:{...},
  chains:{...},
  environment:{...},
  nodeSettings:{
      "airnodeWalletMnemonic": "<FILL_*>",
      "cloudProvider": {
        "type": "aws",
        "region": "us-east-1"
      },
      "heartbeat": {
        "enabled": true,
        "url": "${HEARTBEAT_URL}",
        "apiKey": "${HEARTBEAT_API_KEY}",
        "id": "${HEARTBEAT_ID}"
      },
      "httpGateway": {
        "enabled": true,
        "apiKey": "${HTTP_GATEWAY_API_KEY}",
        "maxConcurrency": 20,
        "corsOrigins": []
      },
      "httpSignedDataGateway": {
        "enabled": true,
        "apiKey": "${HTTP_SIGNED_DATA_GATEWAY_API_KEY}",
        "maxConcurrency": 20,
        "corsOrigins": []
      },
      "logFormat": "json",
      "logLevel": "INFO",
      "nodeVersion": "0.9.2",
      "stage": "testnet",
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  • enabled: Enable/disable Airnode's heartbeat.
  • url: The URL to make the heartbeat request to.
  • apiKey: The API key to authenticate with the heartbeat URL.
  • id: The Airnode heartbeat ID for accounting purposes.

# Heartbeat Endpoint

The table below illustrates the parameters passed to the Heartbeat URL.

name in type
airnode-heartbeat-api-key header string
deployment_id body string
http_gateway_url body string
http_signed_data_gateway_url body string

Below is an example of what is included in the request body to heartbeat.url.

{
  "deployment_id": "916d3ec80fda",
  "http_gateway_url": "https://some.aws.http.gateway.url/v1",
  "http_signed_data_gateway_url": "https://some.aws.http.signed.data.gateway.url/v1"
}
1
2
3
4
5
airnode-heartbeat-api-key:API key for heartbeat calls configured in nodeSettings.heartbeat.apiKey. Used for authentication against the heartbeat service running on URL from nodeSettings.heartbeat.url.
deployment_id:An ID for accounting purposes, unique to the deployed Airnode.
http_gateway_url:If HTTP gateway is enabled this is the URL of the gateway you can make test HTTP calls against.
http_signed_data_gateway_url:If HTTP signed data gateway is enabled this is the URL of the gateway you can make HTTP calls against.
Last Updated: 12/13/2022, 10:41:09 AM