> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alvys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update truck event

> Partially update a scheduled truck event by ID: move its window, change its type, address or notes, with If-Match concurrency.

The Update Truck Event endpoint applies a partial update to a scheduled truck 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](https://docs.alvys.com/en/api/guides/versioning.md) page.

> [!NOTE]
>
> This endpoint requires the `truck:update` scope. See [Authentication](https://docs.alvys.com/en/api/guides/authentication-1.md).

### If-Match is required

This endpoint uses optimistic concurrency. Send the event's current `ETag` in the `If-Match` header. The `ETag` response header of [Get truck event](https://docs.alvys.com/en/api/reference/trucks/get-truck-event.md), of [Create truck event](https://docs.alvys.com/en/api/reference/trucks/create-truck-event.md), and of every successful update carries it. [Search truck events](https://docs.alvys.com/en/api/reference/trucks/search-truck-events.md) does not return ETags, so get the event by id first.

* If you omit `If-Match`, the request is rejected with `428 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 new `ETag`.

### What you can change

You can change `EventType`, `StartDate`, `EndDate`, `Address` and `Description`. The truck cannot be changed: to move an event to another truck, delete it and create a new one. `ExternalId` cannot be changed.

The rules for each field are the same as in [Create truck event](https://docs.alvys.com/en/api/reference/trucks/create-truck-event.md): 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 of `StartDate` 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 send `Address` 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 truck event](https://docs.alvys.com/en/api/reference/trucks/get-truck-event.md) and [Search truck events](https://docs.alvys.com/en/api/reference/trucks/search-truck-events.md), but it cannot be changed or deleted through the API: the request is rejected with `422 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. |

The following header is required:

| 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 `WorkOrder`, `Repair`, `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 truck 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

```bash theme={null}
curl --location --request PATCH 'https://integrations.alvys.com/api/p/v1/trucks/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"
}'
```

Replace `YOUR_ACCESS_TOKEN` with your actual Bearer token and the `If-Match` value with the event's current `ETag`.

***

### Response fields

A successful request returns `200 OK` with the updated event, in the same shape as [Get truck event](https://docs.alvys.com/en/api/reference/trucks/get-truck-event.md#response-fields). The new `ETag` is in the `ETag` response header.

***

### Example response

**200 OK**

```json theme={null}
{
  "Id": "3c9a7e10-0000-0000-0000-000000000042",
  "TruckId": "TR1000000000000417",
  "Title": "T-417",
  "EventType": "Repair",
  "Description": "Brake job at the dealer",
  "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": "shop-ro-77821",
  "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 `truck:update` scope. |
| 404 | No truck event with this `id` exists, it was deleted, or its truck 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](https://docs.alvys.com/en/api/guides/rate-limits.md) 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.


## OpenAPI

````yaml PATCH /api/p/v{version}/trucks/events/{id}
openapi: 3.0.1
info:
  title: Alvys
  description: >-
    Alvys provides a robust set of REST APIs to allow you to integrate Alvys
    into virtually any platform. These APIs cover most of Alvys' major product
    areas with additional endpoints being added regularly based on customer
    requests.
  contact:
    name: Alvys Support
    url: https://www.alvys.com/resources/contact/
  version: v1
servers:
  - url: https://integrations.alvys.com
    description: Public API Server
  - url: https://api.alvys.com/
    description: Public API Server
security:
  - Public: []
tags:
  - name: Authentication
    description: Obtain an OAuth 2.0 access token for the Alvys Public API.
  - name: Carrier Settlement Statements
    description: >-
      Search carrier settlement statements and retrieve a single statement by
      number.
  - name: Carriers
    description: Read carrier records, search carriers, and manage carrier documents.
  - name: Customers
    description: Create, read, update, delete, and search customer records.
  - name: Deductions
    description: >-
      Create one-time deductions and search or delete existing deduction
      records.
  - name: DispatchPreferences
    description: Dispatch preferences endpoints for reading dispatch rules and preferences.
  - name: Driver Settlement Statements
    description: >-
      Search driver settlement statements and retrieve a single statement by
      number.
  - name: Drivers
    description: >-
      Read driver records, search drivers and driver events, and manage driver
      documents.
  - name: Fuel
    description: Read and search fuel transactions.
  - name: Invoices
    description: >-
      Read invoices, create carrier invoices, and record carrier and customer
      payments.
  - name: Loads
    description: >-
      Read, update, and search loads; manage load documents, notes, and custom
      references.
  - name: Locations
    description: Read and search company location details.
  - name: Maintenance
    description: Read and search maintenance records.
  - name: References
    description: >-
      List tenant custom reference definitions and create or update values on
      existing loads, stops, and trips.
  - name: Subsidiaries
    description: >-
      List your company's subsidiaries and read a single subsidiary, so an
      integration can resolve a subsidiary id to a recognizable name.
  - name: Tenders
    description: Create, accept, reject, cancel, update, and search inbound EDI tenders.
  - name: Tolls
    description: Read and search toll transactions.
  - name: Tracking
    description: >-
      Record an asset's current location or telemetry from a third-party source,
      such as an external ELD or a self-reporting vehicle.
  - name: Trailers
    description: Read trailers, search trailer events, and manage trailer documents.
  - name: Trips
    description: >-
      Read and search trips; manage trip documents, stop appointments, arrivals,
      departures, and stop and trip custom references.
  - name: Trucks
    description: Read trucks, search truck events, and manage truck documents.
  - name: Users
    description: List and search users.
  - name: Visibility
    description: >-
      Read inbound and outbound visibility history and search outbound
      visibility errors.
  - name: Webhooks
    description: >-
      Create, read, update, delete, enable, disable, verify, test, and rotate
      secrets for webhook subscriptions; read event types, delivery logs, and
      health metrics.
  - name: Accessorials
  - name: Credits
paths:
  /api/p/v{version}/trucks/events/{id}:
    patch:
      tags:
        - Trucks
      summary: Update truck event
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: version
          in: path
          description: API version (e.g., 1.0)
          required: true
          schema:
            type: string
            default: '1.0'
            example: '1.0'
        - name: If-Match
          in: header
          required: true
          description: >-
            The event's current ETag (the ETag response header of your most
            recent GET, POST or PATCH), for optimistic concurrency. Required; if
            omitted the request is rejected with 428.
          schema:
            type: string
      requestBody:
        content:
          application/json-patch+json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.AssetEvents.TruckEventUpdateRequest
          application/json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.AssetEvents.TruckEventUpdateRequest
          text/json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.AssetEvents.TruckEventUpdateRequest
          application/*+json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.AssetEvents.TruckEventUpdateRequest
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Alvys.Models.Trucks.TruckEventResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Microsoft.AspNetCore.Mvc.ValidationProblemDetails
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '404':
          description: Not Found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '409':
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '412':
          description: Precondition Failed (If-Match ETag did not match the current event)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '422':
          description: Unprocessable Content
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '428':
          description: Precondition Required (If-Match header missing)
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
        '429':
          description: Too Many Requests
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails'
      security:
        - Public: []
components:
  schemas:
    Alvys.Models.AssetEvents.TruckEventUpdateRequest:
      type: object
      properties:
        EventType:
          type: string
          description: One of WorkOrder, Repair, Other.
          nullable: true
        StartDate:
          type: string
          format: date-time
          nullable: true
        EndDate:
          type: string
          format: date-time
          nullable: true
        Address:
          allOf:
            - $ref: '#/components/schemas/Alvys.Features.Locations.ShortAddress'
          description: >-
            Address must be specific enough to resolve to coordinates. Without
            them the event cannot be anchored to a local time and the dispatch
            planner ignores it.
          nullable: true
        Description:
          type: string
          nullable: true
      additionalProperties: false
    Alvys.Models.Trucks.TruckEventResponse:
      required:
        - CreatedAt
        - Description
        - EventType
        - Id
        - Title
        - TruckId
      type: object
      properties:
        Id:
          type: string
        TruckId:
          type: string
        Title:
          type: string
        EventType:
          type: string
        Description:
          type: string
        StartDate:
          type: string
          format: date-time
          nullable: true
        EndDate:
          type: string
          format: date-time
          nullable: true
        Address:
          allOf:
            - $ref: '#/components/schemas/Alvys.Features.Locations.ShortAddress'
          nullable: true
        CreatedBy:
          type: string
          nullable: true
        CreatedAt:
          type: string
          format: date-time
        ExternalId:
          type: string
          nullable: true
      additionalProperties: false
    Microsoft.AspNetCore.Mvc.ValidationProblemDetails:
      required:
        - Errors
      type: object
      properties:
        Errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        Type:
          type: string
          nullable: true
        Title:
          type: string
          nullable: true
        Status:
          type: integer
          format: int32
          nullable: true
        Detail:
          type: string
          nullable: true
        Instance:
          type: string
          nullable: true
      additionalProperties: {}
    Microsoft.AspNetCore.Mvc.ProblemDetails:
      type: object
      properties:
        Type:
          type: string
          nullable: true
        Title:
          type: string
          nullable: true
        Status:
          type: integer
          format: int32
          nullable: true
        Detail:
          type: string
          nullable: true
        Instance:
          type: string
          nullable: true
      additionalProperties: {}
    Alvys.Features.Locations.ShortAddress:
      required:
        - City
        - State
        - Street
        - ZipCode
      type: object
      properties:
        Street:
          type: string
        City:
          type: string
        State:
          type: string
        ZipCode:
          type: string
        Country:
          type: string
          description: >-
            ISO 3166-1 alpha-2 country code where the recorded value is a
            recognized spelling of United States, Canada or Mexico; otherwise
            the country exactly as recorded, which for addresses created before
            this field existed may be any string. Omitted when no country is
            recorded; an absent Country must NOT be interpreted as US.
          nullable: true
      additionalProperties: false
  securitySchemes:
    Public:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        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>`.

````