> 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/services/orders-api/authentication.md).

# Authentication

### 2-Legged Authentication Flow

* **Request Access Token:**
  * Send a request to the Authentication endpoint with your credentials
  * Format: `userID:password` (Base64 encoded)
  * Example: `Authorization: Basic dXNlcklEOnBhc3N3b3Jk`
* **Receive Access Token:**
  * Upon successful authentication, the server returns an access token
  * The token has a limited validity period (default: 10 minutes)
* **Use Access Token:**
  * Include the token in the Authorization header for all subsequent API requests
  * Format: `Authorization: Bearer {access_token}`

#### Example Authentication Request

```http
GET order-authentication
Host: staging.api.liquidcommerce.cloud
Authorization: Basic dXNlcklEOnBhc3N3b3Jk
Content-Type: application/json
```

#### Example Authentication Response

```json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "type": "ORDER_API",
  "exp": 1767009669678
}
```

### Token Expiration and Renewal

Access tokens expire after their designated lifetime. When a token expires, you must request a new one using your credentials. Do not store access tokens for extended periods.

### Security Considerations

* Never share your userID and password in client-side code
* Store access tokens securely and transmit only over HTTPS
* Implement token refresh logic to handle expiration during active sessions


---

# 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/services/orders-api/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.
