Skip to main content
Alvys sends a webhook event when a document is uploaded to, or deleted from, a load, trip, driver, carrier, truck, or trailer. Use these events to copy documents into your system without polling the list-documents endpoints. Subscribe to each event by its exact name. There is no wildcard. The full list of valid event-type strings is returned by GET /api/p/v1.0/webhooks/event-types.

When document events fire

  • Uploaded fires when a document is first saved. In rare cases it can fire again for the same document, so deduplicate on data.document.id.
  • Deleted fires when a document is removed.
  • A rename, or a change to the document type, sends no event. For example, a call to Change load document type or Change trip document type sends nothing. If you need the current name and type, read the documents again with the list-documents endpoint.

Payload

Document events use the standard Alvys webhook envelope. The envelope version is v1. data has two fields:
  • The holder key from the table above (for example loadNumber). It identifies the record the document belongs to.
  • document, an object that describes the document.
Property names are camelCase. Fields with a null value are omitted, except the top-level subsidiaryId. For document events, the envelope id has the form {documentId}-{etag}. Treat the id as an opaque string. Use it only to deduplicate, and do not parse it.

The document object

downloadUrl is valid for 10 minutes from the time Alvys builds the event, not from the time your endpoint receives it. Alvys builds the event one time. Each retry sends the same body, so a retry can carry a link that has already expired. If expiresAt is in the past, or the download fails, get a fresh link from the list-documents endpoint for the holder:
Start the download as soon as you receive the event. Do not store downloadUrl for later use.

Trip documents

For trip document events, the two identifiers are different:
  • data.tripId is the trip id.
  • data.document.parentId is the load number of the trip’s load, not the trip id.
Use data.tripId to find the trip.

Carrier documents go to every webhook

A carrier has no Subsidiary. For carrier.document.uploaded and carrier.document.deleted:
  • The envelope subsidiaryId is always null.
  • Alvys sends the event to every webhook in the tenant that subscribes to it, whatever Subsidiaries the webhook covers.
The other document events are matched on the Subsidiary of the load, trip, driver, truck, or trailer. See Which events reach your subscription.

Examples

truck.document.* and trailer.document.* events have the same shape as the driver example, with truckId or trailerId in place of driverId. The examples show these points:
  • On load.document.deleted, downloadUrl and expiresAt are absent. They are not sent as null.
  • On trip.document.uploaded, uploadedBy is absent because it is unknown. parentId is the load number.
  • On carrier.document.deleted, subsidiaryId is null. Fields such as attachmentSize and uploadedAt are absent because they are unknown.

Notes