Collections
...
Collections API
Collections

Stop Collection

3min
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 get get /collections/collection id/stop in the example below we stop a collection with id=123456 http https //api rainforestapi com/collections/123456/stop?api key=demo$ curl "https //api rainforestapi com/collections/123456/stop?api key=demo"const axios = require('axios'); const params = { api key 'demo' } axios get('https //api rainforestapi com/collections/123456/stop', { params }) then(response => { const apiresponse = response data; console log('collection stopped '); }) catch(error => { console log(error); });import requests params = { 'api key' 'demo' } api result = requests get('https //api rainforestapi com/collections/123456/stop', params) api response = api result json() print "collection stopped "\<?php $querystring = http build query(\[ 'api key' => 'demo', ]); $ch = curl init(sprintf('%s?%s', 'https //api rainforestapi 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; ?> rainforest 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/rainforestapi/collections api/collections/get list collections https //docs trajectdata com/rainforestapi/collections api/collections/list stop all collections https //docs trajectdata com/rainforestapi/collections api/collections/stop all