> ## 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.

# Create driver event

> Schedule an event that blocks a driver in the dispatch planner for a time window, such as vacation, home time, a restart or sick time, safely retryable with ExternalId.

The Create Driver Event endpoint schedules an event against one of your drivers: a time window, such as vacation, home time, a restart or sick time, when the driver is not available. The dispatch planner shows the event and treats the driver as unavailable for that window. On success it returns the event and its optimistic-concurrency token in the `ETag` response header. Send that value in the `If-Match` header of a later [Update driver event](https://docs.alvys.com/en/api/reference/drivers/update-driver-event.md) or [Delete driver event](https://docs.alvys.com/en/api/reference/drivers/delete-driver-event.md) request. 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 `driver:update` scope. See [Authentication](https://docs.alvys.com/en/api/guides/authentication-1.md).

### Driver

`DriverId` is the Alvys id of the driver, as returned by [Search drivers](https://docs.alvys.com/en/api/reference/drivers/search-drivers.md). It starts with `DR`; an id that does not is rejected with `400 Bad Request`. If the driver 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 driver cannot be changed after the event is created.

### Event type

`EventType` is one of `Vacation`, `Restart`, `SickOrEmergency`, `Hometime`, `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 the id of the time-off request in your HR system. Send the same value when you retry a request, for example after a timeout. If this driver 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.
* `ExternalId` is 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 with `409 Conflict` and the problem `type` `https://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 `ExternalId` sent 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 |
| - | - | - | - |
| DriverId | String | Yes | The Alvys id of the driver. Starts with `DR`. |
| EventType | String | Yes | One of `Vacation`, `Restart`, `SickOrEmergency`, `Hometime`, `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 driver 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

```bash theme={null}
curl --location 'https://integrations.alvys.com/api/p/v1/drivers/events' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "DriverId": "DR1000000000000108",
  "EventType": "Vacation",
  "StartDate": "2026-12-08T08:00:00Z",
  "EndDate": "2026-12-10T17:00:00Z",
  "Address": {
    "Street": "4500 Industrial Pkwy",
    "City": "Dallas",
    "State": "TX",
    "ZipCode": "75247"
  },
  "Description": "Family vacation",
  "ExternalId": "pto-2026-0412"
}'
```

Replace `YOUR_ACCESS_TOKEN` with your actual Bearer token.

***

### Response fields

A successful request returns the event. Its current `ETag` is in the `ETag` response header.

| Field | Type | Description |
| - | - | - |
| Id | String | The unique identifier of the event. |
| DriverId | String | The id of the driver the event belongs to. |
| EventType | String | One of `Vacation`, `Restart`, `SickOrEmergency`, `Hometime`, `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**

```json theme={null}
{
  "Id": "3c9a7e10-0000-0000-0000-000000000042",
  "DriverId": "DR1000000000000108",
  "EventType": "Vacation",
  "Description": "Family vacation",
  "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": "pto-2026-0412",
  "CreatedAt": "2026-11-30T15:04:05.000Z"
}
```

***

### Status codes

| Status | Meaning |
| - | - |
| 201 | The event was created. |
| 200 | This driver 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 `driver:update` scope. |
| 404 | The driver 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](https://docs.alvys.com/en/api/guides/rate-limits.md) 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.


## OpenAPI

````yaml POST /api/p/v{version}/drivers/events
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}/drivers/events:
    post:
      tags:
        - Drivers
      summary: Create driver event
      parameters:
        - name: version
          in: path
          description: API version (e.g., 1.0)
          required: true
          schema:
            type: string
            default: '1.0'
            example: '1.0'
      requestBody:
        content:
          application/json-patch+json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.AssetEvents.DriverEventCreateRequest
          application/json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.AssetEvents.DriverEventCreateRequest
          text/json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.AssetEvents.DriverEventCreateRequest
          application/*+json:
            schema:
              allOf:
                - $ref: >-
                    #/components/schemas/Alvys.Models.AssetEvents.DriverEventCreateRequest
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Alvys.Models.Drivers.DriverEventResponse'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Alvys.Models.Drivers.DriverEventResponse'
        '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'
        '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'
        '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.DriverEventCreateRequest:
      required:
        - Address
        - DriverId
        - EndDate
        - EventType
        - StartDate
      type: object
      properties:
        DriverId:
          type: string
        EventType:
          type: string
          description: One of Vacation, Restart, SickOrEmergency, Hometime, Other.
        StartDate:
          type: string
          format: date-time
        EndDate:
          type: string
          format: date-time
        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.
        Description:
          type: string
          nullable: true
        ExternalId:
          type: string
          description: >-
            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.
          nullable: true
      additionalProperties: false
    Alvys.Models.Drivers.DriverEventResponse:
      required:
        - CreatedAt
        - Description
        - DriverId
        - EventType
        - Id
      type: object
      properties:
        Id:
          type: string
        DriverId:
          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>`.

````