> ## Documentation Index
> Fetch the complete documentation index at: https://developers.octaviatech.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Authenticate AI CMS requests securely using an API key.

All **Octavia AI CMS** endpoints require authentication using an API key.\
You can generate and manage your keys directly from your [Octavia Dashboard](https://dashboard.octaviatech.app).

Include your key in every API request using the `x-api-key` header:

```http theme={null}
x-api-key: YOUR_API_KEY
```

Any request **without this header** will be rejected with a `401 Unauthorized` response.

***

## Example (JavaScript)

Here’s a simple example using **fetch** to authenticate and retrieve articles:

```javascript theme={null}
const API_URL = "https://api.octaviatech.app/cms/articles/getAll";
const API_KEY = "YOUR_API_KEY";

async function fetchArticles() {
  try {
    const response = await fetch(API_URL, {
      method: "GET",
      headers: {
        "Content-Type": "application/json",
        "x-api-key": API_KEY,
      },
    });

    if (!response.ok) {
      throw new Error(`Request failed with status ${response.status}`);
    }

    const data = await response.json();
    console.log("Articles:", data.data.articles);
  } catch (error) {
    console.error("Error fetching articles:", error.message);
  }
}

fetchArticles();
```

> 💡 Replace `YOUR_API_KEY` with your actual key from the Octavia dashboard.
> Always keep your API keys private and never expose them in client-side code.
