[Yandex Cloud documentation](../../index.md) > [Monium](../index.md) > API reference > API authentication

# Authentication with the Yandex Cloud API

To work via the API, you can use an [IAM token](../../iam/concepts/authorization/iam-token.md) or an [API key](../../iam/concepts/authorization/api-key.md). You can use any of these authentication methods to work with [Prometheus](../../monitoring/operations/prometheus/index.md).

## IAM token {#iam-token}

An _IAM token_ is a unique sequence of characters issued to the user following authentication.

How to get an IAM token:

* [Guide](../../iam/operations/iam-token/create.md) for Yandex accounts.
* [Guide](../../iam/operations/iam-token/create-for-sa.md) for a service account.
* [Guide](../../iam/operations/iam-token/create-for-federation.md) for a federated account.
* [Guide](../../iam/operations/iam-token/create-for-local.md) for a local account.

Specify the received IAM token when accessing Yandex Cloud resources via the API. Provide the IAM token in the `Authorization` header in the following format:

```yaml
Authorization: Bearer <IAM_token>
```

If you have saved your IAM token to a variable, use the latter:

```yaml
Authorization: Bearer ${IAM_TOKEN}
```

## API key {#api-key}

The _API key_ is a secret key only used for simplified authorization of [service accounts](../../iam/concepts/users/service-accounts.md) with the Yandex Cloud API.

[Guide](../../iam/operations/authentication/manage-api-keys.md) to obtaining an API key for service accounts.

Use the API key you obtained when accessing Yandex Cloud resources via the API. Include the API key in the `Authorization` header, formatted as follows:

```yaml
Authorization: Api-Key <API_key>
```

If you have saved the API key to a variable, use the latter:

```yaml
Authorization: Api-Key ${API_KEY}
```

{% note info %}

To perform writes to a log group, set the `yc.logging.write` [scope](../../iam/concepts/authorization/api-key.md#scoped-api-keys) for the API key.

{% endnote %}

#### See also {#see-also}

[Accounts in Yandex Cloud](../../iam/concepts/users/accounts.md)