# Hives

A Hive is associated with a specific [floor](/asset-management/graphql-api-overview/floors.md) within a building. It is the central hub for managing and transmitting data from sensors to the cloud, ensuring efficient communication and data processing.

This page provides guidance on how to **retrieve hive information** within an organization.

{% hint style="success" %}
First, obtain an access token to get started [here](/getting-started/authentication.md).
{% endhint %}

***

### Get all hives

```graphql
query allHives {
  hives {
    data {
      id
      name
      room_id
      sensors {
        sensor_id
        name
      }
    }
  }
}
```

#### Code Examples

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location 'https://api.butlr.io/api/v3/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTMwMTgyLCJleHAiOjE3MjY1MzExODIsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.ZHo0fZqCELwb_VrGmdL3AaNeVD2vwMODJzgxivSJ9U0yhmg-769s6i-wmahIpe3Bi0yZRN2gY5jaIdsow5UoMRXnSUrBnQhukeytAq39_F27G5vvHpyn2OJk5gwfv8EHnROclCzOsYtKW7meA6o_bMnGl7JDnDboQwWARFEPGJUfm5UYj5rfoSK24JJtODPDf5hSuUZUQNi5hGOScmEL5F38fgq_lVjnEkxo37BsJsJKBhnKr5TlwB9ErA1Njzxz6Vs_N9au1bEe5WTzHGboGEsvl-ghfFnEMOW9StG_URhC-Ntp8n461MHQl-x7VmajTkjHLmIVyiXUO2OxYVQjkg' \
--data '{"query":"query allHives {\n  hives {\n    data {\n      id\n      name\n      room_id\n      sensors {\n        sensor_id\n        name\n      }\n    }\n  }\n}","variables":{}}'
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.butlr.io/api/v3/graphql"
  method := "POST"

  payload := strings.NewReader("{\"query\":\"query allHives {\\n  hives {\\n    data {\\n      id\\n      name\\n      room_id\\n      sensors {\\n        sensor_id\\n        name\\n      }\\n    }\\n  }\\n}\",\"variables\":{}}")

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("Authorization", "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTMwMTgyLCJleHAiOjE3MjY1MzExODIsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.ZHo0fZqCELwb_VrGmdL3AaNeVD2vwMODJzgxivSJ9U0yhmg-769s6i-wmahIpe3Bi0yZRN2gY5jaIdsow5UoMRXnSUrBnQhukeytAq39_F27G5vvHpyn2OJk5gwfv8EHnROclCzOsYtKW7meA6o_bMnGl7JDnDboQwWARFEPGJUfm5UYj5rfoSK24JJtODPDf5hSuUZUQNi5hGOScmEL5F38fgq_lVjnEkxo37BsJsJKBhnKr5TlwB9ErA1Njzxz6Vs_N9au1bEe5WTzHGboGEsvl-ghfFnEMOW9StG_URhC-Ntp8n461MHQl-x7VmajTkjHLmIVyiXUO2OxYVQjkg")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://api.butlr.io/api/v3/graphql"

payload = "{\"query\":\"query allHives {\\n  hives {\\n    data {\\n      id\\n      name\\n      room_id\\n      sensors {\\n        sensor_id\\n        name\\n      }\\n    }\\n  }\\n}\",\"variables\":{}}"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjJwTC04ZGRDNlhMaDNEblVHa2ptWiJ9.eyJodHRwOi8vYnV0bHIuaW8vY2xpZW50X2lkIjoiY2xpZW50XzJDbFlBYVY1Z0FISlJjUDdsd3JoTUU5ejR1WSIsImh0dHA6Ly9idXRsci5pby9lbWFpbCI6ImV2YWxfMjUxMzMzQGJ1dGxyLnRlY2giLCJodHRwOi8vYnV0bHIuaW8vcm9sZXMiOltdLCJpc3MiOiJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8dXNlcl8yQ2xZQVpTZjZlMzJVUFRrVVBSUUplTWhLbkciLCJhdWQiOlsiaHR0cHM6Ly91c2Vycy5idXRsci5pby8iLCJodHRwczovL2J1dGxydGVjaC51cy5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNzI2NTMwMTgyLCJleHAiOjE3MjY1MzExODIsInNjb3BlIjoib3BlbmlkIGVtYWlsIHByb2ZpbGUgb2ZmbGluZV9hY2Nlc3MiLCJndHkiOiJwYXNzd29yZCIsImF6cCI6Imw0bHh3MUsySjlQdUJ2UEZlNXlidkoyejhUNjBNc0pJIiwicGVybWlzc2lvbnMiOltdfQ.ZHo0fZqCELwb_VrGmdL3AaNeVD2vwMODJzgxivSJ9U0yhmg-769s6i-wmahIpe3Bi0yZRN2gY5jaIdsow5UoMRXnSUrBnQhukeytAq39_F27G5vvHpyn2OJk5gwfv8EHnROclCzOsYtKW7meA6o_bMnGl7JDnDboQwWARFEPGJUfm5UYj5rfoSK24JJtODPDf5hSuUZUQNi5hGOScmEL5F38fgq_lVjnEkxo37BsJsJKBhnKr5TlwB9ErA1Njzxz6Vs_N9au1bEe5WTzHGboGEsvl-ghfFnEMOW9StG_URhC-Ntp8n461MHQl-x7VmajTkjHLmIVyiXUO2OxYVQjkg'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.butlr.io/asset-management/graphql-api-overview/hives.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
