---
title: Authentication
description: 'Use one of the following schemes to authenticate to the InfluxDB Cloud Serverless API: Token authentication Basic authentication'
url: https://docs.influxdata.com/influxdb3/cloud-serverless/api/authentication/
estimated_tokens: 1608
product: InfluxDB Cloud Serverless
version: cloud-serverless
---

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

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

-   Token authentication
-   Basic 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](/influxdb3/cloud-serverless/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).\_

## Token Authentication

Use the Token authentication 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](/influxdb3/cloud-serverless/reference/glossary/#token)

### Related endpoints

-   `/authorizations` endpoints)

### Related guides

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