> 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-es/kilo-iot-server/api/examples.md).

# Ejemplos

Ejemplos de autenticación para la API de Kilo IoT — curl REST y encabezados gRPC usando X-API-Key y X-Organization-Id.

Estos ejemplos muestran cómo autenticarse. Para las operaciones en sí, consulte la [Referencia de la API](https://api.kiloiot.io/).

## Solicitud REST autenticada

Reemplace los marcadores de posición con su clave y su ID de organización:

```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` devuelve los dispositivos que la clave puede ver (requiere un Devices **Lectura** scope). Use los mismos dos encabezados para otras llamadas; consulte la referencia de la API para ver la ruta y el scope que necesita cada una.

## gRPC

gRPC usa los mismos encabezados. Para las definiciones nativas del cliente gRPC, use los materiales proporcionados con su paquete local o de integración.

## Buena práctica

* Guarde la clave en una variable de entorno o en un almacén de secretos — nunca en el historial de la terminal ni en el control de código fuente.
* Use una clave dedicada por integración, con solo los scopes que necesite.
* Consulta [Autenticación y claves de API](/kilo-docs-es/kilo-iot-server/api/authentication-and-api-keys.md) para la guía completa.


---

# 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-es/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.
