# Authentication

Authenticating with Couchdrops API requires a username and password and on success returns a new authentication token. This token can then we be used in subsequent API requests. Tokens generated using this route only exist for a short period of time and should not be used for long term API access.&#x20;

For long term access, create and administrative token in Couchdrop's administration interface.&#x20;

API tokens inherit the permissions of the authenticating user.&#x20;

## Authenticate with username and password

<mark style="color:green;">`POST`</mark> `https://api.couchdrop.io/authenticate`

Authenticate with a POST request

#### Request Body

| Name                                       | Type   | Description                             |
| ------------------------------------------ | ------ | --------------------------------------- |
| username<mark style="color:red;">\*</mark> | String | Username                                |
| password<mark style="color:red;">\*</mark> | String | Password                                |
| system                                     | String | An optional field describing the source |

{% tabs %}
{% tab title="200: OK Authentication succeeded" %}

```javascript
{
    "token":"<API auth token>"
}
```

{% endtab %}

{% tab title="403: Forbidden Access Denied" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized 2FA required" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.couchdrop.io/domains-and-accounts/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
