Depots
Bulk delete depots
DELETE /dn/depots removes multiple depots at once by submitting a list of depot names.
DELETE
/
dn
/
depots
Bulk delete depots
curl --request DELETE \
--url https://app.detrack.com/api/v2/dn/depots \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"data": [
{
"name": "Depot 1"
}
]
}
'import requests
url = "https://app.detrack.com/api/v2/dn/depots"
payload = { "data": [{ "name": "Depot 1" }] }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({data: [{name: 'Depot 1'}]})
};
fetch('https://app.detrack.com/api/v2/dn/depots', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.detrack.com/api/v2/dn/depots",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
[
'name' => 'Depot 1'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.detrack.com/api/v2/dn/depots"
payload := strings.NewReader("{\n \"data\": [\n {\n \"name\": \"Depot 1\"\n }\n ]\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://app.detrack.com/api/v2/dn/depots")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"name\": \"Depot 1\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.detrack.com/api/v2/dn/depots")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {\n \"name\": \"Depot 1\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"name": "Depot 1",
"deleted": true
}
]
}{
"code": "invalid_json_format"
}{
"code": "invalid_key",
"message": "Invalid key"
}{
"code": "forbidden"
}{
"code": "deletion_failed",
"message": "Deletion failed",
"errors": [
{
"name": "Depot 1",
"deleted": true
}
],
"data": {
"data": [
{
"name": "Depot 1",
"deleted": true
}
]
}
}Remove several depots in a single call by providing an array of depot names. The response confirms which depots were successfully deleted. This is useful when cleaning up unused depots or syncing removals from an external system.
Authorizations
Body
application/json
Bulk delete depots
curl --request DELETE \
--url https://app.detrack.com/api/v2/dn/depots \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"data": [
{
"name": "Depot 1"
}
]
}
'import requests
url = "https://app.detrack.com/api/v2/dn/depots"
payload = { "data": [{ "name": "Depot 1" }] }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({data: [{name: 'Depot 1'}]})
};
fetch('https://app.detrack.com/api/v2/dn/depots', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.detrack.com/api/v2/dn/depots",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
[
'name' => 'Depot 1'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.detrack.com/api/v2/dn/depots"
payload := strings.NewReader("{\n \"data\": [\n {\n \"name\": \"Depot 1\"\n }\n ]\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://app.detrack.com/api/v2/dn/depots")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"name\": \"Depot 1\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.detrack.com/api/v2/dn/depots")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {\n \"name\": \"Depot 1\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"name": "Depot 1",
"deleted": true
}
]
}{
"code": "invalid_json_format"
}{
"code": "invalid_key",
"message": "Invalid key"
}{
"code": "forbidden"
}{
"code": "deletion_failed",
"message": "Deletion failed",
"errors": [
{
"name": "Depot 1",
"deleted": true
}
],
"data": {
"data": [
{
"name": "Depot 1",
"deleted": true
}
]
}
}