# List hosts where a collector is running

Returns a list of hosts where the specified collector is running.

[endpoint]
base_url = "https://telemetry.betterstack.com"
path = "/api/v1/collectors/{id}/hosts"
method = "GET"

[[path_param]]
name = "id"
description = "The unique identifier of the collector."
required = true
type = "string"

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

[responses]
[[response]]
status = 200
description = "A list of hosts for the collector."
body = '''
{
  "data": [
    {
      "id": "101",
      "type": "collector_host",
      "attributes": {
        "hostname": "k8s-node-1.example.com",
        "status": "online",
        "version": "0.1.0",
        "ip_address": "10.0.1.10",
        "pinged_at": "2023-10-27T10:05:00.000Z",
        "created_at": "2023-10-26T10:01:00.000Z"
      }
    },
    {
      "id": "102",
      "type": "collector_host",
      "attributes": {
        "hostname": "k8s-node-2.example.com",
        "status": "offline",
        "version": "0.1.0",
        "ip_address": "10.0.1.11",
        "pinged_at": "2023-10-27T09:00:00.000Z",
        "created_at": "2023-10-26T10:02:00.000Z"
      }
    }
  ]
}
'''

[[response]]
status = 401
description = "Invalid or missing authentication token."

[[response]]
status = 404
description = "A collector with the specified ID was not found."
[/responses]

#### Example Request

```shell
[label cURL]
curl -L -H "Authorization: Bearer $TOKEN" \
     "https://telemetry.betterstack.com/api/v1/collectors/1/hosts"
```
