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

# Get Active Domains

> Retrieves all domains with active cart sessions

## Overview

This endpoint retrieves a list of all domain IDs (store identifiers) that have active cart sessions for the current authenticated device. This is useful for understanding which stores the user has active shopping sessions with.

<Note>
  This endpoint returns only domain names, not full cart data. Use [Get Active Carts](/api-reference/session/get-active-carts) to retrieve full cart information.
</Note>

## Authentication

Requires [Device Authentication](/api-reference/authentication/browser-session).

## Request

No request body or query parameters required.

## Response

<ResponseField name="domains" type="array">
  Array of domain IDs (store identifiers) that have active sessions

  Example: `["staging.luma.gift", "demo.luma.gift", "shop.luma.gift"]`
</ResponseField>

## Session Behavior

### Active Domain Criteria

* Domain must have an active cart session
* Cart must contain at least one item
* Session must not be expired

### Use Cases

* Quick check for active shopping sessions
* Pre-flight check before fetching full cart data
* Building domain-specific UI elements
* Analytics and session tracking

## Errors

### Unauthorized

**Status Code:** 401\
**Description:** Invalid or missing device authentication

### Internal Server Error

**Status Code:** 500\
**Description:** Server error occurred while fetching domains

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://api.firmly.work/api/v2/carts/active-domains' \
    -H 'x-firmly-authorization: <your-auth-token>'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.firmly.work/api/v2/carts/active-domains', {
    headers: {
      'x-firmly-authorization': '<your-auth-token>'
    }
  });

  const { domains } = await response.json();
  console.log('Active domains:', domains);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.firmly.work/api/v2/carts/active-domains',
      headers={
          'x-firmly-authorization': '<your-auth-token>'
      }
  )

  data = response.json()
  active_domains = data['domains']
  ```
</CodeGroup>

## Response Examples

### Multiple Active Domains

```json theme={null}
{
  "domains": [
    "staging.luma.gift",
    "demo.luma.gift",
    "shop.luma.gift"
  ]
}
```

### Single Active Domain

```json theme={null}
{
  "domains": [
    "staging.luma.gift"
  ]
}
```

### No Active Domains

```json theme={null}
{
  "domains": []
}
```

## Related Endpoints

* [Get Active Carts](/api-reference/session/get-active-carts) - Get full cart data for active sessions
* [Get Cart](/api-reference/cart-management/get-cart) - Get cart for a specific domain
