> For the complete documentation index, see [llms.txt](https://alphamoon.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alphamoon.gitbook.io/documentation/api/authenticating.md).

# Authenticating

Alphamoon Workspace API uses API keys to authenticate requests.

To authorize your API calls, you can choose between two methods: using the API key in the request header or using the API key in Basic Auth. Choose the method that best suits your requirements and follow the instructions below.

### **Using Basic Auth**

API key Basic Auth allows a user agent, such as a web browser, to provide credentials to the server in order to access protected resources.

Here's an **example** of Basic Authentication requests using the Alphamoon Workspace API key:

{% tabs %}
{% tab title="cURL" %}

```bash
curl -u "API_KEY" https://workspace.alphamoon.ai/api/v0.3/processes
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

GET_PROCESSES_URL = 'https://workspace.alphamoon.ai/api/v0.3/processes'

basic = requests.auth.HTTPBasicAuth('user', 'pass')

resp = requests.get(url=GET_PROCESSES_URL, auth=basic)
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note:**

Replace **API\_KEY** in the request above with the value of the [**Your new API key**](/documentation/user-guide-how-tos/generating-new-api-key.md) field.
{% endhint %}

### **Using the API key in the request header**

To include the API key in your API calls using Basic Auth, follow these steps:

* Set the `Authorization` header in your HTTP requests.
* The header value should be in the format: `Basic BASE64_ENCODED_API_KEY`, where `BASE64_ENCODED_API_KEY` is the Base64 encoding of the string `API_KEY`.
* Send your API request to the appropriate endpoint.

\
Take a look at the **example**:

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl -H "Authorization: Basic API_KEY_BASE64_ENCODED" https://workspace.alphamoon.ai/api/v0.3/processes
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import base64

GET_PROCESSES_URL = 'https://workspace.alphamoon.ai/api/v0.3/processes'

api_key = 'user:pass'.encode('ascii')
api_key_base64_encoded = base64.b64encode(api_key).decode('ascii')
headers={"Authorization": f"Basic {api_key_base64_encoded}"}

resp = requests.get(url=GET_PROCESSES_URL, headers=headers)
```

{% endtab %}
{% endtabs %}

To encode the credentials, you can use a tool like base64 in Linux or macOS, or an online Base64 encoding tool.

{% hint style="info" %}
**Note:**

Replace BASE64\_ENCODED\_API\_KEY with the Base64-encoded value of the [**Your new API key**](/documentation/user-guide-how-tos/generating-new-api-key.md) field.
{% endhint %}

#### See next:
