# Create

This API must be used to create a new vehicle that will belong to your organization. After the vehicle is created, you can add the vehicleId in the trip API request to get the trip scores and data described in the [trip analysis](/trip-analysis/rest-services/trip.md) section.

We recommend to add a vehicle before requesting the [trip analysis service](/trip-analysis/rest-services/trip.md) if you need to monitor the vehicle. For each request, the unique vehicle identifier must be added in the trip analysis request.

{% hint style="info" %}
If you have your **admin API key**, you can try the API via this [**link**](https://drivequant.stoplight.io/docs/drivequant-public/58e1c3eb04f70-vehicle-creation).
{% endhint %}

## POST /drivekit/admin/vehicle

> Create a vehicle

```json
{"openapi":"3.0.3","info":{"title":"DKAdminVehiclesV3","version":"1.0"},"servers":[{"url":"https://service.drivequant.com/v3","description":"Prod"}],"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"name":"DriveKit-Admin-API-Key","type":"apiKey","in":"header"}},"schemas":{"ErrorResponse":{"title":"ErrorResponse","type":"object","properties":{"message":{"type":"string"},"code":{"type":"integer"},"messageKey":{"type":"string"}}},"VehicleCharacteristics":{"title":"vehicleCharacteristics","type":"object","properties":{"brand":{"type":"string","description":"Vehicle's brand"},"model":{"type":"string","description":"Vehicle's model"},"version":{"description":"Vehicle's model version","type":"string"},"year":{"description":"Vehicle's model year","type":"string"},"typeIndex":{"description":"Vehicle body type","type":"integer"},"engineIndex":{"description":"Engine type","type":"integer"},"power":{"type":"number","description":"Vehicle power (hp)"},"mass":{"type":"number","description":"Vehicle mass (kg)"},"engineDisplacement":{"type":"number","description":"Vehicle's engine displacement"},"gearboxIndex":{"description":"Gearbox type","type":"integer"},"consumption":{"type":"number","description":"Combined fuel consumption (l/100km) measured during the New European Driving Cycle (NEDC)"},"autoGearboxNumber":{"description":"Number of gear ratios for the automatic gearbox","type":"integer"},"frontTireSize":{"type":"string","minLength":1,"description":"Front tyre size"},"rearTireSize":{"type":"string","minLength":1,"description":"Rear tyre size"},"length":{"type":"number","description":"Vehicle length (m)"},"width":{"type":"number","description":"Vehicle width (m)"},"height":{"type":"number","description":"Vehicle height (m)"},"driveWheels":{"description":"Drive wheels : 0 -> AV, 1 -> AR, 2 -> 4x4","type":"integer"},"engineCylinderNb":{"description":"Engine cylinder number","type":"integer"}}},"BeaconIdentifier":{"title":"BeaconIdentifier","type":"object","properties":{"proximityUuid":{"type":"string","description":"Beacon's proximity UUID"},"major":{"type":"integer","description":"Beacon's major","minimum":0,"maximum":65535},"minor":{"type":"integer","description":"Beacon's minor","minimum":0,"maximum":65535},"uniqueId":{"type":"string","description":"Beacon's unique ID"}}}}},"paths":{"/drivekit/admin/vehicle":{"post":{"summary":"Create a vehicle","operationId":"post-drivekit-admin-vehicle","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"parameters":[{"schema":{"type":"string"},"in":"header","required":true,"name":"DriveKit-Admin-API-Key","description":"DK admin token"},{"schema":{"type":"string","default":"Application/json"},"in":"header","name":"Content-Type","required":true}],"requestBody":{"content":{"application/json":{"schema":{"description":"Adds a new vehicle in the database","type":"object","properties":{"username":{"type":"string","minLength":1,"description":"Username of the vehicle's owner"},"vehiclename":{"type":"string","minLength":1,"description":"Vehicle Name"},"vehicleId":{"type":"string","minLength":1,"description":"Vehicle client Id"},"vehicleCharacteristics":{"$ref":"#/components/schemas/VehicleCharacteristics"},"beaconIdentifier":{"$ref":"#/components/schemas/BeaconIdentifier"}},"required":["vehiclename","vehicleId","vehicleCharacteristics"]}}},"description":""},"description":""}}}}
```

## Request Body

The table below summarizes the content of a request body.

<table><thead><tr><th width="199.2109375">Name</th><th width="157.28515625">Type</th><th>Description</th></tr></thead><tbody><tr><td>username</td><td><code>string</code></td><td>Unique driver identifier</td></tr><tr><td>beaconIdentifier</td><td><a href="#beaconidentifier">BeaconIdentifier</a></td><td>Parameters of the beacon linked to the vehicle</td></tr><tr><td>vehicleId</td><td><code>string</code></td><td>Vehicle unique identifier</td></tr><tr><td>vehicleCharacteristics</td><td>object</td><td><a href="/pages/-M0RzKZcKUsrAjXCcteE#vehiculecharacteristics">Characteristics of the vehicle</a></td></tr><tr><td>vehiclename</td><td><code>string</code></td><td>Vehicle name</td></tr></tbody></table>

### BeaconIdentifier

The table below summarizes the content of a beaconIdentifier object.

| Field         | Type     | Description              |
| ------------- | -------- | ------------------------ |
| major         | `int`    | Major                    |
| minor         | `int`    | Minor                    |
| proximityUuid | `string` | Proximity UUID           |
| uniqueId      | `string` | Beacon unique identifier |

### Body sample

```javascript
{
	"vehiclename": "My car",
	"vehicleId": "<UNIQUE VEHICLE ID>",
	"vehicleCharacteristics": {
     	 "brand": "Renault",
        "model": "Clio 5",
        "version": "V 1.0 SCE 65 LIFE",
        "year": "2020",
    	  "typeIndex": 2,
        "engineIndex": 4,
        "power": 65.0,
        "mass": 1137.0,
        "engineDisplacement": 1.0,
        "gearboxIndex": 1,
        "consumption": 4.82,
        "autoGearboxNumber": 0, 
        "frontTireSize": "185/65/15",
        "rearTireSize": "185/65/15",
        "length": 4.05,
        "width": 1.79,
        "height": 1.44,
        "driveWheels": 0,
        "engineCylinderNb": 3
	},
	"username": "<UNIQUE DRIVER ID>"	
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.drivequant.com/backend/vehicle/create-a-vehicle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
