> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Vehicle

> Retrieve a single vehicle by ID

# Get Vehicle

Retrieve the full details of a single vehicle, including its fuel type, emission data, and status.

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Path Parameters

<ParamField path="vehicle_id" type="string" required>
  UUID of the vehicle

  **Example:** `f47ac10b-58cc-4372-a567-0e02b2c3d479`
</ParamField>

## Response

<ResponseField name="id" type="string">
  Vehicle UUID
</ResponseField>

<ResponseField name="name" type="string | null">
  Display name of the vehicle
</ResponseField>

<ResponseField name="type" type="string">
  Vehicle usage type: `freight` or `passenger`
</ResponseField>

<ResponseField name="ownership" type="string">
  Ownership type: `owned` or `rented`
</ResponseField>

<ResponseField name="license_plate" type="string | null">
  Vehicle license plate number
</ResponseField>

<ResponseField name="country" type="string">
  ISO country code
</ResponseField>

<ResponseField name="registration_year" type="integer | null">
  Year the vehicle was registered
</ResponseField>

<ResponseField name="market_segment" type="string | null">
  Market segment: `mini`, `supermini`, `lower_medium`, `upper_medium`, `executive`, `luxury`, `sports`, `dual_purpose_4x4`, `mpv`
</ResponseField>

<ResponseField name="size" type="string | null">
  Vehicle size: `small_car`, `medium`, `large_car`, `average_car`
</ResponseField>

<ResponseField name="status" type="string">
  Current status: `active`, `archived`, `error`
</ResponseField>

<ResponseField name="co2e" type="number">
  Total CO2 equivalent emissions in kg
</ResponseField>

<ResponseField name="vehicle_fuel_id" type="string | null">
  UUID of the assigned fuel type
</ResponseField>

<ResponseField name="vehicle_fuel" type="string | null">
  Fuel type name (e.g. `diesel`, `petrol`, `electric`)
</ResponseField>

<ResponseField name="vehicle_fuel_units" type="array[object] | null">
  Available fuel units for this vehicle's fuel type

  <Expandable title="Fuel Unit Object">
    <ResponseField name="id" type="string">Unit UUID</ResponseField>
    <ResponseField name="name" type="string">Unit name (e.g. `litre_(l)`, `kilogram_(kg)`)</ResponseField>
    <ResponseField name="type" type="string">Unit category</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="unknown_vehicle_id" type="string | null">
  UUID of the unknown vehicle type
</ResponseField>

<ResponseField name="unknown_vehicle_type" type="string | null">
  String name of the unknown vehicle type (e.g. `Truck`, `Van`)
</ResponseField>

<ResponseField name="custom_emission_factor_id" type="string | null">
  UUID of the custom emission factor applied, if any
</ResponseField>

<ResponseField name="error_messages" type="array[string] | null">
  Error codes when status is `error`
</ResponseField>

<ResponseField name="file_id" type="string | null">
  UUID of the import file, if created via CSV import
</ResponseField>

<ResponseField name="file_name" type="string | null">
  Name of the import file, if created via CSV import
</ResponseField>

<ResponseField name="created_at" type="datetime">
  ISO 8601 creation timestamp
</ResponseField>

<ResponseField name="updated_at" type="datetime | null">
  ISO 8601 last-update timestamp
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl "https://api.dcycle.io/v1/vehicles/${VEHICLE_ID}" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests
  import os

  response = requests.get(
      f"https://api.dcycle.io/v1/vehicles/{os.getenv('VEHICLE_ID')}",
      headers={
          "x-api-key": os.getenv("DCYCLE_API_KEY"),
          "x-organization-id": os.getenv("DCYCLE_ORG_ID"),
      },
  )

  vehicle = response.json()
  print(f"{vehicle['name']} — {vehicle['co2e']} kg CO2e")
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const axios = require('axios');

  const response = await axios.get(
    `https://api.dcycle.io/v1/vehicles/${process.env.VEHICLE_ID}`,
    {
      headers: {
        'x-api-key': process.env.DCYCLE_API_KEY,
        'x-organization-id': process.env.DCYCLE_ORG_ID,
      },
    }
  );

  console.log(`${response.data.name} — ${response.data.co2e} kg CO2e`);
  ```
</CodeGroup>

### Successful Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "name": "Company Van #12",
  "type": "freight",
  "ownership": "owned",
  "license_plate": "1234 ABC",
  "country": "ES",
  "registration_year": 2021,
  "market_segment": null,
  "size": "large_car",
  "status": "active",
  "co2e": 2450.8,
  "vehicle_fuel_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "vehicle_fuel": "diesel",
  "vehicle_fuel_units": [
    { "id": "unit-uuid", "name": "litres", "type": "volume" }
  ],
  "unknown_vehicle_id": null,
  "unknown_vehicle_type": null,
  "custom_emission_factor_id": null,
  "error_messages": null,
  "file_id": null,
  "file_name": null,
  "created_at": "2024-06-15T10:30:00Z",
  "updated_at": "2025-01-20T14:22:00Z"
}
```

## Common Errors

### 404 Not Found

**Cause:** Vehicle does not exist or does not belong to your organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "detail": "Vehicle not found" }
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="List Vehicles" icon="list" href="/api-reference/vehicles/list">
    Browse all vehicles
  </Card>

  <Card title="Update Vehicle" icon="pen" href="/api-reference/vehicles/update">
    Modify vehicle details
  </Card>
</CardGroup>
