curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"trips": [
{
"vehicle_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"distance": "<string>",
"trip_date": "2023-12-25",
"external_id": "<string>",
"purpose": "UNREVIEWED",
"start_address": "<string>",
"end_address": "<string>",
"description": "<string>"
}
]
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk"
payload = { "trips": [
{
"vehicle_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"distance": "<string>",
"trip_date": "2023-12-25",
"external_id": "<string>",
"purpose": "UNREVIEWED",
"start_address": "<string>",
"end_address": "<string>",
"description": "<string>"
}
] }
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({
trips: [
{
vehicle_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
distance: '<string>',
trip_date: '2023-12-25',
external_id: '<string>',
purpose: 'UNREVIEWED',
start_address: '<string>',
end_address: '<string>',
description: '<string>'
}
]
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk', 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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk",
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([
'trips' => [
[
'vehicle_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'distance' => '<string>',
'trip_date' => '2023-12-25',
'external_id' => '<string>',
'purpose' => 'UNREVIEWED',
'start_address' => '<string>',
'end_address' => '<string>',
'description' => '<string>'
]
]
]),
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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk"
payload := strings.NewReader("{\n \"trips\": [\n {\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"external_id\": \"<string>\",\n \"purpose\": \"UNREVIEWED\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"description\": \"<string>\"\n }\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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"trips\": [\n {\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"external_id\": \"<string>\",\n \"purpose\": \"UNREVIEWED\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"description\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk")
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 \"trips\": [\n {\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"external_id\": \"<string>\",\n \"purpose\": \"UNREVIEWED\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"description\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vehicle": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"make_and_model": "<string>",
"year": 123,
"is_primary": true,
"is_eligible_for_deletion": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"license_plate": "<string>",
"vin": "<string>",
"description": "<string>",
"archived_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
},
"distance": "<string>",
"trip_date": "2023-12-25",
"mileage_deduction_rate": "<string>",
"estimated_deduction": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"start_address": "<string>",
"end_address": "<string>",
"description": "<string>",
"deleted_at": "2023-11-07T05:31:56Z"
}
]""""Bulk create trips
Creates multiple trips for the specified business in a single request. Maximum of 100 trips per request. This endpoint is idempotent using the external_id field as the idempotency key for each trip.
curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"trips": [
{
"vehicle_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"distance": "<string>",
"trip_date": "2023-12-25",
"external_id": "<string>",
"purpose": "UNREVIEWED",
"start_address": "<string>",
"end_address": "<string>",
"description": "<string>"
}
]
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk"
payload = { "trips": [
{
"vehicle_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"distance": "<string>",
"trip_date": "2023-12-25",
"external_id": "<string>",
"purpose": "UNREVIEWED",
"start_address": "<string>",
"end_address": "<string>",
"description": "<string>"
}
] }
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({
trips: [
{
vehicle_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
distance: '<string>',
trip_date: '2023-12-25',
external_id: '<string>',
purpose: 'UNREVIEWED',
start_address: '<string>',
end_address: '<string>',
description: '<string>'
}
]
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk', 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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk",
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([
'trips' => [
[
'vehicle_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'distance' => '<string>',
'trip_date' => '2023-12-25',
'external_id' => '<string>',
'purpose' => 'UNREVIEWED',
'start_address' => '<string>',
'end_address' => '<string>',
'description' => '<string>'
]
]
]),
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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk"
payload := strings.NewReader("{\n \"trips\": [\n {\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"external_id\": \"<string>\",\n \"purpose\": \"UNREVIEWED\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"description\": \"<string>\"\n }\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://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"trips\": [\n {\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"external_id\": \"<string>\",\n \"purpose\": \"UNREVIEWED\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"description\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips/bulk")
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 \"trips\": [\n {\n \"vehicle_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"distance\": \"<string>\",\n \"trip_date\": \"2023-12-25\",\n \"external_id\": \"<string>\",\n \"purpose\": \"UNREVIEWED\",\n \"start_address\": \"<string>\",\n \"end_address\": \"<string>\",\n \"description\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vehicle": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"make_and_model": "<string>",
"year": 123,
"is_primary": true,
"is_eligible_for_deletion": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"license_plate": "<string>",
"vin": "<string>",
"description": "<string>",
"archived_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z"
},
"distance": "<string>",
"trip_date": "2023-12-25",
"mileage_deduction_rate": "<string>",
"estimated_deduction": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"start_address": "<string>",
"end_address": "<string>",
"description": "<string>",
"deleted_at": "2023-11-07T05:31:56Z"
}
]""""Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Content-Type must be set to application/json
Path Parameters
The UUID of the business
Body
List of trips to create. Maximum of 100 trips per request.
100Show child attributes
Show child attributes
Response
Trips created successfully
The unique identifier of the trip
The vehicle used for this trip
Show child attributes
Show child attributes
The distance traveled in miles, as a decimal string
The date of the trip (YYYY-MM-DD)
The purpose classification of the trip
UNREVIEWED, BUSINESS, PERSONAL The IRS standard mileage rate in cents per mile applicable for the trip date
The estimated tax deduction in cents. Only calculated for BUSINESS trips; returns 0 for PERSONAL and UNREVIEWED trips.
Timestamp when the trip was created
Timestamp when the trip was last updated
An optional external identifier for the trip, used for idempotency
The starting address of the trip
The ending address of the trip
An optional description or notes about the trip
Timestamp when the trip was deleted, or null if not deleted