Skip to main content
POST
/
v1
/
businesses
/
{businessId}
/
mileage
/
trips
Create trip
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/mileage/trips \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "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>"
}
'
{
  "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",
  "purpose": "UNREVIEWED",
  "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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Content-Type
string

Content-Type must be set to application/json

Path Parameters

businessId
string<uuid>
required

The UUID of the business

Body

application/json
vehicle_id
string<uuid>
required

The UUID of the vehicle used for this trip

distance
string
required

The distance traveled in miles, as a decimal string

trip_date
string<date>
required

The date of the trip (YYYY-MM-DD)

external_id
string | null

An optional external identifier for the trip. If provided and a trip with this external_id already exists, the existing trip will be updated instead of creating a new one.

purpose
enum<string>
default:UNREVIEWED

The purpose classification of the trip

Available options:
UNREVIEWED,
BUSINESS,
PERSONAL
start_address
string | null

The starting address of the trip

end_address
string | null

The ending address of the trip

description
string | null

An optional description or notes about the trip

Response

Existing trip with matching external_id was updated

id
string<uuid>
required

The unique identifier of the trip

vehicle
object
required

The vehicle used for this trip

distance
string
required

The distance traveled in miles, as a decimal string

trip_date
string<date>
required

The date of the trip (YYYY-MM-DD)

purpose
enum<string>
required

The purpose classification of the trip

Available options:
UNREVIEWED,
BUSINESS,
PERSONAL
mileage_deduction_rate
string
required

The IRS standard mileage rate in cents per mile applicable for the trip date

estimated_deduction
integer<int64>
required

The estimated tax deduction in cents. Only calculated for BUSINESS trips; returns 0 for PERSONAL and UNREVIEWED trips.

created_at
string<date-time>
required

Timestamp when the trip was created

updated_at
string<date-time>
required

Timestamp when the trip was last updated

external_id
string | null

An optional external identifier for the trip, used for idempotency

start_address
string | null

The starting address of the trip

end_address
string | null

The ending address of the trip

description
string | null

An optional description or notes about the trip

deleted_at
string<date-time> | null

Timestamp when the trip was deleted, or null if not deleted