# Get a heartbeat's availability summary

Returns availability summary for a specific heartbeat.

[endpoint]
base_url = "https://uptime.betterstack.com"
path = "/api/v2/heartbeats/{heartbeat_id}/availability"
description = "Returns availability summary for a specific heartbeat"
method = "GET"

[[path_param]]
name = "heartbeat_id"
description = "The ID of your requested heartbeat"
required = true
type = "string"

[[query_param]]
name = "from"
description = "Start date (e.g., 2021-01-26)"
required = false
type = "string"

[[query_param]]
name = "to"
description = "End date (e.g., 2021-01-27)"
required = false
type = "string"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"
[/endpoint]

[responses]
[[response]]
status = 200
description = '''Returns the availability summary since the heartbeat was created or for the specified date range.

<br>

The values of `total_downtime`, `longest_incident`, and `average_incident` are in seconds'''
body = '''{
  "data": {
    "id": "824910",
    "type": "heartbeat_availability",
    "attributes": {
      "availability": 99.98,
      "total_downtime": 335,
      "number_of_incidents": 5,
      "longest_incident": 194,
      "average_incident": 67
    }
  }
}'''

[[response]]
status = 400
description = '''When the optional from and to dates are invalid (e.g., the start date is in the future or the end date is before the start date).
'''
body = '''{
  "errors": "The data range is invalid. The date format could not be parsed, the start time is in the future, or the end time is before the start time."
}'''
[/responses]

#### Example cURL 

```shell
[label Example]
curl --request GET \
  --url https://uptime.betterstack.com/api/v2/heartbeats/123456789/availability?from=2021-01-26&to=2021-01-27 \
  --header "Authorization: Bearer $TOKEN"
```

[info]
#### Looking for the details of a specific parameter?

Explore [the list of all heartbeats API parameters](https://betterstack.com/docs/uptime/api/heartbeats-api-response-params/)
[/info]