Drivers
Update driver event
Partially update a scheduled driver event by ID: move its window, change its type, address or notes, with If-Match concurrency.
PATCH
/
api
/
p
/
v
{version}
/
drivers
/
events
/
{id}
Update driver event
curl --request PATCH \
--url https://integrations.alvys.com/api/p/v{version}/drivers/events/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--header 'If-Match: <if-match>' \
--data '
{
"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>"
}
'const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json-patch+json'
},
body: JSON.stringify({
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>'
})
};
fetch('https://integrations.alvys.com/api/p/v{version}/drivers/events/{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}/drivers/events/{id}"
payload = {
"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>"
}
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}/drivers/events/{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([
'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>'
]),
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}/drivers/events/{id}"
payload := strings.NewReader("{\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}")
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}/drivers/events/{id}")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json-patch+json")
.body("{\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}")
.asString();{
"Id": "<string>",
"DriverId": "<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>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}The Update Driver Event endpoint applies a partial update to a scheduled driver event. Send only the fields you want to change. A field left out of the body keeps its saved value. For more information on how versioning works and how to include it in your requests, please refer to the Versioning page.
The following header is required:
Replace
This endpoint requires the
driver:update scope. See Authentication.If-Match is required
This endpoint uses optimistic concurrency. Send the event’s currentETag in the If-Match header. The ETag response header of Get driver event, of Create driver event, and of every successful update carries it. Search driver events does not return ETags, so get the event by id first.
- If you omit
If-Match, the request is rejected with428 Precondition Required. - If the event changed after you read it, the request is rejected with
412 Precondition Failed. Get the event again and retry with the newETag.
What you can change
You can changeEventType, StartDate, EndDate, Address and Description. The driver cannot be changed: to move an event to another driver, delete it and create a new one. ExternalId cannot be changed.
The rules for each field are the same as in Create driver event: dates are local time at the event address and must be sent with a Z offset, and the address must be locatable.
Moving the window
After your changes, the event must still start before it ends. If you send only one ofStartDate or EndDate and the result would not, the request is rejected with 422 Unprocessable Entity and the problem type https://api.alvys.com/errors/UnprocessableEntity/AssetEventWindowInverted. Send both dates together when you move the window.
Changing the address
Because the dates are local time at the address, moving an event to an address in another time zone would shift the hours it blocks. If you sendAddress without the dates and the new address is in a different time zone, the request is rejected with 422 Unprocessable Entity and the problem type https://api.alvys.com/errors/UnprocessableEntity/AssetEventAddressMovesWindow. Send StartDate and EndDate with Address to say what the window should be at the new location.
Events created by maintenance work orders
An event created by a maintenance work order in Alvys follows that work order. It is returned by Get driver event and Search driver events, but it cannot be changed or deleted through the API: the request is rejected with422 Unprocessable Entity and the problem type https://api.alvys.com/errors/UnprocessableEntity/AssetEventOwnedByWorkOrder. Update the work order instead.
A body with nothing to change
A body with no fields,{}, changes nothing. The request still needs a current If-Match, and it returns 200 OK with the event and its unchanged ETag.
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 event. |
| Header | Required | Description |
|---|---|---|
| If-Match | Yes | The current ETag of the event. |
Request body
All fields are optional.| Field | Type | Description |
|---|---|---|
| EventType | String | One of Vacation, Restart, SickOrEmergency, Hometime, Other (case-insensitive). |
| StartDate | String (Date-Time) | When the event starts, as local time at the address, sent with a Z offset. |
| EndDate | String (Date-Time) | When the event ends, as local time at the address, sent with a Z offset. |
| Address | Object | Where the driver is during the event, with Street, City, State and ZipCode (all required when you send Address) and an optional Country. |
| Description | String | Free-form notes. Up to 2,000 characters. |
Example cURL request
curl --location --request PATCH 'https://integrations.alvys.com/api/p/v1/drivers/events/3c9a7e10-0000-0000-0000-000000000042' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--header 'If-Match: "00000000-0000-0000-0000-000000000001"' \
--data-raw '{
"StartDate": "2026-12-08T08:00:00Z",
"EndDate": "2026-12-11T12:00:00Z"
}'
YOUR_ACCESS_TOKEN with your actual Bearer token and the If-Match value with the event’s current ETag.
Response fields
A successful request returns200 OK with the updated event, in the same shape as Get driver event. The new ETag is in the ETag response header.
Example response
200 OK{
"Id": "3c9a7e10-0000-0000-0000-000000000042",
"DriverId": "DR1000000000000108",
"EventType": "Vacation",
"Description": "Family vacation",
"StartDate": "2026-12-08T08:00:00Z",
"EndDate": "2026-12-11T12:00:00Z",
"Address": {
"Street": "4500 Industrial Pkwy",
"City": "Dallas",
"State": "TX",
"ZipCode": "75247",
"Country": "US"
},
"ExternalId": "pto-2026-0412",
"CreatedAt": "2026-11-30T15:04:05.000Z"
}
Status codes
| Status | Meaning |
|---|---|
| 200 | The event was updated, or the body had nothing to change. |
| 400 | The request body failed validation. The response lists the invalid fields. |
| 401 | The request was not authenticated. |
| 403 | The caller lacks the driver:update scope. |
| 404 | No driver event with this id exists, it was deleted, or its driver is outside the subsidiaries your credential can access. |
| 409 | The update clashed with another change saved at the same moment. Get the event again and retry. |
| 412 | The If-Match value did not match the current event. Get the event again and retry. |
| 422 | The change was refused: AssetEventWindowInverted, AssetEventAddressMovesWindow, AssetEventAddressNotGeocodable, or AssetEventOwnedByWorkOrder. See the sections above. |
| 428 | The If-Match header is missing. |
| 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 specifying the API version and the event id in the URL path. 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
application/json-patch+jsonapplication/jsontext/jsonapplication/*+json
⌘I
Update driver event
curl --request PATCH \
--url https://integrations.alvys.com/api/p/v{version}/drivers/events/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--header 'If-Match: <if-match>' \
--data '
{
"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>"
}
'const options = {
method: 'PATCH',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json-patch+json'
},
body: JSON.stringify({
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>'
})
};
fetch('https://integrations.alvys.com/api/p/v{version}/drivers/events/{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}/drivers/events/{id}"
payload = {
"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>"
}
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}/drivers/events/{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([
'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>'
]),
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}/drivers/events/{id}"
payload := strings.NewReader("{\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}")
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}/drivers/events/{id}")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json-patch+json")
.body("{\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}")
.asString();{
"Id": "<string>",
"DriverId": "<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>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}{
"Type": "<string>",
"Title": "<string>",
"Status": 123,
"Detail": "<string>",
"Instance": "<string>"
}