---
agentTools:
  projectIndex: https://developer-docs.gomotive.com/llms.txt
---

# Fetch recent location details of a vehicle (within 24 hours)

**Purpose**: Use this API to fetch the recent location details of a specific vehicle. It is important to note that you can only view the location history of the past 24 hours or less. The following are the things to remember when using this endpoint:

> 📘 THINGS TO REMEMBER
>
> 1. The `start_time` and the `end_time`, must be within the past 24 hours or less. This endpoint will not fetch the historical location data.
> 2. You must have an active tracking subscription for the vehicle.
> 3. The vehicle must not be deactivated.
> 4. The `start_time` and the `end_time` must match or be within the `start_time` and the `end_time` of the vehicle subscription.

```ruby Ruby (OAuth 2.0)
require 'uri'
require 'net/http'

url = URI('https://api.gomotive.com/v1/freight_visibility/vehicle_locations/details')

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"

response = http.request(request)
puts response.read_body
```

## Response Parameters

### Data

* **Type**: Object
* **Description**: Contains information about vehicle locations.

### vehicle\_locations

* **Type**: Array of Objects
* **Description**: List of vehicle locations with details such as coordinates, speed, and engine hours.

### d

* **Type**: String
* **Description**: Unique identifier for the vehicle location event.

### located\_at

* **Type**: String
* **Description**: Timestamp of when the vehicle location was recorded.

### lat

* **Type**: Float
* **Description**: Latitude of the vehicle’s location.

### lon

* **Type**: Float
* **Description**: Longitude of the vehicle’s location.

### description

* **Type**: String
* **Description**: Descriptive location of the vehicle (e.g., city, state).

### bearing

* **Type**: Integer
* **Description**: The vehicle's directional bearing in degrees.

### engine\_hours

* **Type**: Float
* **Description**: Number of engine hours recorded.

### type

* **Type**: String
* **Description**: Type of vehicle event (e.g., vehicle moving).

### speed

* **Type**: Float
* **Description**: Speed of the vehicle in miles per hour.

### fuel

* **Type**: Float
* **Description**: The amount of fuel remaining in gallons.

### odometer

* **Type**: Float
* **Description**: The vehicle’s odometer reading in miles.

***

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Motive",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.gomotive.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/freight_visibility/vehicle_locations/details": {
      "get": {
        "summary": "Fetch recent location details of a vehicle (within 24 hours)",
        "description": "",
        "operationId": "fetch-recent-location-details-of-a-vehicle-within-24-hours",
        "parameters": [
          {
            "name": "vehicle_id",
            "in": "query",
            "description": "Specify the ID of the vehicle for which you are fetching the location details.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "vehicle_name",
            "in": "query",
            "description": "Specify the name of the vehicle for which you are fetching the location details.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "driver_id",
            "in": "query",
            "description": "Specify the ID of the driver driving the vehicle.",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "start_time",
            "in": "query",
            "description": "Specify the start time from when you want to view the location details of the vehicle. NOTE: Must be within 24 hours of current time.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_time",
            "in": "query",
            "description": "Specify the end time till when you want to view the location details of the vehicle. NOTE: Must be within 24 hours from the current time.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Fetch recent location details of a vehicle": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Vehicle Deactivated": {
                    "value": "{\n  \"error_message\": \"vehicle must not be deactivated\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error_message": {
                      "type": "string",
                      "example": "vehicle must not be deactivated"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "examples": {
                  "Permissions Issue": {
                    "value": "{\n  \"error_message\": \"permissions missing\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error_message": {
                      "type": "string",
                      "example": "permissions missing"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "66acf64a829e88001980fbf2:66db51b9ce6e3c000fa17cd9"
}
```