> For the complete documentation index, see [llms.txt](https://docs.kiloiot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kiloiot.io/kilo-docs-pt/kilo-iot-server/api/examples.md).

# Exemplos

Exemplos de autenticação para a API Kilo IoT — cabeçalhos curl REST e gRPC usando X-API-Key e X-Organization-Id.

Estes exemplos mostram como autenticar. Para as próprias operações, consulte a [referência da API](https://api.kiloiot.io/).

## Pedido REST autenticado

Substitua os marcadores pela sua chave e pelo ID da organização:

```bash
curl -sS https://api.kiloiot.io/api/v2/devices \
  -H "X-API-Key: $KILO_API_KEY" \
  -H "X-Organization-Id: $KILO_ORG_ID"
```

`GET /api/v2/devices` retorna os dispositivos que a chave tem permissão para ver (requer um Devices **Leitura** scope). Utilize os mesmos dois cabeçalhos para outras chamadas; verifique a referência da API para o caminho e o scope que cada uma necessita.

## gRPC

O gRPC usa os mesmos cabeçalhos. Para definições nativas de cliente gRPC, use os materiais fornecidos com o seu pacote on-premise ou de integração.

## Boa prática

* Mantenha a chave numa variável de ambiente ou num cofre de segredos — nunca no histórico do shell nem no controlo de código-fonte.
* Use uma chave dedicada por integração, com apenas os scopes de que necessita.
* Consulte [Autenticação e chaves de API](/kilo-docs-pt/kilo-iot-server/api/authentication-and-api-keys.md) para o guia completo.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.kiloiot.io/kilo-docs-pt/kilo-iot-server/api/examples.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
