Guides: Vehicle statistics
Vehicle statistics
Count vehicles in one call: how many match a set of filters, and how they split by make, kind, usage, color, model year, registration status, fuel, body type or first registration date, and their average odometer reading, power and weight.
Count registered passenger cars by make
curl -H "X-Api-Key: $MOTORBAY_API_KEY" \
"https://api.motorbay.app/v1/statistics/vehicles?kindId=1®istrationStatus=registered&groupBy=make&limit=3"The answer, shortened, with made-up numbers:
{
"total": 2734520,
"groupCount": 312,
"groups": [
{ "make": { "id": "10", "name": "VOLKSWAGEN", "originalName": "VOLKSWAGEN" }, "count": 331208, "share": 12.11 },
{ "make": { "id": "34", "name": "TOYOTA", "originalName": "TOYOTA" }, "count": 222914, "share": 8.15 },
{ "make": { "id": "41", "name": "PEUGEOT", "originalName": "PEUGEOT" }, "count": 187455, "share": 6.86 }
]
}kindId=1 is the id of passenger cars in GET /v1/kinds. Look up the ids you need there, and in /v1/makes, /v1/usages and /v1/colors.
Filters
The filters are the same as in vehicle search, GET /v1/vehicles, and mean the same. Only registrationNumber and the first registration dates are search only:
| Parameter | Keeps |
|---|---|
makeId, kindId, usageId, colorId |
Vehicles with that make, kind, primary usage or color |
fromModelYear, toModelYear |
Model years in the range, both ends included. Vehicles without a model year are left out |
registrationStatus |
registered, deregistered, unknown or pending, spelled as a vehicle's registrationStatus |
fuelTypeId |
Vehicles with that primary fuel type (GET /v1/fuel-types). Vehicles without a primary fuel are left out |
registrationStatus works in vehicle search too: GET /v1/vehicles?registrationStatus=registered lists only registered vehicles.
Grouping
groupBy takes one or two of make, kind, usage, color, modelYear, registrationStatus, fuelType, bodyType, firstRegisteredYear and firstRegisteredMonth, comma separated. Two fields give one group per combination: groupBy=make,modelYear counts each make per model year.
- Each group has only the fields it is grouped by,
count, andshare: its percent oftotal, with two decimals. Makes, kinds, usages, colors and fuel types come as{ "id", "name", "originalName" }, as on a vehicle. fuelTypeis the primary fuel, the same onefuelTypeIdfilters on. Vehicles without a primary fuel havefuelType: null.bodyTypeis the vehicle's body type, spelled as on/technical-details, such asstationcar.unknownis a group of its own: on 16 Oct 2026 it was 62 % of the register.firstRegisteredYearis the year of a vehicle'sfirstRegisteredOn, such as2019, andfirstRegisteredMonthits month asYYYY-MM, such as"2019-03". Vehicles without a first registration date arenull.groupBy=firstRegisteredMonth&kindId=1counts new passenger cars per month.- A grouped field is
nullfor the vehicles without that value, for example vehicles with no color recorded. They are a group of their own. - Groups come largest
countfirst. Groups with the same count keep the same order every time. - With two fields, each group also has
shareOfParent: its percent of the vehicles with the same value of the first field.groupBy=make,fuelTypegives each make's fuel mix, andgroupBy=kind,colorthe colors of each kind. It is counted over every group, also those pastlimit. limitsets how many groups you get, 1 to 1000, and 50 if you leave it out.totalcounts every vehicle that matches the filters, andgroupCountevery group, including those pastlimit.
Without groupBy the answer is just the total, with "groups": [].
Averages
average takes one or more of odometerReading, maximumPower, ownWeight and totalWeight, comma separated. The answer then has averages for all matching vehicles, and every group has its own:
"averages": {
"maximumPower": { "value": 109.2, "unit": "kw", "basedOn": 5475234 }
}valueis the mean, rounded to one decimal, calculated by Motorbay from exact sums. It isnullwhen no vehicle had a value.basedOnis how many vehicles the mean is over. Compare it withcountortotal: many vehicles have no inspection odometer reading, for example.- The units are the raw fields' units:
odometerReadingis the latest inspection's reading in thousands of km (thousandKm),maximumPoweris inkw, and the weights are inkg. - Only the metrics you name are there. Without
averagethe answer has noaverages, exactly as before.
The register holds values no vehicle can have, such as an own weight of 555,555,555,555,555,555 kg or a moped with 350 kW. A value outside its kind's plausible range is left out of the average, not clipped, so it can't move it. An odometer reading of 0 is left out too: for most vehicles it means none was read. The ranges, both ends included, were set from the register's own spread per kind. The power ranges are the same ones /calculated uses for horsepower:
| Kinds | odometerReading (1,000 km) |
maximumPower (kW) |
ownWeight (kg) |
totalWeight (kg) |
|---|---|---|---|---|
| Passenger cars (1) and vans (3) | 1 to 2,000 | 1 to 1,000 | 200 to 4,000 | 300 to 5,000 |
| Motorcycles (7) | 1 to 500 | 1 to 400 | 30 to 1,000 | 50 to 1,500 |
| Mopeds (16, 17) | 1 to 200 | 0.1 to 8 | 10 to 400 | 30 to 1,000 |
| Every other kind | 1 to 5,000 | 0.1 to 2,000 | 10 to 150,000 | 10 to 300,000 |
What the numbers describe
The counts come from the weekly extract of Motorstyrelsen's DMR register that we loaded. They are exact for that extract, and equal the totalCount that vehicle search reports for the same filters. They are not a live view of the register. The Motorbay-Data-As-Of header on the answer says which extract they come from, as on every response, and they change only when the next extract is loaded. Motorbay is not affiliated with Motorstyrelsen.
Usage and errors
One call is one request against your rate limit and monthly quota, however many groups it returns.
| Status | Code | When |
|---|---|---|
| 400 | GroupByInvalid |
A field in groupBy is not one of the ten, or the same field appears twice |
| 400 | GroupByTooMany |
groupBy names three or more fields |
| 400 | LimitOutOfRange |
limit is below 1 or above 1000 |
| 400 | RegistrationStatusInvalid |
registrationStatus is not one of the four values |
| 400 | AverageInvalid |
average names a metric that isn't one of the four, one twice, or none |
These come as problem details with the code in errors, like every validation error.
Didn't find the answer? Email support@motorbay.app.