# Authentication

To initiate use of the API, the first step is to acquire an API Key from Depay. This key uniquely identifies and grants you access to our services. After receiving your API Key, you must then obtain a JWT (JSON Web Token), which is essential for authenticating and authorizing your subsequent interactions with the API. This process ensures that access is both secure and tailored to your specific needs.

## Get access token

<mark style="color:blue;">`GET`</mark> `https://stage.api.payments.depay.us/auth/token`

> Retrieves Bearer Token needed to authenticate throughout the API Endpoints.

#### Headers

| Name                                        | Type   | Description       |
| ------------------------------------------- | ------ | ----------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | \<YOUR\_API\_KEY> |

{% tabs %}
{% tab title="200: OK Successful operation" %}

```json
{
    "expiresIn": "3600",
    "accessToken": "<ACCESS_TOKEN>",
    "refreshToken": "<REFRESH_TOKEN>"
}
```

{% endtab %}

{% tab title="403: Forbidden Invalid API-Key supplied" %}

```json
{
    "statusCode": 403,
    "message": "Forbidden resource"
}
```

{% endtab %}
{% endtabs %}

Once obtained your `accessToken` you should use it to authenticate  subsequent requests across all API endpoints. In order to do so, it should be included in the Authorization header of each request.

For example:

<pre class="language-http"><code class="lang-http">GET https://stage.api.payments.depay.us/payins/orders/{uuid}
<strong>Host: https://stage.api.payments.depay.us
</strong>Authorization: Bearer &#x3C;ACCESS_TOKEN>
</code></pre>


---

# 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://docs.latam-payments.depay.us/reference/api-reference/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.
