---
title: Create Requests
slug: countdownapi/collections-api/requests/create
docTags: 
createdAt: 2024-07-29T12:49:20.014Z
---

# Create Requests

Adding Requests to a Collection is achieved by making an  `HTTP PUT` to the  `/collections/COLLECTION_ID` endpoint (where  `COLLECTION_ID` is the  `id` of the Collection to add Requests to). The body of the request should be a  `JSON` array of  `request` objects (up to 1000 Requests can be added per call). The maximum number of Requests per Collection is 15,000 (or 100 when adding requests with  `include_html=true`  set).

The  `/collections/COLLECTION_ID` endpoint used for adding Requests to a Collection is the same endpoint as used when [Updating a Collection](https://docs.trajectdata.com/countdownapi/collections-api/collections/update), we've just listed them seperately in the Docs for ease of reference.

The [parameters](https://docs.trajectdata.com/countdownapi/ebay-product-data-api/requests/parameters/common) for creating a Request are the same as those used when making a request via the [Ebay Product Data API](https://docs.trajectdata.com/countdownapi/ebay-product-data-api/overview).

:::hint{type="info"}
**Collection Status**
Requests can only be added to a Collection when the Collection is not running. To check whether a Collection is currently running use the [Get Collection](https://docs.trajectdata.com/countdownapi/collections-api/collections/get) endpoint.
:::

:::hint{type="info"}
**Concurrency when Creating Requests**
You should make calls to the Create Request endpoint sequentially, rather than in parallel. Each call can contain up to 1000 Request to add though. If you make too many concurrent calls you will receive an  `HTTP 429`  error.
:::

:::hint{type="info"}
**Using &#x20;**`include_html=true`**&#x20; in Collections**
When adding requests with  `include_html=true`  to a Collection the maximum number of requests per Collection is 100 (rather than 15,000) because including the HTML within the response makes the Collection Result Sets much larger. The limit is in place to ensure Result Set files are of a manageable size. If you have need to run a large number of requests all with  `include_html=true`  then simply split the requests across multiple 100-request Collections.
:::

***

### Example

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

In the example below we add a new Request to a Collection with  `id=123456` :

:::hint{type="info"}
**Custom IDs**
When you add a Request to a Collection Countdown API assigns it an unique  `id`  - you can use this id to track the Request across multiple Result Sets.

Countdown API also lets you specify your own  `custom_id` , in addition to the Countdown API-assigned id, making it easy to use an ID from your app track Requests.
:::

:::CodeblockTabs
```curl
$ curl -X PUT "https://api.countdownapi.com/collections/123456?api_key=demo" \
  -H "Content-Type: application/json" \
  -d "{\"requests\": [{\"type\":\"product\",\"ebay_domain\":\"ebay.com\",\"epid\":\"233599133856\",\"custom_id\":\"MyCustomID_001\"}]}"
```

```nodejs
const axios = require('axios');
const body = { requests: [
{
  "type": "product",
  "ebay_domain": "ebay.com",
  "epid": "233599133856",
  "custom_id": "MyCustomID_001"
}]}

axios.put('https://api.countdownapi.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
import json

body = { 
  "requests": [
  {
  "type": "product",
  "ebay_domain": "ebay.com",
  "epid": "233599133856",
  "custom_id": "MyCustomID_001"
}]}

api_result = requests.put('https://api.countdownapi.com/collections/123456?api_key=demo', json=body)

api_response = api_result.json()

print "Collection Updated: ", json.dumps(api_response)
```

```php
<?php
      
$body = [ "requests" => array([
  "type" => "product",
  "ebay_domain" => "ebay.com",
  "epid" => "233599133856",
  "custom_id" => "MyCustomID_001"
])];

$ch = curl_init('https://api.countdownapi.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, json_encode($body));

$json = curl_exec($ch);
curl_close($ch);

$api_result = json_decode($json, true);

print_r($api_result);

echo "Collection Updated", PHP_EOL;

?>
```
:::

Countdown API responds with the following JSON confirming the Requests have been successfully created. Note the  `requests_total_count` now reflects the count of the Requests the Collection has, including those just added. To List the Requests in the Collection use the [List Requests](https://docs.trajectdata.com/countdownapi/collections-api/requests/list) endpoint:

```json
{
  "request_info": {
    "success": true
  },
  "collection": {
    "id": "123456",
    "created_at": "2020-01-01T00:00:00.000Z",
    "name": "My First Collection",
    "schedule_type": "daily",
    "enabled": true,
    "status": "idle",
    "requests_total_count": 2,
    "requests_page_count": 1,
    "results_count": 0,
    "schedule_hours": [
      9,
      17
    ],
    "notification_email": "john.smith@example.com",
    "notification_as_json": false,
    "notification_as_jsonlines": false,
    "notification_as_csv": false
  }
}
```

***

**Next Steps**
     [Update Request](https://docs.trajectdata.com/countdownapi/collections-api/requests/update)
     [Delete Request](https://docs.trajectdata.com/countdownapi/collections-api/requests/delete)
     [List Requests](https://docs.trajectdata.com/countdownapi/collections-api/requests/list)
