# extensions.set_active

`POST /api/public/v1/extensions/{id}/active`

Choose which approved version profiles load (roll back or forward); takes effect at each profile's next start.

- Capability: `extension.manage`
- Command: yes — send a `command_id`; resending the same id and body returns the stored receipt
- MCP tool: `extensions_set_active`

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes | Extension id |
| `command_id` | body | string (uuid) | yes | Client-generated UUID for this command. Send the same id (and body) again to get the stored receipt instead of a second change; a different body under the same id is CONFLICT. |
| `version_id` | body | string (uuid) | yes | An approved version of this extension |

## Response

`201` with `{ data, replayed: false, correlation_id }` the first time; `200` with `replayed: true` for a repeated `command_id`.

| Field | Type | Always present | Description |
|---|---|---|---|
| `data` | object | yes |  |
| `data.package` | object | yes |  |
| `data.package.id` | string (uuid) | yes |  |
| `data.package.name` | string | yes |  |
| `data.package.source` | "store" \| "upload" | yes |  |
| `data.package.store_id` | string | no |  |
| `data.package.chrome_id` | string | yes | The extension ID every machine loads it under |
| `data.package.key_generated` | boolean | yes | Browlix created the key of an uploaded extension without one, so its ID stays the same everywhere |
| `data.package.state` | "approved" \| "update_pending" \| "unreviewed" \| "rejected" \| "disabled" | yes |  |
| `data.package.revision` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.package.active_version` | object | no | The version profiles load |
| `data.package.active_version.id` | string (uuid) | yes |  |
| `data.package.active_version.version` | string | yes |  |
| `data.package.active_version.name` | string | yes |  |
| `data.package.active_version.manifest_version` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.package.active_version.sha256` | string | yes | SHA-256 of the stored file; machines check it before loading |
| `data.package.active_version.size_bytes` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.package.active_version.format` | "crx3" \| "zip" | yes |  |
| `data.package.active_version.signature` | "verified" \| "unsigned" | yes | verified: every CRX3 proof checked by the server; unsigned: a plain ZIP |
| `data.package.active_version.store_signed` | boolean | yes | Also signed by the Chrome Web Store |
| `data.package.active_version.permissions` | array<string> | yes |  |
| `data.package.active_version.host_permissions` | array<string> | yes | Sites it can read and change (host permissions and content-script matches) |
| `data.package.active_version.optional_permissions` | array<string> | yes |  |
| `data.package.active_version.license` | string | no | Licence found in the package (SPDX id, or custom); absent when the package has no licence file |
| `data.package.active_version.same_version_changed` | boolean | yes | A different file under a version number already in the library |
| `data.package.active_version.state` | "unreviewed" \| "approved" \| "rejected" | yes |  |
| `data.package.active_version.added_permissions` | array<string> | no | Permissions beyond the version profiles load now (what an approval must acknowledge) |
| `data.package.active_version.removed_permissions` | array<string> | no |  |
| `data.package.active_version.created_at` | string (date-time) | yes |  |
| `data.package.active_version.reviewed_at` | string (date-time) | no |  |
| `data.package.pending_version` | object | no | The newest version waiting for review |
| `data.package.pending_version.id` | string (uuid) | yes |  |
| `data.package.pending_version.version` | string | yes |  |
| `data.package.pending_version.name` | string | yes |  |
| `data.package.pending_version.manifest_version` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.package.pending_version.sha256` | string | yes | SHA-256 of the stored file; machines check it before loading |
| `data.package.pending_version.size_bytes` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.package.pending_version.format` | "crx3" \| "zip" | yes |  |
| `data.package.pending_version.signature` | "verified" \| "unsigned" | yes | verified: every CRX3 proof checked by the server; unsigned: a plain ZIP |
| `data.package.pending_version.store_signed` | boolean | yes | Also signed by the Chrome Web Store |
| `data.package.pending_version.permissions` | array<string> | yes |  |
| `data.package.pending_version.host_permissions` | array<string> | yes | Sites it can read and change (host permissions and content-script matches) |
| `data.package.pending_version.optional_permissions` | array<string> | yes |  |
| `data.package.pending_version.license` | string | no | Licence found in the package (SPDX id, or custom); absent when the package has no licence file |
| `data.package.pending_version.same_version_changed` | boolean | yes | A different file under a version number already in the library |
| `data.package.pending_version.state` | "unreviewed" \| "approved" \| "rejected" | yes |  |
| `data.package.pending_version.added_permissions` | array<string> | no | Permissions beyond the version profiles load now (what an approval must acknowledge) |
| `data.package.pending_version.removed_permissions` | array<string> | no |  |
| `data.package.pending_version.created_at` | string (date-time) | yes |  |
| `data.package.pending_version.reviewed_at` | string (date-time) | no |  |
| `data.package.versions_count` | integer | yes | (min -9007199254740991, max 9007199254740991) |
| `data.package.assignments` | array<object> | yes |  |
| `data.package.assignments[].id` | string (uuid) | yes |  |
| `data.package.assignments[].target_kind` | "workspace" \| "group" \| "profile" | yes |  |
| `data.package.assignments[].group_id` | string (uuid) | no |  |
| `data.package.assignments[].profile_id` | string (uuid) | no |  |
| `data.package.assignments[].target_name` | string | no |  |
| `data.package.assignments[].hidden` | boolean | no | The group or profile is outside your group scope: it is not named |
| `data.package.assignments[].required` | boolean | yes |  |
| `data.package.profiles_reached` | integer | yes | Active profiles at least one assignment reaches (min -9007199254740991, max 9007199254740991) |
| `data.package.created_at` | string (date-time) | yes |  |
| `data.package.updated_at` | string (date-time) | yes |  |
| `correlation_id` | string (uuid) | yes |  |
| `replayed` | boolean | no | true when this command_id was already applied and the stored receipt came back |

New fields can appear at any time; ignore the ones you do not know.

## Errors

| Code | HTTP | Retryable |
|---|---|---|
| `UNAUTHENTICATED` | 401 | no |
| `FORBIDDEN` | 403 | no |
| `RATE_LIMITED` | 429 | yes |
| `VALIDATION_FAILED` | 422 | no |
| `NOT_FOUND` | 404 | no |
| `CONFLICT` | 409 | no |
| `OUTCOME_UNKNOWN` | 202 | yes |
| `DEPENDENCY_UNAVAILABLE` | 503 | yes |
| `UNKNOWN` | 500 | no |

## Example (curl)

```bash
curl -X POST "https://browlix.com/api/public/v1/extensions/<id>/active" \
  -H "Authorization: Bearer $BROWLIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command_id":"<uuid>","version_id":"<version_id>"}'
```

## Example (TypeScript SDK)

```ts
import { Browlix } from "@browlix/sdk";

const bx = new Browlix({ apiKey: process.env.BROWLIX_API_KEY! });
const reply = await bx.call("extensions.set_active", { path: { id: "<id>" }, body: {"version_id":"<version_id>"} });
console.log(reply.data);
```

## Example (Python)

```python
import os, uuid
import requests

r = requests.post(
    "https://browlix.com/api/public/v1/extensions/<id>/active",
    headers={"Authorization": f"Bearer {os.environ['BROWLIX_API_KEY']}"},
    json={"command_id":str(uuid.uuid4()),"version_id":"<version_id>"},
    timeout=60,
)
print(r.status_code, r.json())
```

## Example (MCP)

```json
{
  "method": "tools/call",
  "params": {
    "name": "extensions_set_active",
    "arguments": {
      "id": "<id>",
      "version_id": "<version_id>"
    }
  }
}
```
