# Making your first query

Now that you have obtained an `access_token` from the [Authentication](/getting-started/authentication.md) step, we are ready to make our first request. Here is an example of a request with authorization to our GraphQL API to obtain `sensors` data.

### Authorization in Header

```
{"Authorization": "Bearer [access_token]"}
```

### GraphQL Query

```graphql
query MyFirstQuery {
  sensors {
      data {
          client_id
          floor_id
          room_id
          hive_id
          hive_serial
          sensor_id
          name
          mac_address
          mode
          model
          sensitivity
          center
          height
          orientation
          field_of_view
      }
  }
}
```

### Code Examples

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

```javascript
curl --location 'https://api.butlr.io/api/v3/graphql' \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer [insert access_token here]' \
--data '{"query":"query MyFirstQuery {\n  sensors {\n      data {\n          client_id\n          floor_id\n          room_id\n          hive_id\n          hive_serial\n\n          sensor_id\n          name\n          mac_address\n          mode\n          model\n          sensitivity\n          center\n          height\n          orientation\n          field_of_view\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 GetSensors {\\n    sensors {\\n      data {\\n        room_id\\n        room {\\n            name\\n        }\\n        floor_id\\n        client_id\\n        name\\n        sensor_id\\n        mac_address\\n        is_online\\n        is_streaming\\n        center\\n      }\\n    }\\n    hives {\\n        data {\\n            floor_id\\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 [insert access_token here]")

  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 GetSensors {\\n    sensors {\\n      data {\\n        room_id\\n        room {\\n            name\\n        }\\n        floor_id\\n        client_id\\n        name\\n        sensor_id\\n        mac_address\\n        is_online\\n        is_streaming\\n        center\\n      }\\n    }\\n    hives {\\n        data {\\n            floor_id\\n        }\\n    }\\n}\",\"variables\":{}}"
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer [insert access_token here]'
}

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/getting-started/making-your-first-query.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.
