> For the complete documentation index, see [llms.txt](https://docs.liquidcommerce.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liquidcommerce.cloud/authentication-api-integration/get-access-token.md).

# Get Access Token

## Endpoint Details

<mark style="color:green;">`GET`</mark> `/authentication`

{% hint style="info" %}
If you need assistance on obtaining your API key, contact [support](#support)
{% endhint %}

### **Headers**

| Header           | Value              |
| ---------------- | ------------------ |
| Content-Type     | `application/json` |
| X-LIQUID-API-KEY | `<YOUR_API_KEY>`   |

### Response Details

<table><thead><tr><th width="226">Field</th><th width="168">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>statusCode</code></td><td>number</td><td>Internal status code of the response</td></tr><tr><td><code>message</code></td><td>string</td><td>A brief message describing the result of the API call</td></tr><tr><td><code>metadata</code></td><td><a href="#metadata-object">metaDataObject</a></td><td>Contains metadata about the API call</td></tr><tr><td><code>data</code></td><td><a href="#auth-object">authObject</a></td><td>Authentication object</td></tr></tbody></table>

**Metadata Object**

<table><thead><tr><th width="144">Field</th><th width="140">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>languages</code></td><td>Array&#x3C;string></td><td>List of supported languages for the response, e.g. ["en"]</td></tr><tr><td><code>timestamp</code></td><td>string</td><td>Unix timestamp (in milliseconds) when the response was generated</td></tr><tr><td><code>timezone</code></td><td>string</td><td>Timezone used for the response, always "UTC"</td></tr><tr><td><code>requestId</code></td><td>string</td><td>Unique identifier for the API request. Used for debugging and support</td></tr><tr><td><code>path</code></td><td>string</td><td>API path</td></tr><tr><td><code>version</code></td><td>string</td><td>API version used for the request</td></tr></tbody></table>

#### **Auth Object**

<table><thead><tr><th width="226">Field</th><th width="140">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>token</code></td><td>string</td><td>The access token to be used for other API calls</td></tr><tr><td><code>type</code></td><td>string enum</td><td>The type of token, always "ACCESS_TOKEN"</td></tr><tr><td><code>exp</code></td><td>number</td><td>The expiration timestamp of the token (1 day)</td></tr></tbody></table>

### **Sample Request and Response**

```bash
curl --location 'https://api.liquidcommerce.cloud/authentication'
```

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

```json
{
    "statusCode": 200,
    "message": "OK",
    "metadata": {
        "languages": [
            "en"
        ],
        "timestamp": 1731590739955,
        "timezone": "UTC",
        "requestId": "reqid_123abc45def",
        "path": "/api/authentication",
        "version": "1.7.0"
    },
    "data": {
        "token": "<YOUR_ACCESS_TOKEN>",
        "type": "ACCESS_TOKEN",
        "exp": 1731674132795
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "statusCode": 5000,
    "message": "API Key not found",
    "metadata": {
        "languages": [
            "en"
        ],
        "timestamp": 1731592190265,
        "timezone": "UTC",
        "requestId": "reqid_123abc45def",
        "path": "/api/authentication",
        "version": "1.7.0"
    },
    "errors": []
}
```

{% endtab %}
{% endtabs %}

## Using the Access Token

After obtaining the access token, include it in the `Authorization` header on any API calls to LiquidCommerce API Services.

```
Authorization: Bearer <YOUR_ACCESS_TOKEN>
```

### Access Token Refresh

All API endpoints that require authentication now support token refreshing. This is done by including a `refresh` parameter in the request body.

#### Request Body Parameter

<table><thead><tr><th width="220">Parameter</th><th width="109">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>refresh</code></td><td>boolean</td><td>When set to <code>true</code>, a new access token will be generated and returned</td></tr></tbody></table>

#### Response

When `refresh` is set to `true`, the API response will include an `auth` object containing the new access token information.

```json
{
    "auth": {
        "token": "<NEW_ACCESS_TOKEN>",
        "type": "ACCESS_TOKEN",
        "exp": 1722920383204
    },
    // ... other response data
}
```

## Error Handling

The API uses standard HTTP response codes to indicate the success or failure of requests. In case of an error, the response body will contain a JSON object with more details about the error.

## Rate Limiting

The Authentication API is subject to rate limiting to ensure fair usage and maintain performance. If you exceed the rate limit, you'll receive a 429 (Too Many Requests) response.

## Best Practices

* Store the access token securely on the client-side.
* Include the `refresh` parameter when making requests close to the token's expiration time.
* Update the stored access token whenever a new one is received in the `auth` object of a response.
* Implement proper error handling for cases where token refresh fails.

## Support

Our dedicated support team is available to assist you with API integration and usage. For any questions or issues, please contact <solutions@liquidapp.co>.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.liquidcommerce.cloud/authentication-api-integration/get-access-token.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.
