# Extensions

## List extensions

`GET /extensions`

```json
{
  "tags": [
    "Extensions"
  ],
  "summary": "List extensions",
  "description": "Returns extensions available to profiles. Use an extension `id` in the `extensions` field of `POST /profiles` or `PATCH /profiles/{id}`.\n\nIcons are omitted because data URLs can be large. `POST /extensions` includes the icon of the added extension.",
  "responses": {
    "200": {
      "description": "Extension list.",
      "content": {
        "application/json": {
          "schema": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Extension"
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```

## Add an extension

`POST /extensions`

```json
{
  "tags": [
    "Extensions"
  ],
  "summary": "Add an extension",
  "description": "Provide either `url` or `path`.\n\n`url` can be a Chrome Web Store page, a 32-character extension ID, or a direct `.crx` or `.zip` URL. `path` can be a local `.crx`, `.zip`, or unpacked folder on the launcher host.\n\nThe extension name, version, description, and icon are read from its `manifest.json`, including `__MSG_*__` placeholders resolved with the default locale.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AddExtensionRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Extension added. The response includes `icon`.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Extension"
          }
        }
      }
    },
    "400": {
      "description": "Neither `url` nor `path` given, the link is not an extension, or the store has no such id.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```

## Remove an extension

`DELETE /extensions/{id}`

```json
{
  "tags": [
    "Extensions"
  ],
  "summary": "Remove an extension",
  "description": "Profiles hold ids, not copies, so any profile naming this extension stops loading it from its next launch. Their stored list is left as it is; re-adding the extension does not restore the binding.",
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Removed.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "deleted": {
                "type": "boolean",
                "example": true
              },
              "id": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}
```
