> For a complete page index of the Captain API documentation, fetch https://docs.captain.dev/llms.txt?excludeSpec=true

# Get Group Assignment

GET https://acme.captain.dev/v1/indexes/{index}/assignment

Get how this index splits shoppers between copies of it. `{}` when it doesn't.

Reference: https://docs.captain.dev/reference/product-search/indexes/get-group-assignment

## Authentication

- `Authorization` header (bearer token, required) — A write key, issued by Captain. Server side only. Sent as Authorization: Bearer \<key>.

## Request

### Path parameters

- `index` (string, required) — index name

## Response

### 200

assignment

- `index` (string, optional)
- `assignment` (Assignment, optional) — &#x20;or no layers: no routing

## Types

### Assignment

&#x20;or no layers: no routing

- `layers` (list of AssignmentLayersItems, optional)

### AssignmentLayersItems

- `id` (string, required)
- `salt` (string, required)
- `groups` (list of AssignmentLayersItemsGroupsItems, required) — shares in (0, 1], summing to 1

### AssignmentLayersItemsGroupsItems

- `name` (string, required)
- `share` (double, required)
- `index` (string, optional, nullable) — a copy that serves this group; null: the catalog itself (the next layer is tried)

## Examples

**Response**

```json
{
  "index": "products",
  "assignment": {
    "layers": [
      {
        "id": "ranking-test",
        "salt": "2026-10-ranking",
        "groups": [
          {
            "name": "control",
            "share": 0.5,
            "index": null
          },
          {
            "name": "new-ranking",
            "share": 0.5,
            "index": "products-new-ranking"
          }
        ]
      }
    ]
  }
}
```

**SDK Code**

```python Python REST
import json
import requests

BASE_URL = "https://acme.captain.dev"
API_KEY = "your_write_key"
INDEX = "products"

headers = {
    "Authorization": f"Bearer {API_KEY}",
}

response = requests.get(
    f"{BASE_URL}/v1/indexes/{INDEX}/assignment",
    headers=headers,
    timeout=30.0,
)

print(json.dumps(response.json(), indent=2))
```

```typescript TypeScript REST
const BASE_URL = "https://acme.captain.dev";
const API_KEY = "your_write_key";
const index = "products";

const response = await fetch(`${BASE_URL}/v1/indexes/${index}/assignment`, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
  },
});

const result = await response.json();
console.log(JSON.stringify(result, null, 2));
```