---
title: Update Collection
slug: asindataapi/collections-api/collections/update
docTags: 
createdAt: 2024-08-01T10:34:46.728Z
---

# Update Collection

Collections can be updated by making an `HTTP PUT` to the `/collections/COLLECTION_ID` endpoint (where `COLLECTION_ID` is the `id` of the Collection). The body can be either `x-www-form-urlencoded` parameters or a `JSON` object.

The [parameters](https://docs.trajectdata.com/asindataapi/collections-api/collections/create#parameters)  for updating a Collection are the same as those used when [creating](https://docs.trajectdata.com/asindataapi/collections-api/collections/create) a Collection.

***

### Example

<font color="#faad14">`PUT`</font>  `/collections/COLLECTION_ID`

In the example below we update a Collection with `id=123456` to run weekly, on Monday at 8am:

:::CodeblockTabs
```curl
$ curl -X PUT "https://api.asindataapi.com/collections/123456?api_key=demo" \
  -d schedule_type="weekly" \
  -d schedule_days_of_week="1" \
  -d schedule_hours="8"
```

```nodejs
const axios = require('axios');
const body = {
  schedule_type: 'weekly',
  schedule_days_of_week: '1',
  schedule_hours: '8',
}

axios.put('https://api.asindataapi.com/collections/123456?api_key=demo', body)
  .then(response => {
    const apiResponse = response.data;

    console.log('Collection Updated: ' + JSON.stringify(apiResponse, 0, 2));

  }).catch(error => {
    console.log(error);
  });
```

```python
import requests

body = {
  'schedule_type': 'weekly',
  'schedule_days_of_week': '1',
  'schedule_hours': '8',
}

api_result = requests.put('https://api.asindataapi.com/collections/123456?api_key=demo', json=body)

api_response = api_result.json()

print "Collection Updated: ", json.dumps(api_response)
```

```php
<?php

$body = http_build_query([
  'schedule_type' => 'weekly',
  'schedule_days_of_week' => '1',
  'schedule_hours' => '8',
]);

$ch = curl_init('https://api.asindataapi.com/collections/123456?api_key=demo');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
# the following options are required if you're using an outdated OpenSSL version
# more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 180);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$json = curl_exec($ch);
curl_close($ch);

$api_result = json_decode($json, True);

print_r($api_result);

echo "Collection Updated", PHP_EOL;

?>
```
:::

ASIN Data API responds with a JSON object containing details of the updated Collection.

:::hint{type="info"}
A Collection can only be updated when it is not running. To check whether a Collection is currently running use the [Get Collection](https://docs.trajectdata.com/asindataapi/collections-api/collections/get) endpoint.
:::

***

**Next Steps**
     [Start Collection](https://docs.trajectdata.com/asindataapi/collections-api/collections/start)
     [Get Collection](https://docs.trajectdata.com/asindataapi/collections-api/collections/get)
