Update truck
Partially update a truck by ID in Alvys, changing only the fields you send, such as plates, status, weights, fuel profile, leases, or ELD links.
curl --request PATCH \
--url https://integrations.alvys.com/api/p/v{version}/trucks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--header 'If-Match: <if-match>' \
--data '
{
"TruckNum": "<string>",
"VinNumber": "<string>",
"Year": 123,
"Make": "<string>",
"Model": "<string>",
"LicenseNum": "<string>",
"LicenseState": "<string>",
"LicenseCountry": "<string>",
"LicenseExpirationDate": "2023-12-25",
"Status": "<string>",
"SubsidiaryId": "<string>",
"FleetId": "<string>",
"NumberOfAxles": 123,
"GrossWeight": {
"Value": 123
},
"EmptyWeight": {
"Value": 123
},
"Dimensions": {
"Height": {
"Value": 123
},
"Width": {
"Value": 123
},
"Length": {
"Value": 123
}
},
"GrossCombinationWeightRating": {
"Value": 123
},
"TireCount": 123,
"Color": "<string>",
"FuelType": "<string>",
"FuelProfile": {
"MpgLoaded": 123,
"MpgEmpty": 123,
"TankCapacity": {
"Value": 123
},
"TankCount": 123
},
"DeductToll": true,
"InsuranceCompany": "<string>",
"InsurancePolicyNumber": "<string>",
"InsuranceExpirationDate": "2023-12-25",
"InspectionExpirationDate": "2023-12-25",
"InsuranceValue": 123,
"LossPayee": "<string>",
"LeasedFrom": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"LeasedTo": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"StartDate": "2023-12-25",
"EndDate": "2023-12-25",
"OwnerOperatorId": "<string>",
"SteerTire": "<string>",
"DriveTire": "<string>",
"TollPasses": [
{
"PassType": "<string>",
"PassValue": "<string>"
}
],
"IftaEnrollments": [
{
"State": "<string>",
"Sticker": "<string>"
}
],
"EldProviders": [
{
"IntegrationType": "<string>",
"Id": "<string>",
"DatagateWayId": "<string>",
"SensorId": "<string>"
}
],
"References": [
{
"Id": "<string>",
"TenantReferenceId": "<string>",
"Value": "<string>"
}
]
}
'const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json-patch+json'
},
body: JSON.stringify({
TruckNum: '<string>',
VinNumber: '<string>',
Year: 123,
Make: '<string>',
Model: '<string>',
LicenseNum: '<string>',
LicenseState: '<string>',
LicenseCountry: '<string>',
LicenseExpirationDate: '2023-12-25',
Status: '<string>',
SubsidiaryId: '<string>',
FleetId: '<string>',
NumberOfAxles: 123,
GrossWeight: {Value: 123},
EmptyWeight: {Value: 123},
Dimensions: {Height: {Value: 123}, Width: {Value: 123}, Length: {Value: 123}},
GrossCombinationWeightRating: {Value: 123},
TireCount: 123,
Color: '<string>',
FuelType: '<string>',
FuelProfile: {MpgLoaded: 123, MpgEmpty: 123, TankCapacity: {Value: 123}, TankCount: 123},
DeductToll: true,
InsuranceCompany: '<string>',
InsurancePolicyNumber: '<string>',
InsuranceExpirationDate: '2023-12-25',
InspectionExpirationDate: '2023-12-25',
InsuranceValue: 123,
LossPayee: '<string>',
LeasedFrom: {
CompanyId: '<string>',
DriverName: '<string>',
StartDate: '2023-12-25',
EndDate: '2023-12-25'
},
LeasedTo: {
CompanyId: '<string>',
DriverName: '<string>',
StartDate: '2023-12-25',
EndDate: '2023-12-25'
},
StartDate: '2023-12-25',
EndDate: '2023-12-25',
OwnerOperatorId: '<string>',
SteerTire: '<string>',
DriveTire: '<string>',
TollPasses: [{PassType: '<string>', PassValue: '<string>'}],
IftaEnrollments: [{State: '<string>', Sticker: '<string>'}],
EldProviders: [
{
IntegrationType: '<string>',
Id: '<string>',
DatagateWayId: '<string>',
SensorId: '<string>'
}
],
References: [{Id: '<string>', TenantReferenceId: '<string>', Value: '<string>'}]
})
};
fetch('https://integrations.alvys.com/api/p/v{version}/trucks/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://integrations.alvys.com/api/p/v{version}/trucks/{id}"
payload = {
"TruckNum": "<string>",
"VinNumber": "<string>",
"Year": 123,
"Make": "<string>",
"Model": "<string>",
"LicenseNum": "<string>",
"LicenseState": "<string>",
"LicenseCountry": "<string>",
"LicenseExpirationDate": "2023-12-25",
"Status": "<string>",
"SubsidiaryId": "<string>",
"FleetId": "<string>",
"NumberOfAxles": 123,
"GrossWeight": { "Value": 123 },
"EmptyWeight": { "Value": 123 },
"Dimensions": {
"Height": { "Value": 123 },
"Width": { "Value": 123 },
"Length": { "Value": 123 }
},
"GrossCombinationWeightRating": { "Value": 123 },
"TireCount": 123,
"Color": "<string>",
"FuelType": "<string>",
"FuelProfile": {
"MpgLoaded": 123,
"MpgEmpty": 123,
"TankCapacity": { "Value": 123 },
"TankCount": 123
},
"DeductToll": True,
"InsuranceCompany": "<string>",
"InsurancePolicyNumber": "<string>",
"InsuranceExpirationDate": "2023-12-25",
"InspectionExpirationDate": "2023-12-25",
"InsuranceValue": 123,
"LossPayee": "<string>",
"LeasedFrom": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"LeasedTo": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"StartDate": "2023-12-25",
"EndDate": "2023-12-25",
"OwnerOperatorId": "<string>",
"SteerTire": "<string>",
"DriveTire": "<string>",
"TollPasses": [
{
"PassType": "<string>",
"PassValue": "<string>"
}
],
"IftaEnrollments": [
{
"State": "<string>",
"Sticker": "<string>"
}
],
"EldProviders": [
{
"IntegrationType": "<string>",
"Id": "<string>",
"DatagateWayId": "<string>",
"SensorId": "<string>"
}
],
"References": [
{
"Id": "<string>",
"TenantReferenceId": "<string>",
"Value": "<string>"
}
]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json-patch+json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://integrations.alvys.com/api/p/v{version}/trucks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'TruckNum' => '<string>',
'VinNumber' => '<string>',
'Year' => 123,
'Make' => '<string>',
'Model' => '<string>',
'LicenseNum' => '<string>',
'LicenseState' => '<string>',
'LicenseCountry' => '<string>',
'LicenseExpirationDate' => '2023-12-25',
'Status' => '<string>',
'SubsidiaryId' => '<string>',
'FleetId' => '<string>',
'NumberOfAxles' => 123,
'GrossWeight' => [
'Value' => 123
],
'EmptyWeight' => [
'Value' => 123
],
'Dimensions' => [
'Height' => [
'Value' => 123
],
'Width' => [
'Value' => 123
],
'Length' => [
'Value' => 123
]
],
'GrossCombinationWeightRating' => [
'Value' => 123
],
'TireCount' => 123,
'Color' => '<string>',
'FuelType' => '<string>',
'FuelProfile' => [
'MpgLoaded' => 123,
'MpgEmpty' => 123,
'TankCapacity' => [
'Value' => 123
],
'TankCount' => 123
],
'DeductToll' => true,
'InsuranceCompany' => '<string>',
'InsurancePolicyNumber' => '<string>',
'InsuranceExpirationDate' => '2023-12-25',
'InspectionExpirationDate' => '2023-12-25',
'InsuranceValue' => 123,
'LossPayee' => '<string>',
'LeasedFrom' => [
'CompanyId' => '<string>',
'DriverName' => '<string>',
'StartDate' => '2023-12-25',
'EndDate' => '2023-12-25'
],
'LeasedTo' => [
'CompanyId' => '<string>',
'DriverName' => '<string>',
'StartDate' => '2023-12-25',
'EndDate' => '2023-12-25'
],
'StartDate' => '2023-12-25',
'EndDate' => '2023-12-25',
'OwnerOperatorId' => '<string>',
'SteerTire' => '<string>',
'DriveTire' => '<string>',
'TollPasses' => [
[
'PassType' => '<string>',
'PassValue' => '<string>'
]
],
'IftaEnrollments' => [
[
'State' => '<string>',
'Sticker' => '<string>'
]
],
'EldProviders' => [
[
'IntegrationType' => '<string>',
'Id' => '<string>',
'DatagateWayId' => '<string>',
'SensorId' => '<string>'
]
],
'References' => [
[
'Id' => '<string>',
'TenantReferenceId' => '<string>',
'Value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json-patch+json",
"If-Match: <if-match>"
],
]);
$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://integrations.alvys.com/api/p/v{version}/trucks/{id}"
payload := strings.NewReader("{\n \"TruckNum\": \"<string>\",\n \"VinNumber\": \"<string>\",\n \"Year\": 123,\n \"Make\": \"<string>\",\n \"Model\": \"<string>\",\n \"LicenseNum\": \"<string>\",\n \"LicenseState\": \"<string>\",\n \"LicenseCountry\": \"<string>\",\n \"LicenseExpirationDate\": \"2023-12-25\",\n \"Status\": \"<string>\",\n \"SubsidiaryId\": \"<string>\",\n \"FleetId\": \"<string>\",\n \"NumberOfAxles\": 123,\n \"GrossWeight\": {\n \"Value\": 123\n },\n \"EmptyWeight\": {\n \"Value\": 123\n },\n \"Dimensions\": {\n \"Height\": {\n \"Value\": 123\n },\n \"Width\": {\n \"Value\": 123\n },\n \"Length\": {\n \"Value\": 123\n }\n },\n \"GrossCombinationWeightRating\": {\n \"Value\": 123\n },\n \"TireCount\": 123,\n \"Color\": \"<string>\",\n \"FuelType\": \"<string>\",\n \"FuelProfile\": {\n \"MpgLoaded\": 123,\n \"MpgEmpty\": 123,\n \"TankCapacity\": {\n \"Value\": 123\n },\n \"TankCount\": 123\n },\n \"DeductToll\": true,\n \"InsuranceCompany\": \"<string>\",\n \"InsurancePolicyNumber\": \"<string>\",\n \"InsuranceExpirationDate\": \"2023-12-25\",\n \"InspectionExpirationDate\": \"2023-12-25\",\n \"InsuranceValue\": 123,\n \"LossPayee\": \"<string>\",\n \"LeasedFrom\": {\n \"CompanyId\": \"<string>\",\n \"DriverName\": \"<string>\",\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\"\n },\n \"LeasedTo\": {\n \"CompanyId\": \"<string>\",\n \"DriverName\": \"<string>\",\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\"\n },\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\",\n \"OwnerOperatorId\": \"<string>\",\n \"SteerTire\": \"<string>\",\n \"DriveTire\": \"<string>\",\n \"TollPasses\": [\n {\n \"PassType\": \"<string>\",\n \"PassValue\": \"<string>\"\n }\n ],\n \"IftaEnrollments\": [\n {\n \"State\": \"<string>\",\n \"Sticker\": \"<string>\"\n }\n ],\n \"EldProviders\": [\n {\n \"IntegrationType\": \"<string>\",\n \"Id\": \"<string>\",\n \"DatagateWayId\": \"<string>\",\n \"SensorId\": \"<string>\"\n }\n ],\n \"References\": [\n {\n \"Id\": \"<string>\",\n \"TenantReferenceId\": \"<string>\",\n \"Value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json-patch+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://integrations.alvys.com/api/p/v{version}/trucks/{id}")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"TruckNum\": \"<string>\",\n \"VinNumber\": \"<string>\",\n \"Year\": 123,\n \"Make\": \"<string>\",\n \"Model\": \"<string>\",\n \"LicenseNum\": \"<string>\",\n \"LicenseState\": \"<string>\",\n \"LicenseCountry\": \"<string>\",\n \"LicenseExpirationDate\": \"2023-12-25\",\n \"Status\": \"<string>\",\n \"SubsidiaryId\": \"<string>\",\n \"FleetId\": \"<string>\",\n \"NumberOfAxles\": 123,\n \"GrossWeight\": {\n \"Value\": 123\n },\n \"EmptyWeight\": {\n \"Value\": 123\n },\n \"Dimensions\": {\n \"Height\": {\n \"Value\": 123\n },\n \"Width\": {\n \"Value\": 123\n },\n \"Length\": {\n \"Value\": 123\n }\n },\n \"GrossCombinationWeightRating\": {\n \"Value\": 123\n },\n \"TireCount\": 123,\n \"Color\": \"<string>\",\n \"FuelType\": \"<string>\",\n \"FuelProfile\": {\n \"MpgLoaded\": 123,\n \"MpgEmpty\": 123,\n \"TankCapacity\": {\n \"Value\": 123\n },\n \"TankCount\": 123\n },\n \"DeductToll\": true,\n \"InsuranceCompany\": \"<string>\",\n \"InsurancePolicyNumber\": \"<string>\",\n \"InsuranceExpirationDate\": \"2023-12-25\",\n \"InspectionExpirationDate\": \"2023-12-25\",\n \"InsuranceValue\": 123,\n \"LossPayee\": \"<string>\",\n \"LeasedFrom\": {\n \"CompanyId\": \"<string>\",\n \"DriverName\": \"<string>\",\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\"\n },\n \"LeasedTo\": {\n \"CompanyId\": \"<string>\",\n \"DriverName\": \"<string>\",\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\"\n },\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\",\n \"OwnerOperatorId\": \"<string>\",\n \"SteerTire\": \"<string>\",\n \"DriveTire\": \"<string>\",\n \"TollPasses\": [\n {\n \"PassType\": \"<string>\",\n \"PassValue\": \"<string>\"\n }\n ],\n \"IftaEnrollments\": [\n {\n \"State\": \"<string>\",\n \"Sticker\": \"<string>\"\n }\n ],\n \"EldProviders\": [\n {\n \"IntegrationType\": \"<string>\",\n \"Id\": \"<string>\",\n \"DatagateWayId\": \"<string>\",\n \"SensorId\": \"<string>\"\n }\n ],\n \"References\": [\n {\n \"Id\": \"<string>\",\n \"TenantReferenceId\": \"<string>\",\n \"Value\": \"<string>\"\n }\n ]\n}")
.asString();{
"Id": "<string>",
"TruckNum": "<string>",
"Status": "<string>",
"SubsidiaryId": "<string>",
"GrossWeight": {
"Value": 123,
"UnitOfMeasure": "Kilograms"
},
"EmptyWeight": {
"Value": 123,
"UnitOfMeasure": "Kilograms"
},
"FuelCards": [
{
"DeductFuel": true,
"ApplyFuelDiscount": true,
"id": "<string>",
"CardNumber": "<string>",
"Provider": "<string>",
"DeductFromId": "<string>",
"DeductFromName": "<string>",
"DeductFromSubsidiary": "<string>",
"DeductFromContractorType": "<string>",
"FuelTypeConfigs": [
{
"FuelType": "<string>",
"DeductFuel": true,
"FuelDiscounted": true
}
]
}
],
"Notes": [
{
"id": "<string>",
"Description": "<string>",
"NoteType": "<string>",
"User": "<string>",
"Time": "2023-11-07T05:31:56Z",
"UserId": "<string>"
}
],
"CreatedAt": "2023-11-07T05:31:56Z",
"VinNumber": "<string>",
"Year": 123,
"Make": "<string>",
"Model": "<string>",
"LicenseNum": "<string>",
"LicenseState": "<string>",
"LicenseCountry": "<string>",
"PlateExpirationDate": "2023-12-25",
"LicenseExpirationDate": "2023-12-25",
"NumberOfAxles": 123,
"Fleet": {
"Id": "<string>",
"Name": "<string>",
"InvoiceNumberPrefix": "<string>"
},
"Color": "<string>",
"FuelType": "<string>",
"InsuranceCompany": "<string>",
"InsurancePolicyNumber": "<string>",
"InsuranceExpirationDate": "2023-12-25",
"InspectionExpirationDate": "2023-12-25",
"References": [
{
"Name": "<string>",
"Value": "<string>",
"Id": "<string>",
"ReferenceId": "<string>",
"Type": "<string>",
"Access": "<string>",
"Origin": "<string>"
}
],
"DeductToll": true,
"InsuranceValue": 123,
"LossPayee": "<string>",
"LeasedFrom": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"LeasedTo": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"StartDate": "2023-12-25",
"EndDate": "2023-12-25",
"Dimensions": {
"Height": {
"Value": 123,
"Unit": "Feet"
},
"Width": {
"Value": 123,
"Unit": "Feet"
},
"Length": {
"Value": 123,
"Unit": "Feet"
}
},
"GrossCombinationWeightRating": {
"Value": 123,
"UnitOfMeasure": "Kilograms"
},
"TireCount": 123,
"FuelProfile": {
"MpgLoaded": 123,
"MpgEmpty": 123,
"TankCapacity": {
"Value": 123,
"UnitOfMeasure": "Gallons"
},
"TankCount": 123,
"FuelKind": "Diesel"
}
}{
"Errors": {},
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}truck:update scope. See Authentication.If-Match is required
This endpoint uses optimistic concurrency. Send the truck’s currentETag in the If-Match header. The ETag response header of Get truck, Create truck, and every successful update carries it.
- If you omit
If-Match, the request is rejected with428 Precondition Required. - If the truck changed after you read it, the request is rejected with
412 Precondition Failed. Get the truck again and retry with the newETag.
Fields that are replaced whole
Dimensions, FuelProfile, TollPasses, IftaEnrollments, EldProviders, and References are replaced whole: send the complete value you want stored. For the four arrays, null clears the list.
- EldProviders: moving the truck off an ELD link stops its location updates from that provider. Omit
SensorId, or sendnull, to keep the sensor id stored on the same link. - References: include the
Idof each reference already on the truck that you want to keep or edit. OmitIdfor a new reference. A reference identical to one already stored is kept as it is.
Truck number and VIN must stay unique
If you changeTruckNum or VinNumber to a value another truck in your company already has, the request is rejected with 409 Conflict. The problem type is https://api.alvys.com/errors/Conflict/DuplicateAssetNumber for the truck number and https://api.alvys.com/errors/Conflict/DuplicateVin for the VIN.
Status and owner operator
Status is shown in the dispatch planner. It does not by itself block dispatch. A maintenance work order started in Alvys moves the truck to In Shop, and back to Active when the work order completes, so a status you write can be overwritten.
OwnerOperatorId set to null unassigns the truck: it goes back to the carrier of its subsidiary. Fuel cards with Deduct Fuel follow the change in the same write. They stop deducting when the truck leaves its owner operator, and deduct from the new owner operator when the truck moves to one.
Request parameters
The following parameters are required in the URL path:| Parameter | Type | Required | Description |
|---|---|---|---|
| version | String | Yes | The version of the API. |
| id | String | Yes | The unique identifier of the truck. |
| Header | Required | Description |
|---|---|---|
| If-Match | Yes | The current ETag of the truck being updated. |
Request body
All fields are optional. The fields are the same as in Create truck, with these differences:| Field | Type | Description |
|---|---|---|
| TruckNum | String | The new truck number. Must be unique among your company’s trucks. |
| SubsidiaryId | String | A subsidiary that your credential may write to. |
| Status | String | One of Active, Planned, Temporary, Repair, In Shop, Leased Out, Crashed, Inactive (case-insensitive). No default. |
| StartDate / EndDate | String (Date) | EndDate cannot be before StartDate. |
| References.Id | String | The id of a reference already on the truck, to keep or edit it. Omit for a new reference. |
Example cURL request
curl --location --request PATCH 'https://integrations.alvys.com/api/p/v1/trucks/TL100000000000000417' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--header 'If-Match: "00000000-0000-0000-0000-000000000001"' \
--data-raw '{
"LicenseNum": "XYZ9876",
"LicenseExpirationDate": "2028-03-31",
"TollPasses": [
{ "PassType": "E-ZPass", "PassValue": "0001234567" },
{ "PassType": "PrePass", "PassValue": "PP-000417" }
]
}'
YOUR_ACCESS_TOKEN with your actual Bearer token and the If-Match value with the truck’s current ETag.
Response fields
A successful request returns200 OK with the updated truck, in the same shape as Get truck. The new ETag is in the ETag response header.
Status codes
| Status | Meaning |
|---|---|
| 200 | The truck was updated. |
| 400 | The request body failed validation. The response lists the invalid fields. |
| 401 | The request was not authenticated. |
| 403 | The caller lacks the truck:update scope. |
| 404 | No company-owned truck with the given id exists in the subsidiaries your credential can access. |
| 409 | Another truck in your company has the same TruckNum (DuplicateAssetNumber) or VinNumber (DuplicateVin). |
| 412 | The If-Match value did not match the current truck. Get the truck again and retry. |
| 422 | A referenced record is not usable. See Why a request is refused with 422. |
| 428 | The If-Match header is missing. |
| 429 | The rate limit was exceeded. |
Why a request is refused with 422
The problemtype is https://api.alvys.com/errors/UnprocessableEntity/ followed by the reason:
| Reason | Cause |
|---|---|
SubsidiaryNotInScope | SubsidiaryId is not a subsidiary that this credential may write to. |
FleetNotFound | FleetId is not an active fleet of your account. |
LeaseCompanyNotFound | LeasedFrom.CompanyId or LeasedTo.CompanyId is not a company in your account. |
OwnerOperatorNotFound | OwnerOperatorId is not a driver in your account with contractor type Owner Operator. |
ReferenceDefinitionNotFound | A References.TenantReferenceId is not a truck reference definition of your account. |
Rate limits
All endpoints are subject to rate limits to protect the API from traffic spikes. For detailed information on rate limits, please refer to the Rate Limits section. This page is interactive, allowing you to try a request by completing the fields for the parameters below. As you fill out the parameters, the CURL command on the right side of the page will be automatically updated.Authorizations
OAuth 2.0 client-credentials access token. Obtain one from https://auth.alvys.com/oauth/token (grant_type=client_credentials, audience=https://api.alvys.com/public/), then paste it here. The playground sends it as Authorization: Bearer <token>.
Headers
Body
One of Active, Planned, Temporary, Repair, In Shop, Leased Out, Crashed, Inactive (case-insensitive). Shown in the dispatch planner; does not by itself block dispatch. In Shop and Active are also written by the maintenance work-order sync. Crashed and Inactive remove the truck from the ELD live map and from truck pickers. A maintenance work order started in Alvys moves the truck to In Shop and back to Active on its own.
Driver id of the owner operator the asset belongs to ("Assigned to Owner Operator" in the app). The driver must exist in your account with contractor type Owner Operator. null unassigns the asset: it goes back to its subsidiary's carrier. On a truck, fuel cards with Deduct Fuel follow the change in the same write: they stop deducting when the truck leaves its owner operator, and deduct from the new one when it moves.
Response
OK
curl --request PATCH \
--url https://integrations.alvys.com/api/p/v{version}/trucks/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--header 'If-Match: <if-match>' \
--data '
{
"TruckNum": "<string>",
"VinNumber": "<string>",
"Year": 123,
"Make": "<string>",
"Model": "<string>",
"LicenseNum": "<string>",
"LicenseState": "<string>",
"LicenseCountry": "<string>",
"LicenseExpirationDate": "2023-12-25",
"Status": "<string>",
"SubsidiaryId": "<string>",
"FleetId": "<string>",
"NumberOfAxles": 123,
"GrossWeight": {
"Value": 123
},
"EmptyWeight": {
"Value": 123
},
"Dimensions": {
"Height": {
"Value": 123
},
"Width": {
"Value": 123
},
"Length": {
"Value": 123
}
},
"GrossCombinationWeightRating": {
"Value": 123
},
"TireCount": 123,
"Color": "<string>",
"FuelType": "<string>",
"FuelProfile": {
"MpgLoaded": 123,
"MpgEmpty": 123,
"TankCapacity": {
"Value": 123
},
"TankCount": 123
},
"DeductToll": true,
"InsuranceCompany": "<string>",
"InsurancePolicyNumber": "<string>",
"InsuranceExpirationDate": "2023-12-25",
"InspectionExpirationDate": "2023-12-25",
"InsuranceValue": 123,
"LossPayee": "<string>",
"LeasedFrom": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"LeasedTo": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"StartDate": "2023-12-25",
"EndDate": "2023-12-25",
"OwnerOperatorId": "<string>",
"SteerTire": "<string>",
"DriveTire": "<string>",
"TollPasses": [
{
"PassType": "<string>",
"PassValue": "<string>"
}
],
"IftaEnrollments": [
{
"State": "<string>",
"Sticker": "<string>"
}
],
"EldProviders": [
{
"IntegrationType": "<string>",
"Id": "<string>",
"DatagateWayId": "<string>",
"SensorId": "<string>"
}
],
"References": [
{
"Id": "<string>",
"TenantReferenceId": "<string>",
"Value": "<string>"
}
]
}
'const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json-patch+json'
},
body: JSON.stringify({
TruckNum: '<string>',
VinNumber: '<string>',
Year: 123,
Make: '<string>',
Model: '<string>',
LicenseNum: '<string>',
LicenseState: '<string>',
LicenseCountry: '<string>',
LicenseExpirationDate: '2023-12-25',
Status: '<string>',
SubsidiaryId: '<string>',
FleetId: '<string>',
NumberOfAxles: 123,
GrossWeight: {Value: 123},
EmptyWeight: {Value: 123},
Dimensions: {Height: {Value: 123}, Width: {Value: 123}, Length: {Value: 123}},
GrossCombinationWeightRating: {Value: 123},
TireCount: 123,
Color: '<string>',
FuelType: '<string>',
FuelProfile: {MpgLoaded: 123, MpgEmpty: 123, TankCapacity: {Value: 123}, TankCount: 123},
DeductToll: true,
InsuranceCompany: '<string>',
InsurancePolicyNumber: '<string>',
InsuranceExpirationDate: '2023-12-25',
InspectionExpirationDate: '2023-12-25',
InsuranceValue: 123,
LossPayee: '<string>',
LeasedFrom: {
CompanyId: '<string>',
DriverName: '<string>',
StartDate: '2023-12-25',
EndDate: '2023-12-25'
},
LeasedTo: {
CompanyId: '<string>',
DriverName: '<string>',
StartDate: '2023-12-25',
EndDate: '2023-12-25'
},
StartDate: '2023-12-25',
EndDate: '2023-12-25',
OwnerOperatorId: '<string>',
SteerTire: '<string>',
DriveTire: '<string>',
TollPasses: [{PassType: '<string>', PassValue: '<string>'}],
IftaEnrollments: [{State: '<string>', Sticker: '<string>'}],
EldProviders: [
{
IntegrationType: '<string>',
Id: '<string>',
DatagateWayId: '<string>',
SensorId: '<string>'
}
],
References: [{Id: '<string>', TenantReferenceId: '<string>', Value: '<string>'}]
})
};
fetch('https://integrations.alvys.com/api/p/v{version}/trucks/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://integrations.alvys.com/api/p/v{version}/trucks/{id}"
payload = {
"TruckNum": "<string>",
"VinNumber": "<string>",
"Year": 123,
"Make": "<string>",
"Model": "<string>",
"LicenseNum": "<string>",
"LicenseState": "<string>",
"LicenseCountry": "<string>",
"LicenseExpirationDate": "2023-12-25",
"Status": "<string>",
"SubsidiaryId": "<string>",
"FleetId": "<string>",
"NumberOfAxles": 123,
"GrossWeight": { "Value": 123 },
"EmptyWeight": { "Value": 123 },
"Dimensions": {
"Height": { "Value": 123 },
"Width": { "Value": 123 },
"Length": { "Value": 123 }
},
"GrossCombinationWeightRating": { "Value": 123 },
"TireCount": 123,
"Color": "<string>",
"FuelType": "<string>",
"FuelProfile": {
"MpgLoaded": 123,
"MpgEmpty": 123,
"TankCapacity": { "Value": 123 },
"TankCount": 123
},
"DeductToll": True,
"InsuranceCompany": "<string>",
"InsurancePolicyNumber": "<string>",
"InsuranceExpirationDate": "2023-12-25",
"InspectionExpirationDate": "2023-12-25",
"InsuranceValue": 123,
"LossPayee": "<string>",
"LeasedFrom": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"LeasedTo": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"StartDate": "2023-12-25",
"EndDate": "2023-12-25",
"OwnerOperatorId": "<string>",
"SteerTire": "<string>",
"DriveTire": "<string>",
"TollPasses": [
{
"PassType": "<string>",
"PassValue": "<string>"
}
],
"IftaEnrollments": [
{
"State": "<string>",
"Sticker": "<string>"
}
],
"EldProviders": [
{
"IntegrationType": "<string>",
"Id": "<string>",
"DatagateWayId": "<string>",
"SensorId": "<string>"
}
],
"References": [
{
"Id": "<string>",
"TenantReferenceId": "<string>",
"Value": "<string>"
}
]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json-patch+json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://integrations.alvys.com/api/p/v{version}/trucks/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'TruckNum' => '<string>',
'VinNumber' => '<string>',
'Year' => 123,
'Make' => '<string>',
'Model' => '<string>',
'LicenseNum' => '<string>',
'LicenseState' => '<string>',
'LicenseCountry' => '<string>',
'LicenseExpirationDate' => '2023-12-25',
'Status' => '<string>',
'SubsidiaryId' => '<string>',
'FleetId' => '<string>',
'NumberOfAxles' => 123,
'GrossWeight' => [
'Value' => 123
],
'EmptyWeight' => [
'Value' => 123
],
'Dimensions' => [
'Height' => [
'Value' => 123
],
'Width' => [
'Value' => 123
],
'Length' => [
'Value' => 123
]
],
'GrossCombinationWeightRating' => [
'Value' => 123
],
'TireCount' => 123,
'Color' => '<string>',
'FuelType' => '<string>',
'FuelProfile' => [
'MpgLoaded' => 123,
'MpgEmpty' => 123,
'TankCapacity' => [
'Value' => 123
],
'TankCount' => 123
],
'DeductToll' => true,
'InsuranceCompany' => '<string>',
'InsurancePolicyNumber' => '<string>',
'InsuranceExpirationDate' => '2023-12-25',
'InspectionExpirationDate' => '2023-12-25',
'InsuranceValue' => 123,
'LossPayee' => '<string>',
'LeasedFrom' => [
'CompanyId' => '<string>',
'DriverName' => '<string>',
'StartDate' => '2023-12-25',
'EndDate' => '2023-12-25'
],
'LeasedTo' => [
'CompanyId' => '<string>',
'DriverName' => '<string>',
'StartDate' => '2023-12-25',
'EndDate' => '2023-12-25'
],
'StartDate' => '2023-12-25',
'EndDate' => '2023-12-25',
'OwnerOperatorId' => '<string>',
'SteerTire' => '<string>',
'DriveTire' => '<string>',
'TollPasses' => [
[
'PassType' => '<string>',
'PassValue' => '<string>'
]
],
'IftaEnrollments' => [
[
'State' => '<string>',
'Sticker' => '<string>'
]
],
'EldProviders' => [
[
'IntegrationType' => '<string>',
'Id' => '<string>',
'DatagateWayId' => '<string>',
'SensorId' => '<string>'
]
],
'References' => [
[
'Id' => '<string>',
'TenantReferenceId' => '<string>',
'Value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json-patch+json",
"If-Match: <if-match>"
],
]);
$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://integrations.alvys.com/api/p/v{version}/trucks/{id}"
payload := strings.NewReader("{\n \"TruckNum\": \"<string>\",\n \"VinNumber\": \"<string>\",\n \"Year\": 123,\n \"Make\": \"<string>\",\n \"Model\": \"<string>\",\n \"LicenseNum\": \"<string>\",\n \"LicenseState\": \"<string>\",\n \"LicenseCountry\": \"<string>\",\n \"LicenseExpirationDate\": \"2023-12-25\",\n \"Status\": \"<string>\",\n \"SubsidiaryId\": \"<string>\",\n \"FleetId\": \"<string>\",\n \"NumberOfAxles\": 123,\n \"GrossWeight\": {\n \"Value\": 123\n },\n \"EmptyWeight\": {\n \"Value\": 123\n },\n \"Dimensions\": {\n \"Height\": {\n \"Value\": 123\n },\n \"Width\": {\n \"Value\": 123\n },\n \"Length\": {\n \"Value\": 123\n }\n },\n \"GrossCombinationWeightRating\": {\n \"Value\": 123\n },\n \"TireCount\": 123,\n \"Color\": \"<string>\",\n \"FuelType\": \"<string>\",\n \"FuelProfile\": {\n \"MpgLoaded\": 123,\n \"MpgEmpty\": 123,\n \"TankCapacity\": {\n \"Value\": 123\n },\n \"TankCount\": 123\n },\n \"DeductToll\": true,\n \"InsuranceCompany\": \"<string>\",\n \"InsurancePolicyNumber\": \"<string>\",\n \"InsuranceExpirationDate\": \"2023-12-25\",\n \"InspectionExpirationDate\": \"2023-12-25\",\n \"InsuranceValue\": 123,\n \"LossPayee\": \"<string>\",\n \"LeasedFrom\": {\n \"CompanyId\": \"<string>\",\n \"DriverName\": \"<string>\",\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\"\n },\n \"LeasedTo\": {\n \"CompanyId\": \"<string>\",\n \"DriverName\": \"<string>\",\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\"\n },\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\",\n \"OwnerOperatorId\": \"<string>\",\n \"SteerTire\": \"<string>\",\n \"DriveTire\": \"<string>\",\n \"TollPasses\": [\n {\n \"PassType\": \"<string>\",\n \"PassValue\": \"<string>\"\n }\n ],\n \"IftaEnrollments\": [\n {\n \"State\": \"<string>\",\n \"Sticker\": \"<string>\"\n }\n ],\n \"EldProviders\": [\n {\n \"IntegrationType\": \"<string>\",\n \"Id\": \"<string>\",\n \"DatagateWayId\": \"<string>\",\n \"SensorId\": \"<string>\"\n }\n ],\n \"References\": [\n {\n \"Id\": \"<string>\",\n \"TenantReferenceId\": \"<string>\",\n \"Value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json-patch+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://integrations.alvys.com/api/p/v{version}/trucks/{id}")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"TruckNum\": \"<string>\",\n \"VinNumber\": \"<string>\",\n \"Year\": 123,\n \"Make\": \"<string>\",\n \"Model\": \"<string>\",\n \"LicenseNum\": \"<string>\",\n \"LicenseState\": \"<string>\",\n \"LicenseCountry\": \"<string>\",\n \"LicenseExpirationDate\": \"2023-12-25\",\n \"Status\": \"<string>\",\n \"SubsidiaryId\": \"<string>\",\n \"FleetId\": \"<string>\",\n \"NumberOfAxles\": 123,\n \"GrossWeight\": {\n \"Value\": 123\n },\n \"EmptyWeight\": {\n \"Value\": 123\n },\n \"Dimensions\": {\n \"Height\": {\n \"Value\": 123\n },\n \"Width\": {\n \"Value\": 123\n },\n \"Length\": {\n \"Value\": 123\n }\n },\n \"GrossCombinationWeightRating\": {\n \"Value\": 123\n },\n \"TireCount\": 123,\n \"Color\": \"<string>\",\n \"FuelType\": \"<string>\",\n \"FuelProfile\": {\n \"MpgLoaded\": 123,\n \"MpgEmpty\": 123,\n \"TankCapacity\": {\n \"Value\": 123\n },\n \"TankCount\": 123\n },\n \"DeductToll\": true,\n \"InsuranceCompany\": \"<string>\",\n \"InsurancePolicyNumber\": \"<string>\",\n \"InsuranceExpirationDate\": \"2023-12-25\",\n \"InspectionExpirationDate\": \"2023-12-25\",\n \"InsuranceValue\": 123,\n \"LossPayee\": \"<string>\",\n \"LeasedFrom\": {\n \"CompanyId\": \"<string>\",\n \"DriverName\": \"<string>\",\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\"\n },\n \"LeasedTo\": {\n \"CompanyId\": \"<string>\",\n \"DriverName\": \"<string>\",\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\"\n },\n \"StartDate\": \"2023-12-25\",\n \"EndDate\": \"2023-12-25\",\n \"OwnerOperatorId\": \"<string>\",\n \"SteerTire\": \"<string>\",\n \"DriveTire\": \"<string>\",\n \"TollPasses\": [\n {\n \"PassType\": \"<string>\",\n \"PassValue\": \"<string>\"\n }\n ],\n \"IftaEnrollments\": [\n {\n \"State\": \"<string>\",\n \"Sticker\": \"<string>\"\n }\n ],\n \"EldProviders\": [\n {\n \"IntegrationType\": \"<string>\",\n \"Id\": \"<string>\",\n \"DatagateWayId\": \"<string>\",\n \"SensorId\": \"<string>\"\n }\n ],\n \"References\": [\n {\n \"Id\": \"<string>\",\n \"TenantReferenceId\": \"<string>\",\n \"Value\": \"<string>\"\n }\n ]\n}")
.asString();{
"Id": "<string>",
"TruckNum": "<string>",
"Status": "<string>",
"SubsidiaryId": "<string>",
"GrossWeight": {
"Value": 123,
"UnitOfMeasure": "Kilograms"
},
"EmptyWeight": {
"Value": 123,
"UnitOfMeasure": "Kilograms"
},
"FuelCards": [
{
"DeductFuel": true,
"ApplyFuelDiscount": true,
"id": "<string>",
"CardNumber": "<string>",
"Provider": "<string>",
"DeductFromId": "<string>",
"DeductFromName": "<string>",
"DeductFromSubsidiary": "<string>",
"DeductFromContractorType": "<string>",
"FuelTypeConfigs": [
{
"FuelType": "<string>",
"DeductFuel": true,
"FuelDiscounted": true
}
]
}
],
"Notes": [
{
"id": "<string>",
"Description": "<string>",
"NoteType": "<string>",
"User": "<string>",
"Time": "2023-11-07T05:31:56Z",
"UserId": "<string>"
}
],
"CreatedAt": "2023-11-07T05:31:56Z",
"VinNumber": "<string>",
"Year": 123,
"Make": "<string>",
"Model": "<string>",
"LicenseNum": "<string>",
"LicenseState": "<string>",
"LicenseCountry": "<string>",
"PlateExpirationDate": "2023-12-25",
"LicenseExpirationDate": "2023-12-25",
"NumberOfAxles": 123,
"Fleet": {
"Id": "<string>",
"Name": "<string>",
"InvoiceNumberPrefix": "<string>"
},
"Color": "<string>",
"FuelType": "<string>",
"InsuranceCompany": "<string>",
"InsurancePolicyNumber": "<string>",
"InsuranceExpirationDate": "2023-12-25",
"InspectionExpirationDate": "2023-12-25",
"References": [
{
"Name": "<string>",
"Value": "<string>",
"Id": "<string>",
"ReferenceId": "<string>",
"Type": "<string>",
"Access": "<string>",
"Origin": "<string>"
}
],
"DeductToll": true,
"InsuranceValue": 123,
"LossPayee": "<string>",
"LeasedFrom": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"LeasedTo": {
"CompanyId": "<string>",
"DriverName": "<string>",
"StartDate": "2023-12-25",
"EndDate": "2023-12-25"
},
"StartDate": "2023-12-25",
"EndDate": "2023-12-25",
"Dimensions": {
"Height": {
"Value": 123,
"Unit": "Feet"
},
"Width": {
"Value": 123,
"Unit": "Feet"
},
"Length": {
"Value": 123,
"Unit": "Feet"
}
},
"GrossCombinationWeightRating": {
"Value": 123,
"UnitOfMeasure": "Kilograms"
},
"TireCount": 123,
"FuelProfile": {
"MpgLoaded": 123,
"MpgEmpty": 123,
"TankCapacity": {
"Value": 123,
"UnitOfMeasure": "Gallons"
},
"TankCount": 123,
"FuelKind": "Diesel"
}
}{
"Errors": {},
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}