Create trailer event
Schedule an event that blocks a trailer in the dispatch planner for a time window, such as a repair or other shop time, safely retryable with ExternalId.
curl --request POST \
--url https://integrations.alvys.com/api/p/v{version}/trailers/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--data '
{
"TrailerId": "<string>",
"EventType": "<string>",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"Address": {
"Street": "<string>",
"City": "<string>",
"State": "<string>",
"ZipCode": "<string>",
"Country": "<string>"
},
"Description": "<string>",
"ExternalId": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json-patch+json'},
body: JSON.stringify({
TrailerId: '<string>',
EventType: '<string>',
StartDate: '2023-11-07T05:31:56Z',
EndDate: '2023-11-07T05:31:56Z',
Address: {
Street: '<string>',
City: '<string>',
State: '<string>',
ZipCode: '<string>',
Country: '<string>'
},
Description: '<string>',
ExternalId: '<string>'
})
};
fetch('https://integrations.alvys.com/api/p/v{version}/trailers/events', 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}/trailers/events"
payload = {
"TrailerId": "<string>",
"EventType": "<string>",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"Address": {
"Street": "<string>",
"City": "<string>",
"State": "<string>",
"ZipCode": "<string>",
"Country": "<string>"
},
"Description": "<string>",
"ExternalId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json-patch+json"
}
response = requests.post(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}/trailers/events",
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([
'TrailerId' => '<string>',
'EventType' => '<string>',
'StartDate' => '2023-11-07T05:31:56Z',
'EndDate' => '2023-11-07T05:31:56Z',
'Address' => [
'Street' => '<string>',
'City' => '<string>',
'State' => '<string>',
'ZipCode' => '<string>',
'Country' => '<string>'
],
'Description' => '<string>',
'ExternalId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json-patch+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://integrations.alvys.com/api/p/v{version}/trailers/events"
payload := strings.NewReader("{\n \"TrailerId\": \"<string>\",\n \"EventType\": \"<string>\",\n \"StartDate\": \"2023-11-07T05:31:56Z\",\n \"EndDate\": \"2023-11-07T05:31:56Z\",\n \"Address\": {\n \"Street\": \"<string>\",\n \"City\": \"<string>\",\n \"State\": \"<string>\",\n \"ZipCode\": \"<string>\",\n \"Country\": \"<string>\"\n },\n \"Description\": \"<string>\",\n \"ExternalId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://integrations.alvys.com/api/p/v{version}/trailers/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"TrailerId\": \"<string>\",\n \"EventType\": \"<string>\",\n \"StartDate\": \"2023-11-07T05:31:56Z\",\n \"EndDate\": \"2023-11-07T05:31:56Z\",\n \"Address\": {\n \"Street\": \"<string>\",\n \"City\": \"<string>\",\n \"State\": \"<string>\",\n \"ZipCode\": \"<string>\",\n \"Country\": \"<string>\"\n },\n \"Description\": \"<string>\",\n \"ExternalId\": \"<string>\"\n}")
.asString();{
"Id": "<string>",
"TrailerId": "<string>",
"Title": "<string>",
"EventType": "<string>",
"Description": "<string>",
"CreatedAt": "2023-11-07T05:31:56Z",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"Address": {
"Street": "<string>",
"City": "<string>",
"State": "<string>",
"ZipCode": "<string>",
"Country": "<string>"
},
"CreatedBy": "<string>",
"ExternalId": "<string>"
}{
"Id": "<string>",
"TrailerId": "<string>",
"Title": "<string>",
"EventType": "<string>",
"Description": "<string>",
"CreatedAt": "2023-11-07T05:31:56Z",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"Address": {
"Street": "<string>",
"City": "<string>",
"State": "<string>",
"ZipCode": "<string>",
"Country": "<string>"
},
"CreatedBy": "<string>",
"ExternalId": "<string>"
}{
"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>"
}ETag response header. Send that value in the If-Match header of a later Update trailer event or Delete trailer event request. For more information on how versioning works and how to include it in your requests, please refer to the Versioning page.
trailer:update scope. See Authentication.Trailer
TrailerId is the Alvys id of the trailer, as returned by Search trailers. It starts with TL; an id that does not is rejected with 400 Bad Request. If the trailer does not exist in your account, or it belongs to a subsidiary your credential cannot access, the request is rejected with 404 Not Found. The trailer cannot be changed after the event is created.
Title is set by Alvys to the trailer number, the same as on an event created in Alvys.
Event type
EventType is one of WorkOrder, Repair, Other (case-insensitive). Any other value is rejected with 400 Bad Request, and the message lists the allowed values.
Dates are local time at the event address
StartDate and EndDate are wall-clock times at the event Address, not instants. Send them with a zero UTC offset (Z), and write the local time you mean: 2026-12-08T08:00:00Z on a Dallas address means 8:00 AM in Dallas. A value with any other offset, such as -06:00, is rejected with 400 Bad Request, because the offset would be dropped and the event would block a different time than you asked for. StartDate must be before EndDate.
The address must be locatable
Street, City, State and ZipCode are required. Alvys looks the address up to find its time zone, which is what anchors the dates. If the address cannot be found, the request is rejected with 422 Unprocessable Entity and the problem type https://api.alvys.com/errors/UnprocessableEntity/AssetEventAddressNotGeocodable. An event without a location would not block anything in the dispatch planner, so it is refused instead of saved.
Retry safely with ExternalId
ExternalId is your own unique id for the event, such as your shop’s repair order number. Send the same value when you retry a request, for example after a timeout. If this trailer already has an event with that ExternalId, it is returned with 200 OK and no second event is created. Without ExternalId, a retry creates another event.
- Matching ignores case and surrounding spaces.
ExternalIdis unique across all driver, truck and trailer events in your account. If it is already used by an event of another asset, the request is rejected with409 Conflictand the problemtypehttps://api.alvys.com/errors/Conflict/ExternalIdInUse. Make the id specific to the asset and the event, not only to a date.- The check protects a retry that follows the first request. Two requests with the same
ExternalIdsent at exactly the same time can both create an event.
Request parameters
The following parameter is required in the URL path:| Parameter | Type | Required | Description |
|---|---|---|---|
| version | String | Yes | The version of the API. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| TrailerId | String | Yes | The Alvys id of the trailer. Starts with TL. |
| EventType | String | Yes | One of WorkOrder, Repair, Other (case-insensitive). |
| StartDate | String (Date-Time) | Yes | When the event starts, as local time at the address, sent with a Z offset. |
| EndDate | String (Date-Time) | Yes | When the event ends, as local time at the address, sent with a Z offset. Must be after StartDate. |
| Address | Object | Yes | Where the trailer is during the event. Must be specific enough to locate. |
| Address.Street | String | Yes | The street address. |
| Address.City | String | Yes | The city. |
| Address.State | String | Yes | The state or province. |
| Address.ZipCode | String | Yes | The ZIP or postal code. |
| Address.Country | String | No | The country. |
| Description | String | No | Free-form notes. Up to 2,000 characters. |
| ExternalId | String | No | Your own unique id for the event, used to make retries safe. Up to 100 characters. |
Example cURL request
curl --location 'https://integrations.alvys.com/api/p/v1/trailers/events' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"TrailerId": "TL1000000000000233",
"EventType": "Repair",
"StartDate": "2026-12-08T08:00:00Z",
"EndDate": "2026-12-10T17:00:00Z",
"Address": {
"Street": "4500 Industrial Pkwy",
"City": "Dallas",
"State": "TX",
"ZipCode": "75247"
},
"Description": "Reefer unit service",
"ExternalId": "shop-ro-77940"
}'
YOUR_ACCESS_TOKEN with your actual Bearer token.
Response fields
A successful request returns the event. Its currentETag is in the ETag response header.
| Field | Type | Description |
|---|---|---|
| Id | String | The unique identifier of the event. |
| TrailerId | String | The id of the trailer the event belongs to. |
| Title | String | The trailer number, set by Alvys. |
| EventType | String | One of WorkOrder, Repair, Other. |
| Description | String | Free-form notes. |
| StartDate | String (Date-Time) | When the event starts, as local time at the event address. |
| EndDate | String (Date-Time) | When the event ends, as local time at the event address. |
| Address | Object | The event address, with Street, City, State, ZipCode and Country. |
| ExternalId | String | The ExternalId sent when the event was created, if any. |
| CreatedBy | String | Who created the event. |
| CreatedAt | String (Date-Time) | When the event was created. |
Example response
201 Created{
"Id": "3c9a7e10-0000-0000-0000-000000000042",
"TrailerId": "TL1000000000000233",
"Title": "53-233",
"EventType": "Repair",
"Description": "Reefer unit service",
"StartDate": "2026-12-08T08:00:00Z",
"EndDate": "2026-12-10T17:00:00Z",
"Address": {
"Street": "4500 Industrial Pkwy",
"City": "Dallas",
"State": "TX",
"ZipCode": "75247",
"Country": "US"
},
"ExternalId": "shop-ro-77940",
"CreatedAt": "2026-11-30T15:04:05.000Z"
}
Status codes
| Status | Meaning |
|---|---|
| 201 | The event was created. |
| 200 | This trailer already had an event with this ExternalId. It is returned and nothing new was created. |
| 400 | The request body failed validation. The response lists the invalid fields. |
| 401 | The request was not authenticated. |
| 403 | The caller lacks the trailer:update scope. |
| 404 | The trailer does not exist in your account or is outside the subsidiaries your credential can access. |
| 409 | The ExternalId is already used by an event of another asset (ExternalIdInUse). |
| 422 | The address could not be located (AssetEventAddressNotGeocodable). |
| 429 | The rate limit was exceeded. |
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>.
Body
Your own unique id for this event, used as an idempotency key. Send the same value if the step runs again and Alvys returns the event the first call created instead of scheduling a second one. Leave blank and a re-run creates another event. Matched case-insensitively and ignoring surrounding whitespace. The check is read-then-insert, so it protects a sequential retry (the normal case, a retry after a timeout) but two genuinely simultaneous requests carrying the same id can both miss it.
Response
OK
curl --request POST \
--url https://integrations.alvys.com/api/p/v{version}/trailers/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--data '
{
"TrailerId": "<string>",
"EventType": "<string>",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"Address": {
"Street": "<string>",
"City": "<string>",
"State": "<string>",
"ZipCode": "<string>",
"Country": "<string>"
},
"Description": "<string>",
"ExternalId": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json-patch+json'},
body: JSON.stringify({
TrailerId: '<string>',
EventType: '<string>',
StartDate: '2023-11-07T05:31:56Z',
EndDate: '2023-11-07T05:31:56Z',
Address: {
Street: '<string>',
City: '<string>',
State: '<string>',
ZipCode: '<string>',
Country: '<string>'
},
Description: '<string>',
ExternalId: '<string>'
})
};
fetch('https://integrations.alvys.com/api/p/v{version}/trailers/events', 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}/trailers/events"
payload = {
"TrailerId": "<string>",
"EventType": "<string>",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"Address": {
"Street": "<string>",
"City": "<string>",
"State": "<string>",
"ZipCode": "<string>",
"Country": "<string>"
},
"Description": "<string>",
"ExternalId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json-patch+json"
}
response = requests.post(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}/trailers/events",
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([
'TrailerId' => '<string>',
'EventType' => '<string>',
'StartDate' => '2023-11-07T05:31:56Z',
'EndDate' => '2023-11-07T05:31:56Z',
'Address' => [
'Street' => '<string>',
'City' => '<string>',
'State' => '<string>',
'ZipCode' => '<string>',
'Country' => '<string>'
],
'Description' => '<string>',
'ExternalId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json-patch+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://integrations.alvys.com/api/p/v{version}/trailers/events"
payload := strings.NewReader("{\n \"TrailerId\": \"<string>\",\n \"EventType\": \"<string>\",\n \"StartDate\": \"2023-11-07T05:31:56Z\",\n \"EndDate\": \"2023-11-07T05:31:56Z\",\n \"Address\": {\n \"Street\": \"<string>\",\n \"City\": \"<string>\",\n \"State\": \"<string>\",\n \"ZipCode\": \"<string>\",\n \"Country\": \"<string>\"\n },\n \"Description\": \"<string>\",\n \"ExternalId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.post("https://integrations.alvys.com/api/p/v{version}/trailers/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"TrailerId\": \"<string>\",\n \"EventType\": \"<string>\",\n \"StartDate\": \"2023-11-07T05:31:56Z\",\n \"EndDate\": \"2023-11-07T05:31:56Z\",\n \"Address\": {\n \"Street\": \"<string>\",\n \"City\": \"<string>\",\n \"State\": \"<string>\",\n \"ZipCode\": \"<string>\",\n \"Country\": \"<string>\"\n },\n \"Description\": \"<string>\",\n \"ExternalId\": \"<string>\"\n}")
.asString();{
"Id": "<string>",
"TrailerId": "<string>",
"Title": "<string>",
"EventType": "<string>",
"Description": "<string>",
"CreatedAt": "2023-11-07T05:31:56Z",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"Address": {
"Street": "<string>",
"City": "<string>",
"State": "<string>",
"ZipCode": "<string>",
"Country": "<string>"
},
"CreatedBy": "<string>",
"ExternalId": "<string>"
}{
"Id": "<string>",
"TrailerId": "<string>",
"Title": "<string>",
"EventType": "<string>",
"Description": "<string>",
"CreatedAt": "2023-11-07T05:31:56Z",
"StartDate": "2023-11-07T05:31:56Z",
"EndDate": "2023-11-07T05:31:56Z",
"Address": {
"Street": "<string>",
"City": "<string>",
"State": "<string>",
"ZipCode": "<string>",
"Country": "<string>"
},
"CreatedBy": "<string>",
"ExternalId": "<string>"
}{
"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>"
}