curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/vehicles/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vehicles": [
{
"make_and_model": "<string>",
"year": 123,
"external_id": "<string>",
"license_plate": "<string>",
"vin": "<string>",
"description": "<string>",
"is_primary": false
}
]
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/vehicles/bulk"
payload = { "vehicles": [
{
"make_and_model": "<string>",
"year": 123,
"external_id": "<string>",
"license_plate": "<string>",
"vin": "<string>",
"description": "<string>",
"is_primary": False
}
] }
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({
vehicles: [
{
make_and_model: '<string>',
year: 123,
external_id: '<string>',
license_plate: '<string>',
vin: '<string>',
description: '<string>',
is_primary: false
}
]
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/vehicles/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/vehicles/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([
'vehicles' => [
[
'make_and_model' => '<string>',
'year' => 123,
'external_id' => '<string>',
'license_plate' => '<string>',
'vin' => '<string>',
'description' => '<string>',
'is_primary' => false
]
]
]),
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/vehicles/bulk"
payload := strings.NewReader("{\n \"vehicles\": [\n {\n \"make_and_model\": \"<string>\",\n \"year\": 123,\n \"external_id\": \"<string>\",\n \"license_plate\": \"<string>\",\n \"vin\": \"<string>\",\n \"description\": \"<string>\",\n \"is_primary\": false\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/vehicles/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vehicles\": [\n {\n \"make_and_model\": \"<string>\",\n \"year\": 123,\n \"external_id\": \"<string>\",\n \"license_plate\": \"<string>\",\n \"vin\": \"<string>\",\n \"description\": \"<string>\",\n \"is_primary\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/vehicles/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 \"vehicles\": [\n {\n \"make_and_model\": \"<string>\",\n \"year\": 123,\n \"external_id\": \"<string>\",\n \"license_plate\": \"<string>\",\n \"vin\": \"<string>\",\n \"description\": \"<string>\",\n \"is_primary\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"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"
}
]""""Bulk create vehicles
Creates multiple vehicles for the specified business in a single request. Maximum of 100 vehicles per request. This endpoint is idempotent using the external_id field as the idempotency key for each vehicle.
curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/vehicles/bulk \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vehicles": [
{
"make_and_model": "<string>",
"year": 123,
"external_id": "<string>",
"license_plate": "<string>",
"vin": "<string>",
"description": "<string>",
"is_primary": false
}
]
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/vehicles/bulk"
payload = { "vehicles": [
{
"make_and_model": "<string>",
"year": 123,
"external_id": "<string>",
"license_plate": "<string>",
"vin": "<string>",
"description": "<string>",
"is_primary": False
}
] }
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({
vehicles: [
{
make_and_model: '<string>',
year: 123,
external_id: '<string>',
license_plate: '<string>',
vin: '<string>',
description: '<string>',
is_primary: false
}
]
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/vehicles/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/vehicles/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([
'vehicles' => [
[
'make_and_model' => '<string>',
'year' => 123,
'external_id' => '<string>',
'license_plate' => '<string>',
'vin' => '<string>',
'description' => '<string>',
'is_primary' => false
]
]
]),
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/vehicles/bulk"
payload := strings.NewReader("{\n \"vehicles\": [\n {\n \"make_and_model\": \"<string>\",\n \"year\": 123,\n \"external_id\": \"<string>\",\n \"license_plate\": \"<string>\",\n \"vin\": \"<string>\",\n \"description\": \"<string>\",\n \"is_primary\": false\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/vehicles/bulk")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vehicles\": [\n {\n \"make_and_model\": \"<string>\",\n \"year\": 123,\n \"external_id\": \"<string>\",\n \"license_plate\": \"<string>\",\n \"vin\": \"<string>\",\n \"description\": \"<string>\",\n \"is_primary\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/vehicles/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 \"vehicles\": [\n {\n \"make_and_model\": \"<string>\",\n \"year\": 123,\n \"external_id\": \"<string>\",\n \"license_plate\": \"<string>\",\n \"vin\": \"<string>\",\n \"description\": \"<string>\",\n \"is_primary\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"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"
}
]""""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 vehicles to create. Maximum of 100 vehicles per request.
100Show child attributes
Show child attributes
Response
Vehicles created successfully
The unique identifier of the vehicle
The UUID of the business this vehicle belongs to
The make and model of the vehicle (e.g., 'Toyota Camry')
The model year of the vehicle
Whether this is the primary vehicle for the business. Only one vehicle can be primary at a time.
Whether the vehicle can be deleted. A vehicle cannot be deleted if it has trips or is archived.
Timestamp when the vehicle was created
Timestamp when the vehicle was last updated
An optional external identifier for the vehicle, used for idempotency
The license plate number of the vehicle
The Vehicle Identification Number (VIN)
An optional description or notes about the vehicle
Timestamp when the vehicle was archived, or null if not archived
Timestamp when the vehicle was deleted, or null if not deleted