Batches
...
Batches API
Batches
Stop Batch
3min
stop batch batches can be stopped when they are in the queued or running state by making an http get request to the /batches/batch id/stop endpoint (where batch id is the id of the batch) when stopping a batch that is currently queued you will be refunded for the credits allocated for that batch run if the batch has already started running (i e it is in the state running ) then a credit refund will not be issued, but the batch will still be stopped example get get /batches/batch id/stop in the example below we stop a batch with id=123456 http https //api serpwow\ com/live/batches/123456/stop?api key=demo$ curl "https //api serpwow\ com/live/batches/123456/stop?api key=demo"const axios = require('axios'); const params = { api key 'demo' } axios get('https //api serpwow\ com/live/batches/123456/stop', { params }) then(response => { const apiresponse = response data; console log('batch stopped '); }) catch(error => { console log(error); });import requests params = { 'api key' 'demo' } api result = requests get('https //api serpwow\ com/live/batches/123456/stop', params) api response = api result json() print "batch stopped "\<?php $querystring = http build query(\[ 'api key' => 'demo', ]); $ch = curl init(sprintf('%s?%s', 'https //api serpwow\ com/live/batches/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 "batch stopped ", php eol; ?> serpwow responds with a json object confirming that the batch has been stopped, or detailing the error if it has not been possible to stop the batch (i e if the batch is not curently queued or running ) next steps get batches https //docs trajectdata com/serpwow/batches api/batches/get list batches https //docs trajectdata com/serpwow/batches api/batches/list stop all batches https //docs trajectdata com/serpwow/batches api/batches/stop all