---
title: Authentication
description: Authenticate each request with an API key, sent as a bearer token in the Authorization header, and make a first call.
mode: wide
---

The Helementa API authenticates every request with an API key, sent as a bearer token in the `Authorization` header:

```http
Authorization: Bearer YOUR_API_KEY
```

:::note
API keys are not issued yet. Until they are, every route that asks for a credential answers `401` with the code `unauthenticated`.
:::

Keep the key on your server: read it from an environment variable, and never ship it in a web page or a mobile app.

## Make a first call

List the sensor types, the kinds of reading a device reports, each with its unit:

```bash
curl https://api.helementa.com/v1/sensor-types \
  -H "Authorization: Bearer $HELEMENTA_API_KEY"
```

The route in full, from the [API reference](/reference):

`GET /v1/sensor-types`

**Responses**

- `200` — Response for status 200
- `401` — Response for status 401
- `403` — Response for status 403
- `422` — Response for status 422

Response example, 200:

```json
{
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "tag": "string",
      "name": "string",
      "unit": "string",
      "description": "string"
    }
  ],
  "next_cursor": "string"
}
```

## When the API refuses the key

- `401 unauthenticated`: the request carries no key, or one the API does not accept.
- `403 forbidden`: the key is valid, but it lacks the permission the route needs.

Both answers are [problem documents](/errors). The API checks the key before it validates the request, so a refused call learns nothing about the route's schema.
