# DOT carrier

> POST /dot/carrier looks up a motor carrier by USDOT or MC number in FMCSA data: registration status, operating authority, fleet, cargo and safety rating.

`POST https://api.qelka.com/v1/dot/carrier`

Look up a US motor carrier, broker or freight forwarder in the open data of the Federal Motor Carrier Safety Administration (FMCSA): its legal name, the status of its USDOT registration, each operating authority and its status, its fleet and drivers, the cargo it declares, its safety rating and the date of its last registration update. Each lookup costs 1 credit when FMCSA has the registration; numbers that are not registered, errors and test keys are never billed.

## Request

Send the USDOT number, or a docket number: the MC, FF or MX number of an operating authority.

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `dot_number` | string | One of `dot_number` and `mc_number` | none | The USDOT number, up to 8 digits, 1 to 20 characters as sent. A `USDOT`, `US DOT` or `DOT` prefix, `#`, `No.`, spaces and hyphens are ignored. |
| `mc_number` | string | One of `dot_number` and `mc_number` | none | A docket number: `MC`, `FF` or `MX` followed by up to 8 digits, 1 to 20 characters as sent. Digits alone are read as an MC number. |
| `fresh` | boolean | No | `false` | `true` skips the 24-hour result cache and reads the FMCSA data again. |

Send exactly one of `dot_number` and `mc_number`: a body with both, or with neither, is a `400 invalid_request`. A number that cannot be a USDOT or docket number, such as letters in `dot_number`, is a `200` with `status: "invalid"`.

A lookup makes up to two rounds of requests to data.transportation.gov, each with a 10-second limit, so every snippet sets a 30-second client timeout.

```bash title="cURL"
curl https://api.qelka.com/v1/dot/carrier \
  --max-time 30 \
  -H "Authorization: Bearer $QELKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"dot_number": "80806"}'
```
```javascript title="Node.js"
const response = await fetch('https://api.qelka.com/v1/dot/carrier', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ dot_number: '80806' }),
  signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
```
```python title="Python"
import os

import requests

api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
    "https://api.qelka.com/v1/dot/carrier",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"dot_number": "80806"},
    timeout=30,
)
result = response.json()
print(result)
```
```php title="PHP"
<?php
$ch = curl_init('https://api.qelka.com/v1/dot/carrier');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('QELKA_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['dot_number' => '80806']),
    CURLOPT_TIMEOUT => 30,
]);
$result = json_decode(curl_exec($ch), true);
print_r($result);
```
```go title="Go"
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"time"
)

func main() {
	payload, _ := json.Marshal(map[string]any{"dot_number": "80806"})
	request, _ := http.NewRequest(http.MethodPost, "https://api.qelka.com/v1/dot/carrier", bytes.NewReader(payload))
	request.Header.Set("Authorization", "Bearer "+os.Getenv("QELKA_API_KEY"))
	request.Header.Set("Content-Type", "application/json")

	client := &http.Client{Timeout: 30 * time.Second}
	response, err := client.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	var result map[string]any
	if err := json.NewDecoder(response.Body).Decode(&result); err != nil {
		panic(err)
	}
	fmt.Println(result)
}
```
```ruby title="Ruby"
require 'json'
require 'net/http'

uri = URI('https://api.qelka.com/v1/dot/carrier')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{ENV.fetch('QELKA_API_KEY')}"
request['Content-Type'] = 'application/json'
request.body = JSON.generate({ dot_number: '80806' })

response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, read_timeout: 30) do |http|
  http.request(request)
end
result = JSON.parse(response.body)
puts result
```

## Response

Every valid request gets a `200`. Read `status` first: only `found` fills the carrier fields.

| Field | Type | Description |
|---|---|---|
| `id` | string | Identifier of this lookup: `lkp_` followed by 26 characters. |
| `object` | string | Always `dot_carrier`. |
| `input` | string | The `dot_number` or `mc_number` you sent, without surrounding spaces. |
| `query` | string | `dot_number` or `mc_number`: the field you sent. |
| `status` | string | `found`, `not_found` or `invalid`. |
| `reason` | string or null | `not_registered` with `not_found`, `invalid_number` with `invalid`, else `null`. |
| `dot_number` | string or null | The USDOT number, without leading zeros. |
| `legal_name` | string or null | The legal name of the company. |
| `dba_name` | string or null | Its trade name, when it filed one. |
| `usdot_status` | string or null | `active`, `inactive` or `pending`: the status of the USDOT registration in the FMCSA Company Census File. |
| `operation` | string or null | `interstate`, `intrastate_hazmat` or `intrastate_non_hazmat`. |
| `classifications` | array of strings | Operation classifications as filed on the MCS-150, such as `AUTHORIZED FOR HIRE` or `PRIVATE PROPERTY`. |
| `dockets` | array of strings | The MC, FF and MX docket numbers tied to the USDOT number, without leading zeros, such as `MC135797`. |
| `authority` | object | The operating authorities: for-hire interstate carriers, brokers and freight forwarders. |
| `authority.status` | string | `active` when at least one authority is active; else `pending` when one is pending; else `inactive` when there is any; `none` when FMCSA lists no authority, as for private and intrastate carriers. |
| `authority.source` | string or null | `motus`: the file of Motus, the new FMCSA registration system. `legacy`: the licensing file of the previous system, read when Motus has no record. `null` with no authority. |
| `authority.entries` | array of objects | One entry per docket and authority type. |
| `authority.entries.docket` | string | The docket number, such as `MC135797`. |
| `authority.entries.type` | string | The authority type as FMCSA publishes it, such as `Motor Carrier of Property (Except Household Goods)` or `Broker of Property (Except Household Goods)`. The legacy file gives `Common carrier`, `Contract carrier` or `Broker`. |
| `authority.entries.status` | string | `active`, `inactive`, `pending` or `withdrawn`. |
| `fleet` | object | `power_units`, `trucks`, `buses`, `drivers` and `cdl_drivers` (drivers with a commercial driver's license), each an integer or null, as declared on the MCS-150. |
| `hazmat` | boolean or null | `true` when the carrier declares hazardous materials. |
| `cargo` | array of strings | Cargo classes declared on the MCS-150: `general_freight`, `household_goods`, `metal`, `motor_vehicles`, `drive_tow_away`, `logs_poles_lumber`, `building_materials`, `mobile_homes`, `machinery_large_objects`, `fresh_produce`, `liquids_gases`, `intermodal_containers`, `passengers`, `oilfield_equipment`, `livestock`, `grain_feed_hay`, `coal_coke`, `meat`, `garbage_refuse`, `us_mail`, `chemicals`, `dry_bulk`, `refrigerated_food`, `beverages`, `paper_products`, `utilities`, `agricultural_farm_supplies`, `construction`, `water_well` or `other`. |
| `safety_rating` | object | The rating of the latest FMCSA compliance review. |
| `safety_rating.rating` | string or null | `satisfactory`, `conditional` or `unsatisfactory`. `null` when the carrier was never rated, which is the case of most carriers. |
| `safety_rating.date`, `safety_rating.review_date` | string or null | Date of the rating and of the review, `YYYY-MM-DD`. |
| `address` | object or null | The physical address: `street`, `city`, `state`, `zip` and `country`, each string or null. |
| `phone` | string or null | The phone number, digits only. |
| `mcs150` | object or null | The latest MCS-150 update: `date` (`YYYY-MM-DD`), `mileage` and `mileage_year`, the miles declared and the year they cover. |
| `added` | string or null | Date the USDOT number was added, `YYYY-MM-DD`. |
| `url` | string or null | The company snapshot on FMCSA SAFER. |
| `credits_used` | integer | Credits debited for this call: 1 when `status` is `found` with a live key, else `0`. |
| `cached` | boolean | `true` when the answer came from the 24-hour cache. |

`cargo` is cut short in this example:

```json title="Response"
{
  "id": "lkp_01M8CEFMEJ7NWSSY5WEY967N6S",
  "object": "dot_carrier",
  "input": "80806",
  "query": "dot_number",
  "status": "found",
  "reason": null,
  "dot_number": "80806",
  "legal_name": "J B HUNT TRANSPORT INC",
  "dba_name": "J B HUNT",
  "usdot_status": "active",
  "operation": "interstate",
  "classifications": ["AUTHORIZED FOR HIRE"],
  "dockets": ["MC135797", "FF51075"],
  "authority": {
    "status": "active",
    "source": "motus",
    "entries": [
      { "docket": "MC135797", "type": "Motor Carrier of Household Goods", "status": "active" },
      { "docket": "MC135797", "type": "Motor Carrier of Property (Except Household Goods)", "status": "active" },
      { "docket": "MC135797", "type": "Broker of Property (Except Household Goods)", "status": "active" },
      { "docket": "MC135797", "type": "Broker of Household Goods", "status": "active" }
    ]
  },
  "fleet": { "power_units": 25280, "trucks": 25280, "buses": 0, "drivers": 24116, "cdl_drivers": 23669 },
  "hazmat": true,
  "cargo": ["general_freight", "metal", "motor_vehicles", "intermodal_containers", "refrigerated_food", "other"],
  "safety_rating": { "rating": "satisfactory", "date": "1992-05-08", "review_date": "1992-01-31" },
  "address": { "street": "615 J B HUNT CORPORATE DRIVE", "city": "LOWELL", "state": "AR", "zip": "72745", "country": "US" },
  "phone": "4798200000",
  "mcs150": { "date": "2025-07-07", "mileage": 1629835251, "mileage_year": 2024 },
  "added": "1974-06-01",
  "url": "https://safer.fmcsa.dot.gov/query.asp?searchtype=ANY&query_type=queryCarrierSnapshot&query_param=USDOT&query_string=80806",
  "credits_used": 1,
  "cached": false
}
```

## Act on the status

| `status` | What it means | What to do | Billed |
|---|---|---|---|
| `found` | FMCSA has a registration for the number. | Check `usdot_status`, then the authority entry that matches the job: a broker needs active broker authority, a for-hire carrier active property authority. | Yes, and cached 24 hours |
| `not_found` | FMCSA has no registration for the number (`reason: "not_registered"`). | Check the number. A docket that was never granted, or a USDOT number that does not exist, is not registered. | No |
| `invalid` | The value cannot be a USDOT number or a docket number (`reason: "invalid_number"`). FMCSA is not asked. | Send digits in `dot_number`, or `MC`, `FF` or `MX` and digits in `mc_number`. | No |

Answers other than `found` are never cached, so the next request reads the FMCSA data again.

## How the lookup works

1. The number is parsed. A USDOT number loses its prefix, spaces and hyphens and its leading zeros, and must have 1 to 8 digits other than all zeros. A docket number loses spaces, `#`, dots and hyphens, keeps its `MC`, `FF` or `MX` prefix (`MC` when there is none) and its digits without leading zeros.
2. Three FMCSA datasets published on data.transportation.gov are read at once: the Company Census File (`az4n-8mr2`) for the registration, and for the authorities the Motus file (`inys-ebih`) and the licensing file of the previous system (`6eyk-hxee`), where dockets are written with 6 digits and USDOT numbers with 8.
3. For a docket, the Company Census File is searched by the first docket of each carrier. When that finds nothing, the USDOT number the authority records give is used to read the carrier, so a docket listed second or third is still found.
4. Authority entries come from Motus. When Motus has none for the carrier, they come from the legacy file, where each docket has a common carrier, a contract carrier and a broker authority, each active, pending or inactive.

The data is what FMCSA publishes: fleet, drivers, cargo and mileage are what the carrier declared on its last MCS-150, so an old `mcs150.date` means old figures. Insurance filings, inspections, crashes and safety scores are not in these datasets and are not returned: read them on SAFER through `url`.

## Examples

### Look up a docket with a test key

Test keys return a sample carrier without reading the FMCSA data: the number `9999999`, as a USDOT or a docket number, returns `not_found`, and any other valid number returns the sample below. With a test key in `QELKA_API_KEY`, this request returns:

```bash title="cURL"
curl https://api.qelka.com/v1/dot/carrier \
  --max-time 30 \
  -H "Authorization: Bearer $QELKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mc_number": "MC-900001"}'
```
```javascript title="Node.js"
const response = await fetch('https://api.qelka.com/v1/dot/carrier', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ mc_number: 'MC-900001' }),
  signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
```
```python title="Python"
import os

import requests

api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
    "https://api.qelka.com/v1/dot/carrier",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"mc_number": "MC-900001"},
    timeout=30,
)
result = response.json()
print(result)
```

```json title="Response"
{
  "id": "lkp_01M8CG3H4PXK7W2ZQ9RDN5TB6C",
  "object": "dot_carrier",
  "input": "MC-900001",
  "query": "mc_number",
  "status": "found",
  "reason": null,
  "dot_number": "1000001",
  "legal_name": "ACME WIDGETS TRUCKING LLC",
  "dba_name": "ACME FREIGHT",
  "usdot_status": "active",
  "operation": "interstate",
  "classifications": ["AUTHORIZED FOR HIRE"],
  "dockets": ["MC900001"],
  "authority": {
    "status": "active",
    "source": "motus",
    "entries": [
      { "docket": "MC900001", "type": "Motor Carrier of Property (Except Household Goods)", "status": "active" }
    ]
  },
  "fleet": { "power_units": 12, "trucks": 12, "buses": 0, "drivers": 14, "cdl_drivers": 14 },
  "hazmat": false,
  "cargo": ["general_freight", "refrigerated_food"],
  "safety_rating": { "rating": "satisfactory", "date": "2024-01-15", "review_date": "2023-12-01" },
  "address": { "street": "1 TEST WAY", "city": "SPRINGFIELD", "state": "IL", "zip": "62701", "country": "US" },
  "phone": "2175550100",
  "mcs150": { "date": "2026-03-01", "mileage": 1250000, "mileage_year": 2025 },
  "added": "2015-06-10",
  "url": "https://safer.fmcsa.dot.gov/query.asp?searchtype=ANY&query_type=queryCarrierSnapshot&query_param=USDOT&query_string=1000001",
  "credits_used": 0,
  "cached": false
}
```

## Errors

| Status | Type | When |
|---|---|---|
| 400 | [invalid_request](https://qelka.com/docs/errors#invalid_request) | Both or neither of `dot_number` and `mc_number`, one of them empty or longer than 20 characters, a body that is not a JSON object, or a field the request table does not list |
| 401 | [invalid_api_key](https://qelka.com/docs/errors#invalid_api_key) | The key is missing, unknown or revoked |
| 402 | [insufficient_credits](https://qelka.com/docs/errors#insufficient_credits) | Your balance is less than 1 credit (live keys only) |
| 403 | [forbidden](https://qelka.com/docs/errors#forbidden) | The key is restricted to other endpoints |
| 405 | [invalid_request](https://qelka.com/docs/errors#invalid_request) | The method is not `POST` |
| 429 | [rate_limited](https://qelka.com/docs/errors#rate_limited) | Too many requests: wait `Retry-After` seconds |
| 500 | [internal_error](https://qelka.com/docs/errors#internal_error) | Unexpected error on our side: retry with backoff |
| 502 | [upstream_unavailable](https://qelka.com/docs/errors#upstream_unavailable) | data.transportation.gov could not be reached, answered with an error or did not answer in time: retry later |

No error is billed. A number that is not registered is not an error: it is a `200` with `status: "not_found"`, and one that cannot be a USDOT or docket number is a `200` with `status: "invalid"`.

## Related

- [DOT carrier lookup API](https://qelka.com/products/dot-carrier-lookup)
- Free tools: [DOT number lookup](https://qelka.com/tools/dot-number-lookup), [MC number lookup](https://qelka.com/tools/mc-number-lookup)
- [Batch](https://qelka.com/docs/api-reference/batch): up to 100 carriers in one call, each item with `type: "dot_carrier"`
- [Bulk](https://qelka.com/docs/api-reference/bulk): a whole column of USDOT or docket numbers with `type=dot_carrier`
- [Caching](https://qelka.com/docs/caching), [Errors](https://qelka.com/docs/errors), [Test mode](https://qelka.com/docs/test-mode)
