Trips
Create one or more trips (max 100)
Scopes: trip:create
POST
/
v0
/
business
/
{business_id}
/
trips
Create one or more trips (max 100)
curl --request POST \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/trips \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"vehicle_id": "<string>",
"trip_date": "2023-12-25",
"distance": "42.50",
"external_id": "1234567890",
"purpose": "personal",
"start_address": "123 Main St, San Francisco, CA",
"end_address": "456 Market St, San Francisco, CA",
"notes": "Client lunch meeting"
}
]
'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/trips"
payload = [
{
"vehicle_id": "<string>",
"trip_date": "2023-12-25",
"distance": "42.50",
"external_id": "1234567890",
"purpose": "personal",
"start_address": "123 Main St, San Francisco, CA",
"end_address": "456 Market St, San Francisco, CA",
"notes": "Client lunch meeting"
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
vehicle_id: '<string>',
trip_date: '2023-12-25',
distance: '42.50',
external_id: '1234567890',
purpose: 'personal',
start_address: '123 Main St, San Francisco, CA',
end_address: '456 Market St, San Francisco, CA',
notes: 'Client lunch meeting'
}
])
};
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/trips', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.getasset.com/v0/business/{business_id}/trips",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'vehicle_id' => '<string>',
'trip_date' => '2023-12-25',
'distance' => '42.50',
'external_id' => '1234567890',
'purpose' => 'personal',
'start_address' => '123 Main St, San Francisco, CA',
'end_address' => '456 Market St, San Francisco, CA',
'notes' => 'Client lunch meeting'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.getasset.com/v0/business/{business_id}/trips"
payload := strings.NewReader("[\n {\n \"vehicle_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": \"42.50\",\n \"external_id\": \"1234567890\",\n \"purpose\": \"personal\",\n \"start_address\": \"123 Main St, San Francisco, CA\",\n \"end_address\": \"456 Market St, San Francisco, CA\",\n \"notes\": \"Client lunch meeting\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.getasset.com/v0/business/{business_id}/trips")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"vehicle_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": \"42.50\",\n \"external_id\": \"1234567890\",\n \"purpose\": \"personal\",\n \"start_address\": \"123 Main St, San Francisco, CA\",\n \"end_address\": \"456 Market St, San Francisco, CA\",\n \"notes\": \"Client lunch meeting\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/business/{business_id}/trips")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"vehicle_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": \"42.50\",\n \"external_id\": \"1234567890\",\n \"purpose\": \"personal\",\n \"start_address\": \"123 Main St, San Francisco, CA\",\n \"end_address\": \"456 Market St, San Francisco, CA\",\n \"notes\": \"Client lunch meeting\"\n }\n]"
response = http.request(request)
puts response.read_body{
"data": [
{
"business_id": "<string>",
"vehicle_id": "<string>",
"trip_date": "2023-12-25",
"distance": 123,
"start_address": "123 Main St, San Francisco, CA",
"end_address": "456 Market St, San Francisco, CA",
"id": "<string>",
"external_id": "1234567890",
"notes": "Client lunch meeting",
"purpose": "personal",
"amount": 7.25,
"amount_reason": "Standard rate applied"
}
],
"errors": [
{
"error": "<string>",
"external_id": "<string>"
}
]
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
Body
application/json
Maximum array length:
100The id of the Vehicle used for the trip
Example:
"vhc_GA6EG2qFxA97NZHtxeLPUy"
The date the trip occurred
Example:
"2026-04-22"
The distance travelled, in units defined by distance_unit
Required range:
x > 0Example:
"42.50"
The unit of measurement for distance
Available options:
miles, kilometers Example:
"miles"
The external ID of the Trip
Maximum string length:
255Example:
"1234567890"
Whether the trip was for business or personal use
Available options:
business, personal Example:
"personal"
Where the trip started (unstructured)
Maximum string length:
500Example:
"123 Main St, San Francisco, CA"
Where the trip ended (unstructured)
Maximum string length:
500Example:
"456 Market St, San Francisco, CA"
Free-form notes about the trip from the user
Maximum string length:
1000Example:
"Client lunch meeting"
⌘I
Create one or more trips (max 100)
curl --request POST \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/trips \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"vehicle_id": "<string>",
"trip_date": "2023-12-25",
"distance": "42.50",
"external_id": "1234567890",
"purpose": "personal",
"start_address": "123 Main St, San Francisco, CA",
"end_address": "456 Market St, San Francisco, CA",
"notes": "Client lunch meeting"
}
]
'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/trips"
payload = [
{
"vehicle_id": "<string>",
"trip_date": "2023-12-25",
"distance": "42.50",
"external_id": "1234567890",
"purpose": "personal",
"start_address": "123 Main St, San Francisco, CA",
"end_address": "456 Market St, San Francisco, CA",
"notes": "Client lunch meeting"
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
vehicle_id: '<string>',
trip_date: '2023-12-25',
distance: '42.50',
external_id: '1234567890',
purpose: 'personal',
start_address: '123 Main St, San Francisco, CA',
end_address: '456 Market St, San Francisco, CA',
notes: 'Client lunch meeting'
}
])
};
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/trips', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.getasset.com/v0/business/{business_id}/trips",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'vehicle_id' => '<string>',
'trip_date' => '2023-12-25',
'distance' => '42.50',
'external_id' => '1234567890',
'purpose' => 'personal',
'start_address' => '123 Main St, San Francisco, CA',
'end_address' => '456 Market St, San Francisco, CA',
'notes' => 'Client lunch meeting'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.getasset.com/v0/business/{business_id}/trips"
payload := strings.NewReader("[\n {\n \"vehicle_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": \"42.50\",\n \"external_id\": \"1234567890\",\n \"purpose\": \"personal\",\n \"start_address\": \"123 Main St, San Francisco, CA\",\n \"end_address\": \"456 Market St, San Francisco, CA\",\n \"notes\": \"Client lunch meeting\"\n }\n]")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sandbox.getasset.com/v0/business/{business_id}/trips")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"vehicle_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": \"42.50\",\n \"external_id\": \"1234567890\",\n \"purpose\": \"personal\",\n \"start_address\": \"123 Main St, San Francisco, CA\",\n \"end_address\": \"456 Market St, San Francisco, CA\",\n \"notes\": \"Client lunch meeting\"\n }\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/business/{business_id}/trips")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"vehicle_id\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"distance\": \"42.50\",\n \"external_id\": \"1234567890\",\n \"purpose\": \"personal\",\n \"start_address\": \"123 Main St, San Francisco, CA\",\n \"end_address\": \"456 Market St, San Francisco, CA\",\n \"notes\": \"Client lunch meeting\"\n }\n]"
response = http.request(request)
puts response.read_body{
"data": [
{
"business_id": "<string>",
"vehicle_id": "<string>",
"trip_date": "2023-12-25",
"distance": 123,
"start_address": "123 Main St, San Francisco, CA",
"end_address": "456 Market St, San Francisco, CA",
"id": "<string>",
"external_id": "1234567890",
"notes": "Client lunch meeting",
"purpose": "personal",
"amount": 7.25,
"amount_reason": "Standard rate applied"
}
],
"errors": [
{
"error": "<string>",
"external_id": "<string>"
}
]
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}