Requires Authentication via 'x-api-key' header.
Returns the latest carrier snapshot record available, data is current with safer.fmcsa.dot.gov
curl --request GET \
--url /v2/usdot/snapshot/:USDotNumber \
--header 'x-api-key: YourApiKey'
Source on Github
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: YourApiKey");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
Source on Github
var client = new RestClient("https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "YourApiKey");
IRestResponse response = client.Execute(request);
Source on Github
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "YourApiKey")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Source on Github
HttpResponse response = Unirest.get("https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber")
.header("x-api-key", "YourApiKey")
.asString();
Source on Github
var axios = require("axios").default;
var options = {
method: 'GET',
url: 'https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber',
headers: {'x-api-key': 'YourApiKey'}
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
Source on Github
#import
NSDictionary *headers = @{ @"x-api-key": @"YourApiKey" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
Source on Github
"https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: YourApiKey"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Source on Github
import requests
url = "https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber"
headers = {"x-api-key": "YourApiKey"}
response = requests.request("GET", url, headers=headers)
print(response.text)
Source on Github
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url)
request["x-api-key"] = 'YourApiKey'
response = http.request(request)
puts response.read_body
Source on Github
import Foundation
let headers = ["x-api-key": "YourApiKey"]
let request = NSMutableURLRequest(url: NSURL(string: "https://saferwebapi.com/v2/usdot/snapshot/:USDotNumber")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Source on Github
/v2/usdot/snapshot/:USDotNumber
{
"entity_type": "CARRIER",
"legal_name": "GLEN DYER",
"dba_name": "DYERS TRUCKING SERVICE",
"physical_address": "1000 SOUTH LAWRENCE ST MOBILE, AL 36603",
"phone": "(334) 433-4999",
"mailing_address": "P O BOX 2504 MOBILE, AL 36652",
"usdot": "44",
"state_carrier_id": "",
"mc_mx_ff_numbers": "MC-146894",
"duns_number": null,
"power_units": 3,
"drivers": 3,
"mcs_150_form_date": "04/04/2006",
"mcs_150_mileage_year": {
"mileage": null,
"year": null
},
"out_of_service_date": null,
"operating_status": "NOT AUTHORIZED",
"operation_classification": ["Auth. For Hire", "TRASH RUBB"],
"carrier_operation": ["Intrastate Only (Non-HM)"],
"cargo_carried": ["General Freight", "Garbage/Refuse"],
"united_states_inspections": {
"vehicle": {
"inspections": "0",
"out_of_service": "0",
"out_of_service_percent": "0%",
"national_average": "20.87%"
},
"driver": {
"inspections": "0",
"out_of_service": "0",
"out_of_service_percent": "0%",
"national_average": "5.51%"
},
"hazmat": {
"inspections": "0",
"out_of_service": "0",
"out_of_service_percent": "0%",
"national_average": "4.44%"
},
"iep": {
"inspections": "0",
"out_of_service": "0",
"out_of_service_percent": "0%",
"national_average": "N/A"
}
},
"united_states_crashes": {
"tow": 0,
"fatal": 0,
"injury": 0,
"total": 0
},
"canada_inspections": {
"driver": {
"out_of_service": 0,
"out_of_service_percent": "0%",
"inspections": 0
},
"vehicle": {
"out_of_service": 0,
"out_of_service_percent": "0%",
"inspections": 0
}
},
"canada_crashes": {
"tow": 0,
"fatal": 0,
"injury": 0,
"total": 0
},
"safety_rating_date": null,
"safety_review_date": null,
"safety_rating": null,
"safety_type": null,
"latest_update": "09/24/2021",
"us_inspections": {
"driver": {
"out_of_service": 0,
"out_of_service_percent": "0%",
"national_average": "5.51%",
"inspections": 0
},
"vehicle": {
"out_of_service": 0,
"out_of_service_percent": "0%",
"national_average": "20.87%",
"inspections": 0
},
"hazmat": {
"out_of_service": 0,
"out_of_service_percent": "0%",
"national_average": "4.44%",
"inspections": 0
},
"iep": {
"out_of_service": 0,
"out_of_service_percent": "0%",
"national_average": "N/A",
"inspections": 0
}
},
"url": "http://safer.fmcsa.dot.gov/query.asp?searchtype=ANY&query_type=queryCarrierSnapshot&query_param=USDOT&original_query_param=NAME&query_string=44"
}