---
title: Stop Collection
slug: countdownapi/collections-api/collections/stop
docTags: 
createdAt: 2024-07-29T12:49:20.014Z
---

# Stop Collection

Collections can be stopped when they are in the  `queued`  or  `running`  state by making an `HTTP GET` request to the `/collections/COLLECTION_ID/stop` endpoint (where `COLLECTION_ID` is the `id` of the Collection).

When stopping a Collection that is currently  `queued`  you will be refunded for the credits allocated for that Collection run. If the Collection has already started running (i.e. it is in the state  `running` ) then a credit refund will not be issued, but the Collection will still be stopped.

***

### Example

****<font color="#52c41a">`GET`</font>  `/collections/COLLECTION_ID/stop`

In the example below we stop a Collection with `id=123456` :

:::CodeblockTabs
HTTP

```HTTP
https://api.countdownapi.com/collections/123456/stop?api_key=demo
```

```curl
$ curl "https://api.countdownapi.com/collections/123456/stop?api_key=demo"
```

```nodejs
const axios = require('axios');
const params = {
  api_key: 'demo'
}

axios.get('https://api.countdownapi.com/collections/123456/stop', { params })
  .then(response => {
    const apiResponse = response.data;

    console.log('Collection stopped.');

  }).catch(error => {
    console.log(error);
  });
```

```python
import requests

params = {
  'api_key': 'demo'
}

api_result = requests.get('https://api.countdownapi.com/collections/123456/stop', params)

api_response = api_result.json()

print "Collection stopped."
```

```php
<?php
      
$queryString = http_build_query([
  'api_key' => 'demo',
]);

$ch = curl_init(sprintf('%s?%s', 'https://api.countdownapi.com/collections/123456/stop', $queryString));
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);

$json = curl_exec($ch);
curl_close($ch);

$api_result = json_decode($json, true);

print_r($api_result);

echo "Collection stopped.", PHP_EOL;

?>
```
:::

Countdown API responds with a JSON object confirming that the Collection has been stopped, or detailing the error if it has not been possible to stop the Collection (i.e. if the Collection is not curently  `queued`  or  `running` ).

***

**Next Steps**
     [Get Collections](https://docs.trajectdata.com/countdownapi/collections-api/collections/get)
     [List Collections](https://docs.trajectdata.com/countdownapi/collections-api/collections/list)
     [Stop All Collections](https://docs.trajectdata.com/countdownapi/collections-api/collections/stop-all)
