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

# POST vehicle-data

> Returns data from vehicles connected to the company

<Info>
  Although this is a POST request, this route is not intended to create a resource in the API. It was designed this way to make it easier to customize the payload sent in the request body.
</Info>

## Request

##### **Header**

<ParamField body="token" type="string" required="true">
  The bearer token used to authenticate the company.
</ParamField>

##### **Body**

<ParamField body="vins" type="list of strings" required="true">
  The list of Vehicle Identification Numbers (VINs) of the vehicles whose data you want to retrieve.

  <Info>
    * A maximum of 20 VINs can be provided.
  </Info>
</ParamField>

<ParamField body="datapoints" type="list of strings" required="true">
  The list of [datapoints](https://docs.mobway.cloud/data/data) you want to retrieve from the vehicles.
</ParamField>

<ParamField body="start_date" type="date or datetime">
  This is an optional parameter that can be used to filter the data start date. It must be sent in one of the following formats:

  * YYYY-MM-DD For filtering purposes, the following time will be considered: YYYY-MM-DDT00:00:00-03:00 (UTC-3)
  * YYYY-MM-DDTHH:MM:SS For filtering purposes, the following time will be considered: YYYY-MM-DDTHH:MM:SS-03:00 (UTC-3)
  * YYYY-MM-DDTHH:MM:SS-ZZ:00 For filtering purposes, the exact provided time will be considered: YYYY-MM-DDTHH:MM:SS-ZZ:00 (UTC-Z)
</ParamField>

<ParamField body="end_date" type="date or datetime">
  This is also an optional parameter that can be used to filter the data end date. It must be sent in one of the following formats:

  * YYYY-MM-DD For filtering purposes, the following time will be considered: YYYY-MM-DDT00:00:00-03:00 (UTC-3)
  * YYYY-MM-DDTHH:MM:SS For filtering purposes, the following time will be considered: YYYY-MM-DDTHH:MM:SS-03:00 (UTC-3)
  * YYYY-MM-DDTHH:MM:SS-ZZ:00 For filtering purposes, the exact provided time will be considered: YYYY-MM-DDTHH:MM:SS-ZZ:00 (UTC-Z)
</ParamField>

<Info>
  * When both start\_date and end\_date are used, date\_time will be between these two dates, as follows: end\_data >= datetime >= start\_date
  * When neither start\_date nor end\_date is used, the last 24 hours from the current moment will be requested by default
  * When only start\_date is used, end\_date will be considered, by default, as start\_date plus 24 hours
  * When only end\_date is used, start\_date will be considered, by default, as end\_date minus 24 hours
  * The minimum value for start\_date is the current moment minus seven days
  * The maximum value for end\_date is the current moment
  * The difference between start\_date and end\_date must be at most 24 hours
</Info>

## Response

<Tip>
  For more detailed information about the response, see [Datapoints](/en/data/general).
</Tip>

<ResponseField name="vin" type="string">
  The vehicle's unique identification number.
</ResponseField>

<ResponseField name="date_time" type="datatime">
  The date and time of the data record \[YYYY-MM-DD HH:MM:SS].
</ResponseField>

<ResponseField name="datapoint" type="number or categorical">
  Each [datapoint](/en/data/general) separately.
</ResponseField>

<ResponseField name="flag" type="categorical">
  Indicates when a data point was considered erroneous and was corrected, including the data point involved, the original value, and the error type.
</ResponseField>

<Warning>
  * "VIN not found or unauthorized access.": The requested VIN is invalid or is not associated with your company. Check the VIN or your permissions.
  * "Unsupported datapoint for this vehicle.": The requested datapoint is not available for this vehicle due to OEM compatibility restrictions.
  * "Datapoint not included in your package plan.": The requested datapoint is not available in your current plan. Contact mobway support for further assistance.
  * "No data for the given date range: start\_date to end\_date.": No data was found for the specified date range (start\_date to end\_date). Check that the dates are correct, review the time zone, or try selecting a different period.
  * "start\_date is greater than end\_date.": The start date (start\_date) is later than the provided end date (end\_date).
  * "start\_date or end\_date are out of the range of 7 days.": The provided start or end date (start\_date or end\_date) is earlier than the maximum 7-day availability period.
  * "start\_date or end\_date are in the future.": The provided start or end date (start\_date or end\_date) is later than the current moment.
  * "Difference between start\_date and end\_date cannot exceed 24 hours.": The difference between start\_date and end\_date is greater than 24 hours.
  * "Too many VINs provided. Maximum allowed is 20.": More than 20 VINs were provided.
</Warning>

<RequestExample>
  ```bash Request theme={null}
  curl --request POST \
    --url https://api.mobway.cloud/vehicle-data \
    --header 'Authorization: Bearer <token>' \
    --data '{
      "vins": [
          {vins}
      ],
      "datapoints": [
          "vin",
          "date_time",
          "speed",
          "latitude",
          "longitude",
          "heading",
          "rpm",
          "odometer",
          "fuel_level",
          "range",
          "left_front_tire_pressure",
          "right_front_tire_pressure",
          "left_rear_tire_pressure",
          "right_rear_tire_pressure",
          "oil_level",
          "engine_cooling_temperature",
          "lv_battery_voltage",
          "hv_battery_voltage",
          "hv_battery_soc",
          "hv_battery_charging_status",
          "seat_belt_status",
          "event",
          "flag"
      ],
      "start_date": {start_date},
      "end_date": {end_date}
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "6AHFT68CKAF501652": [
      {
        "vin": "6AHFT68CKAF501652",
        "date_time": "2023-02-14 09:51:48",
        "speed": 109.78,
        "latitude": 56.073055,
        "longitude": -177.689265,
        "heading": 357.92,
        "rpm": 3737.16,
        "odometer": 806942.06,
        "fuel_level": 79.79,
        "range": -75.68,
        "left_front_tire_pressure": 31.66,
        "right_front_tire_pressure": 31.95,
        "left_rear_tire_pressure": 31.17,
        "right_rear_tire_pressure": 31.88,
        "oil_level": 15.28,
        "engine_cooling_temperature": 11.4,
        "lv_battery_voltage": 12.41,
        "hv_battery_voltage": 596.41,
        "hv_battery_soc": 38.48,
        "hv_battery_charging_status": "other",
        "seat_belt_status": "not buckled",
        "event": "charging plug status change",
        "flag": {}
      },
      {
        "vin": "6AHFT68CKAF501652",
        "date_time": "2023-02-14 09:51:51",
        "speed": 265.23,
        "latitude": 56.089004,
        "longitude": -177.71086,
        "heading": 357.92,
        "rpm": 5591.89,
        "odometer": 806942.21,
        "fuel_level": 21.35,
        "range": -76.13,
        "left_front_tire_pressure": 31.66,
        "right_front_tire_pressure": 31.95,
        "left_rear_tire_pressure": 31.17,
        "right_rear_tire_pressure": 31.88,
        "oil_level": 95.38,
        "engine_cooling_temperature": 129.52,
        "lv_battery_voltage": None,
        "hv_battery_voltage": None,
        "hv_battery_soc": 17.87,
        "hv_battery_charging_status": "charging",
        "seat_belt_status": "not buckled",
        "event": "charging plug status change",
        "flag": {
          "lv_battery_voltage": {
            "value": 35.44,
            "flag": "out of range"
          },
          "hv_battery_voltage": {
            "value": 1200.54,
            "flag": "out of range"
          }
        }
      }
    ]
  }
  ```
</ResponseExample>
