---
title: Authentication
description: 'Use one of the following schemes to authenticate to the InfluxDB Cloud API: Token authentication Basic authentication Querystring authentication'
url: https://docs.influxdata.com/influxdb/cloud/api/authentication/
estimated_tokens: 2050
product: InfluxDB Cloud (TSM)
version: cloud
---

[Download InfluxDB Cloud (TSM) API Spec](/openapi/influxdb-cloud-v2-api.yml)

Use one of the following schemes to authenticate to the InfluxDB Cloud API:

-   Token authentication
-   Basic authentication
-   Querystring authentication

## Basic Authentication

### Basic authentication scheme

Use the HTTP Basic authentication scheme for InfluxDB `/api/v2` API operations that support it:

### Syntax

`Authorization: Basic BASE64_ENCODED_CREDENTIALS`

To construct the `BASE64_ENCODED_CREDENTIALS`, combine the username and the password with a colon (`USERNAME:PASSWORD`), and then encode the resulting string in [base64](https://developer.mozilla.org/en-US/docs/Glossary/Base64). Many HTTP clients encode the credentials for you before sending the request.

***Warning**: Base64-encoding can easily be reversed to obtain the original username and password. It is used to keep the data intact and does not provide security. You should always use HTTPS when authenticating or sending a request with sensitive information.*

### Examples

In the examples, replace the following:

-   **`EMAIL_ADDRESS`**: InfluxDB Cloud username (the email address the user signed up with)
-   **`PASSWORD`**: InfluxDB Cloud [API token](/influxdb/cloud/reference/glossary/#token)
-   **`INFLUX_URL`**: your InfluxDB Cloud URL

#### Encode credentials with cURL

The following example shows how to use cURL to send an API request that uses Basic authentication. With the `--user` option, cURL encodes the credentials and passes them in the `Authorization: Basic` header.

```sh
curl --get "INFLUX_URL/api/v2/signin"
    --user "EMAIL_ADDRESS":"PASSWORD"
```

#### Encode credentials with Flux

The Flux [`http.basicAuth()` function](/flux/v0.x/stdlib/http/basicauth/) returns a Base64-encoded basic authentication header using a specified username and password combination.

#### Encode credentials with JavaScript

The following example shows how to use the JavaScript `btoa()` function to create a Base64-encoded string:

```js
btoa('EMAIL_ADDRESS:PASSWORD')
```

The output is the following:

```js
'VVNFUk5BTUU6UEFTU1dPUkQ='
```

Once you have the Base64-encoded credentials, you can pass them in the `Authorization` header–for example:

```sh
curl --get "INFLUX_URL/api/v2/signin"
    --header "Authorization: Basic VVNFUk5BTUU6UEFTU1dPUkQ="
```

To learn more about HTTP authentication, see [Mozilla Developer Network (MDN) Web Docs, HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).\_

## Query String Authentication

Use the query string authentication scheme with InfluxDB v1-compatible API operations. Pass your InfluxDB Cloud email address and API token as query parameters using `u` for username and `p` for password (API token).

### Syntax

`?u=EMAIL_ADDRESS&p=INFLUX_API_TOKEN`

### Example

```sh
curl --get "INFLUX_URL/query" \
    --data-urlencode "u=EMAIL_ADDRESS" \
    --data-urlencode "p=INFLUX_API_TOKEN" \
    --data-urlencode "q=SHOW DATABASES"
```

Replace the following:

-   *`INFLUX_URL`*: your InfluxDB Cloud URL
-   *`EMAIL_ADDRESS`*: your InfluxDB Cloud email address
-   *`INFLUX_API_TOKEN`*: your [InfluxDB API token](/influxdb/cloud/reference/glossary/#token)

Query string authentication exposes your credentials in the URL and server logs. Use [Token authentication](#section/Authentication/TokenAuthentication) for production environments.

## Token Authentication

Use the [Token authentication](#section/Authentication/TokenAuthentication) scheme to authenticate to the InfluxDB API.

In your API requests, send an `Authorization` header. For the header value, provide the word `Token` followed by a space and an InfluxDB API token. The word `Token` is case-sensitive.

### Syntax

`Authorization: Token INFLUX_API_TOKEN`

### Example

#### Use Token authentication with cURL

The following example shows how to use cURL to send an API request that uses Token authentication:

```sh
curl --request GET "INFLUX_URL/api/v2/buckets" \
     --header "Authorization: Token INFLUX_API_TOKEN"
```

Replace the following:

-   *`INFLUX_URL`*: your InfluxDB Cloud URL
-   *`INFLUX_API_TOKEN`*: your [InfluxDB API token](/influxdb/cloud/reference/glossary/#token)

### Related endpoints

-   [`/authorizations` endpoints](#tag/Authorizations-\(API-tokens\))

### Related guides

-   [Authorize API requests](/influxdb/cloud/api-guide/api_intro/#authentication)
-   [Manage API tokens](/influxdb/cloud/security/tokens/)
