Delete a vehicle
Deletes one of your vehicles.
Presets are read-only. Free: no credits are charged.
Authentication
Path parameters
idstringrequiredA preset id or one of your vehicles (veh_…).
Example request
curl -X DELETE "https://runner.cargoduo.com/v1/vehicles/veh_118" \
-H "Authorization: Bearer $CARGODUO_API_KEY"const res = await fetch("https://runner.cargoduo.com/v1/vehicles/veh_118", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.CARGODUO_API_KEY}`,
},
});
const data = await res.json();
console.log(res.status, data);import os
import requests
response = requests.delete(
"https://runner.cargoduo.com/v1/vehicles/veh_118",
headers={"Authorization": f"Bearer {os.environ['CARGODUO_API_KEY']}"},
)
print(response.status_code, response.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("DELETE", "https://runner.cargoduo.com/v1/vehicles/veh_118", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("CARGODUO_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(out))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://runner.cargoduo.com/v1/vehicles/veh_118"))
.header("Authorization", "Bearer " + System.getenv("CARGODUO_API_KEY"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("CARGODUO_API_KEY"));
var request = new HttpRequestMessage(HttpMethod.Delete, "https://runner.cargoduo.com/v1/vehicles/veh_118");
var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");<?php
$ch = curl_init('https://runner.cargoduo.com/v1/vehicles/veh_118');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CARGODUO_API_KEY'),
],
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), ' ', $response, PHP_EOL;require "net/http"
require "uri"
uri = URI("https://runner.cargoduo.com/v1/vehicles/veh_118")
request = Net::HTTP::Delete.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("CARGODUO_API_KEY")}"
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts response.code, response.bodyExample response
{
"id": "veh_118",
"object": "vehicle",
"deleted": true
}Responses
200OKDeleted.
NameTypeRequiredDescriptionidstringstringNoobjectstringstringNovehicletemplateprojectdeletedbooleanbooleanNoAlways
true.401Unauthorized
unauthorizedkey_revokedkey_expiredunauthorizedMissing, malformed or unknown API key.key_revokedThe key was revoked.key_expiredThe key passed its expiry date.
All error codesNameTypeRequiredDescriptionerrorErrorBodyrequiredErrorBodyYescodestringrequiredstringYesMachine code (snake_case). Branch on this, never on
message.messagestringrequiredstringYesEnglish explanation.
request_idstringrequiredstringYesSame as the X-Request-Id header. Quote it when contacting support.
detailsErrorDetail[]ErrorDetail[]NoPer-field problems (
validation_failed).pathstringstringNoJSON path of the offending field, e.g. items[3].length.
codestringstringNorequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringNoEnglish explanation.
403Forbidden
preset_read_onlyip_not_allowedsubscription_inactiveaccount_inactivescope_missingpreset_read_onlyPresets cannot be changed or deleted.ip_not_allowedThe calling IP is not on the key's allowlist.subscription_inactiveThe organization has no active subscription that includes the API.account_inactiveThe organization is suspended, or has no owner whose account is active.scope_missingThe key lacks a scope this endpoint needs.
All error codesNameTypeRequiredDescriptionerrorErrorBodyrequiredErrorBodyYescodestringrequiredstringYesMachine code (snake_case). Branch on this, never on
message.messagestringrequiredstringYesEnglish explanation.
request_idstringrequiredstringYesSame as the X-Request-Id header. Quote it when contacting support.
detailsErrorDetail[]ErrorDetail[]NoPer-field problems (
validation_failed).pathstringstringNoJSON path of the offending field, e.g. items[3].length.
codestringstringNorequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringNoEnglish explanation.
404Not found
vehicle_not_foundvehicle_not_foundNo vehicle with this id among the presets or your organization's vehicles.
All error codesNameTypeRequiredDescriptionerrorErrorBodyrequiredErrorBodyYescodestringrequiredstringYesMachine code (snake_case). Branch on this, never on
message.messagestringrequiredstringYesEnglish explanation.
request_idstringrequiredstringYesSame as the X-Request-Id header. Quote it when contacting support.
detailsErrorDetail[]ErrorDetail[]NoPer-field problems (
validation_failed).pathstringstringNoJSON path of the offending field, e.g. items[3].length.
codestringstringNorequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringNoEnglish explanation.
429Too many requests
rate_limitedrate_limitedToo many requests in the current minute, hour or day (per key or per organization), or more than 60 failed authentications per minute from your IP address.
All error codesNameTypeRequiredDescriptionerrorErrorBodyrequiredErrorBodyYescodestringrequiredstringYesMachine code (snake_case). Branch on this, never on
message.messagestringrequiredstringYesEnglish explanation.
request_idstringrequiredstringYesSame as the X-Request-Id header. Quote it when contacting support.
detailsErrorDetail[]ErrorDetail[]NoPer-field problems (
validation_failed).pathstringstringNoJSON path of the offending field, e.g. items[3].length.
codestringstringNorequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringNoEnglish explanation.
500Internal server error
internal_errorinternal_errorSomething failed on our side.
All error codesNameTypeRequiredDescriptionerrorErrorBodyrequiredErrorBodyYescodestringrequiredstringYesMachine code (snake_case). Branch on this, never on
message.messagestringrequiredstringYesEnglish explanation.
request_idstringrequiredstringYesSame as the X-Request-Id header. Quote it when contacting support.
detailsErrorDetail[]ErrorDetail[]NoPer-field problems (
validation_failed).pathstringstringNoJSON path of the offending field, e.g. items[3].length.
codestringstringNorequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringNoEnglish explanation.
503Service unavailable
api_disabledapi_disabledThe API is temporarily disabled (maintenance) or switched off for the organization.
All error codesNameTypeRequiredDescriptionerrorErrorBodyrequiredErrorBodyYescodestringrequiredstringYesMachine code (snake_case). Branch on this, never on
message.messagestringrequiredstringYesEnglish explanation.
request_idstringrequiredstringYesSame as the X-Request-Id header. Quote it when contacting support.
detailsErrorDetail[]ErrorDetail[]NoPer-field problems (
validation_failed).pathstringstringNoJSON path of the offending field, e.g. items[3].length.
codestringstringNorequired,invalid_value,out_of_range,duplicate_id,unknown_vehicle,unknown_template,type_not_allowed,unknown_group,does_not_fit,too_many_items,too_many_vehicles,unknown_field,invalid_json.messagestringstringNoEnglish explanation.