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

# Eaglecart REST API Authentication: Keys and Scopes

> Learn how to create API keys, attach scopes, and pass credentials in the Authorization header to authenticate every Eaglecart API request.

Eaglecart authenticates API requests using API keys passed in the `Authorization` header. Every request you make must include a valid API key — requests without credentials are rejected with `401 Unauthorized`. Keys are scoped, so each one only grants access to the resources you explicitly allow.

## Getting an API Key

Generate your API key from the Eaglecart admin dashboard. Keep the key you generate safe — you won't be able to view it again after creation.

**1. Log in to your admin dashboard**

Navigate to [https://admin.eaglecart.com](https://admin.eaglecart.com) and sign in with your store owner or staff account.

**2. Open API Keys settings**

Go to **Settings → Developer → API Keys** in the left navigation panel.

**3. Create a new API key**

Click **Create API Key** to open the key creation form.

**4. Give the key a descriptive name**

Enter a name that identifies what this key is used for, such as `My Integration` or `Order Sync — Fulfillment Provider`. This name appears in the audit log so you can trace activity back to the right key.

**5. Select scopes**

Choose only the permissions your integration needs. Available scopes include:

`read:orders`, `write:orders`, `read:products`, `write:products`, `read:customers`, `read:inventory`, `write:inventory`

**6. Copy your key immediately**

After you click **Create**, your key is displayed once. Copy it to a secure location such as a secrets manager or environment variable store. Eaglecart does not store the raw key and cannot show it to you again.

## Using Your API Key

Pass your API key in the `Authorization` header as a Bearer token on every request. Do not include it as a query parameter — header-based authentication is the only supported method.

```bash cURL theme={null}
curl https://api.eaglecart.com/v1/orders \
  -H "Authorization: Bearer ec_live_xxxxxxxxxxxx"
```

```javascript JavaScript theme={null}
const response = await fetch('https://api.eaglecart.com/v1/orders', {
  headers: {
    'Authorization': 'Bearer ec_live_xxxxxxxxxxxx',
    'Content-Type': 'application/json'
  }
});

const data = await response.json();
console.log(data);
```

> [!WARNING]
>
> Never expose your API key in client-side code, public repositories, or browser-accessible JavaScript bundles. Anyone who obtains your key can make authenticated requests on behalf of your store. Rotate a compromised key immediately from **Settings → Developer → API Keys**.

## API Key Scopes

Scopes control which resources and actions your API key can access. Assign only the scopes your integration requires — this limits the blast radius if a key is ever compromised.

| Scope | Description |
| - | - |
| `read:orders` | List and retrieve order details. |
| `write:orders` | Create orders, update order status, and process refunds. |
| `read:products` | List and retrieve product and variant details. |
| `write:products` | Create, update, and delete products and variants. |
| `read:customers` | List and retrieve customer profiles. |
| `write:customers` | Create and update customer profiles. |
| `read:inventory` | View inventory levels across locations. |
| `write:inventory` | Update inventory quantities and submit stock adjustments. |
| `read:reports` | Access sales, traffic, and performance report data. |

## Authentication Errors

The API returns the following errors when authentication fails:

| Status | Code | Meaning |
| - | - | - |
| `401 Unauthorized` | `missing_api_key` | No `Authorization` header was present on the request. |
| `401 Unauthorized` | `invalid_api_key` | The key provided does not exist or has been revoked. |
| `403 Forbidden` | `insufficient_scope` | The key is valid but does not have the scope required for this action. |

Check your key's configured scopes in the Eaglecart admin if you receive a `403` response.

> [!TIP]
>
> Create a separate API key for each integration rather than sharing a single key across multiple systems. Assign each key only the minimum scopes it needs. If one integration is compromised or decommissioned, you can revoke just that key without disrupting the others.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.