# Deploy a Widget

## Deploy a widget

To deploy a widget, send a **POST** request on `/widgets/deployments`.

```json
POST https://api.didomi.io/widgets/deployments?organization_id=YOUR_ORG_ID

{
  "widget_id": "WIDGET_ID"
}
```

Note that if you have added metadata to a [purpose](https://developers.didomi.io/api-and-platform/data-manager/purposes), a [preference](https://developers.didomi.io/data-manager/preferences-library#create-a-preference) or a [preference\_value](https://developers.didomi.io/data-manager/preferences-library#create-a-preference), they will be available in the remote [widget configuration](#get-remote-widget-configuration) in case you are using our [APIs](https://developers.didomi.io/api-and-platform/consents) or [Headless widgets](https://developers.didomi.io/api-and-platform/widgets/privacy-widgets/headless-widgets).

## Get all deployments

To list all deployments, send a **GET** request on `/widgets/deployments`.

```json
GET https://api.didomi.io/widgets/deployments?organization_id=YOUR_ORG_ID

[
  {
    "id": "String",
    "created_at": "Date",
    "updated_at": "Date",
    "organization_id": "String",
    "widget_id": "String",
    "config": {}
    "deployment_id": "String",
  }
]
```

Optional query parameters:

* `$limit`: number of max results to return
* `$skip`: Number of results to skip
* `$sort`: represents sorting options. Accepts date properties to sort (`created_at`, `updated_at`) as keys and -1 or 1 for sort direction as value.
  * `$sort[created_at]=1` or `-1`
  * `$sort[updated_at]=1` or `-1`
* `widget_id`: To filter deployments by widget ID

## Get a deployment

To find a deployment, send a **GET** request on `/widgets/deployments/{id}`.

```json
GET https://api.didomi.io/widgets/deployments/{id}?organization_id=YOUR_ORG_ID

{
  "id": "String",
  "created_at": "Date",
  "updated_at": "Date",
  "organization_id": "String",
  "widget_id": "String",
  "config": {}            
  "deployment_id": "String",
}
```

### Get `remote` widget configuration

A remote widget is a embeddable widget that has been deployed. Although the configuration object is generally used by our SDK to render the widget, you can use the endpoint below to re-build your own widget while relying on Widget engine.

*\** `api_key` *and* `widget_id` *are both accessible in Didomi Console, in the widget edit page.*

```url
https://pmp-sdk.privacy-center.org/configs/{{api_key}}/containers/{{widget_id}}.json
```

This way of fetching widget configuration is the most reliable provided by Didomi.\
Remote widgets configuration is stored in a S3 Standard Bucket which is design for 99.99% availability.
