# Trips API

## Base URLs

{% tabs %}
{% tab title="Production" %}
`https://trips-api.dimo.zone`
{% endtab %}
{% endtabs %}

***

{% hint style="warning" %}
#### Developer Notes

To access the Trips API, a token exchange transaction is required to obtain a 2nd JWT to get permission to access the vehicle's trip. Please check [token-exchange-api](token-exchange-api "mention") prior to using this endpoint.
{% endhint %}

## Getting a Trips History

### List Vehicle Trips by Vehicle Token ID

<mark style="color:blue;">`GET`</mark> [`{baseUrl}`](#base-urls)`/v1/vehicle/{tokenId}/trips`

Retrieves a list of trips taken by the Vehicle identified with the provided Vehicle ID.

#### Path Parameters

<table><thead><tr><th width="178">Name</th><th width="185">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>tokenId</code><mark style="color:red;">*</mark></td><td>String</td><td>Vehicle token ID, this is the token ID of your vehicle NFT. A prerequisite is to obtain a <code>token</code> that is permitted to access trips data for this specific vehicle.</td></tr></tbody></table>

#### Headers

<table><thead><tr><th width="201">Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Authorization</code><mark style="color:red;">*</mark></td><td>String</td><td>Vehicle JWT in <a href="../../developer-guide/authentication#authentication-format">Bearer Authentication format</a>.</td></tr></tbody></table>

{% tabs %}
{% tab title="200: Success" %}
```json
{
    "trips": [
        {
            "id": "2hyZ4PrT9NNTLJXXRufpPFUPUxn",
            "start": {
                "time": "2024-06-16T20:01:25.397535Z",
                "location": {
                    "latitude": 36.157856,
                    "longitude": -115.334557
                },
                "estimatedLocation": {
                    "latitude": 36.15789,
                    "longitude": -115.334572
                }
            },
            "end": {
                "time": "2024-06-16T20:08:55.426886Z",
                "location": {
                    "latitude": 36.189941,
                    "longitude": -115.35775
                }
            },
            "droppedData": false
        }
    ],
    "totalPages": 5,
    "currentPage": 1
}
```
{% endtab %}

{% tab title="401: Unauthorized" %}
```json
{
    "code": 401,
    "message": "Invalid JWT."
}
```
{% endtab %}
{% endtabs %}

#### Get Trips: Data SDK Function Calls

{% tabs %}
{% tab title="TypeScript" %}
<pre class="language-typescript"><code class="lang-typescript"><strong>await dimo.trips.list({
</strong><strong>    vehicleJwt, 
</strong><strong>    tokenId
</strong><strong>});
</strong></code></pre>
{% endtab %}

{% tab title="Python" %}
```python
dimo.trips.trips(vehicle_jwt, token_id)
```
{% endtab %}

{% tab title="C#" %}
```csharp
await dimoClient.TripsService.ListTripsByTokenIdAsync(
    authToken,
    tokenId
);
```
{% endtab %}
{% endtabs %}

## Entity Types

### Trips

Trips are defined as the journeys between two waypoints. The trip entity stores the start time and the end time of each journey.



