Relay API v2 (2.0.106)

Download OpenAPI specification:Download

Overview

The Relay v2 Shipping API is designed to let retailers and marketplaces start shipping with Relay fast.

Setup

You'll need to contact Relay at dev-support@relaytech.co to request an API key and register your retailer locations (warehouses).

Authentication

The Relay API uses HTTP Bearer Authentication. This means that to let us know it's really you calling the Relay API, you'll need to include a header in your request of the form Relay-Authorization: Bearer $YOUR_API_KEY. We also require that all requests to the API be made over HTTPS.

API conventions

We attempt to follow a few conventions throughout the API:

  • Metric system: Weights, measures, distances, etc. are all reported using SI units and their multiples/submultiples.
  • UTC time: Dates and times are all reported in Coordinated Universal Time.
  • ISO formats: Where a commonly-used ISO format exists to represent structured data, such as dates, country codes, etc., we aim to use these standard formats.

Tracking

The current shipment status and its history can be accessed through the status and events fields respectively. Events offer more context for status changes but please note that multiple events can map to the same status.

Events

Events tell you what happened to a parcel, in more detail than its status alone. Several events can lead to the same status.

We send event names in one of two sets:

  • 2.1 — the current set, and what we recommend for new integrations.
  • 2.0 — the original set, still sent to existing integrations.

Your integration receives one set or the other, so use the matching tab below: the same moment in a parcel's journey can have a different name in each. If you're not sure which set you receive, email dev-support@relaytech.co.

Build your tracking logic on event_name. It is the most specific signal we send — 2.1 gives separate names to situations that 2.0 reported under a single name, while status and event_category are deliberately broader.

In the 2.1 table, the Shipment Status column shows the status a shipment holds when the event is sent; a dash means the event leaves the shipment's status unchanged.

Event NameDescriptionCategoryShipment Status
shipment_created
new_shipment_to_customerShipment created for delivery to a customershipment_createdpending
new_shipment_to_retailerShipment created for delivery to a retailershipment_createdinbound_return
new_c2c_shipmentCustomer-to-customer shipment createdshipment_createdawaiting_parcel_drop_off
new_l2l_collection_shipmentShipment created for delivery from a marketplace retailer to a customershipment_createdpending
shipment_received
sortation_scanPackage scanned during sorting processshipment_receivedreceived
inbound_intake_scanPackage scanned at inbound facilityshipment_receivedhsc_received_inbound_return
sortation_scan_after_failed_deliveryPackage sorted at a Relay sort centre after a failed delivery attemptshipment_receivedfailed
rts_sortation_scanPackage scanned at a sort centre on its return journey to the sendershipment_receivedrts_pending
in_transit
awaiting_customer_collectionPackage ready for customer collection at pitstopin_transitawaiting_customer_collection
awaiting_sender_collectionPackage ready for sender collectionin_transitrts_awaiting_customer_collection
customer_collection_requestedCustomer has requested to collect package from a pitstopin_transitpreparing_customer_collection
collection_expiry_reminderReminder sent that collection window is expiring soonin_transitawaiting_customer_collection
collection_expired_converted_to_deliveryCollection window expired; the parcel will be delivered to the customer's address insteadin_transit
rts_intake_scanReturn to sender package received at facilityin_transithsc_received_rts_parcel
pitstop_destination_redirectedShipment destination redirected to a different pitstopin_transit
pitstop_origin_redirectedShipment origin redirected to a different pitstopin_transit
sender_dropped_off_at_pitstopParcel dropped off at a pitstop by the senderin_transitreceived_at_pitstop
assigned_to_delivery_routeShipment assigned to a delivery routein_transitscheduled
out_for_deliveryShipment out for delivery by courierin_transitout_for_delivery
delivery_attempt_failedDelivery attempt failedin_transitfailed
customer_collection_delayedThe parcel left the pitstop before the customer collected it; collection is delayedin_transitcustomer_collection_delayed
sender_collection_expiry_reminderReminder sent that the sender's return-collection window is expiring soonin_transitrts_awaiting_customer_collection
delivered
handed_to_customerPackage successfully delivered to customerdelivereddelivered
left_in_safe_placePackage left in customer's designated safe locationdelivereddelivered
handed_to_neighbourPackage delivered to customer's neighbourdelivereddelivered
pod_uploadProof of delivery images uploadeddelivereddelivered
rts_dispatch_scanReturn to sender package dispatcheddeliveredrts_parcel_dispatched
handed_to_retailerPackage delivered to retailer locationdelivereddelivered
collected_by_customerPackage collected by customer from pickup pointdeliveredcustomer_collected
collected_by_senderPackage collected by senderdeliveredrts_customer_collected
error
sortation_exception_discardPackage discarded due to sorting exceptionerrordamaged_upon_receipt
too_many_attempts_rtsPackage returned to sender after too many delivery attemptserrormax_attempts_reached_rts_pending
retailer_cancelledShipment cancelled by retailererrorcancelled
customer_refused_delivery_rtsCustomer refused delivery, returning to sendererrorcustomer_rejected_rts_pending
pitstop_unavailable_rtsPackage returned to sender because the destination pitstop was unavailableerrorrts_pending
collection_expiredCollection window expirederror
drop_off_expiredDrop-off window expirederrorcancelled
delivery_not_attemptedDelivery was not attemptederrordelayed
collection_expired_rtsCollection window expired; the parcel will be returned to the sendererrorrts_pending
sender_collection_expiredThe sender did not collect the returned parcel in timeerrorrts_failed
agent_flagged_as_rtsA Relay agent decided this shipment should be returned to the sendererrorrts_pending
sortation_exception_rtsA sortation operative decided this shipment should be returned to the sendererrorrts_pending
exception_oversizedPackage reported as oversizederror
exception_damagedPackage reported as damagederror
exception_oversized_discardOversized parcel discarded at the sort centre, typically a C2C parcel that cannot be returnederrordiscarded
exception_discardParcel disposed of, damaged or otherwise unfit for deliveryerrordiscarded
flagged_as_lostShipment is marked as losterrorlost
Event NameDescriptionCategory
shipment_created
new_shipment_to_customerShipment created for delivery to a customershipment_created
new_shipment_to_retailerShipment created for delivery to a retailershipment_created
new_c2c_shipmentCustomer-to-customer shipment createdshipment_created
new_l2l_collection_shipmentShipment created for delivery from a marketplace retailer to a customershipment_created
shipment_received
sortation_scanPackage scanned during sorting processshipment_received
sortation_intake_scanPackage received at sorting facilityshipment_received
inbound_intake_scanPackage scanned at inbound facilityshipment_received
in_transit
pitstop_shipment_checkinIndividual shipment checked into pitstopin_transit
lm_out_for_deliveryShipment out for delivery by courierin_transit
lm_delivery_failedDelivery attempt failedin_transit
awaiting_customer_collectionPackage ready for customer collection at pitstopin_transit
awaiting_sender_collectionPackage ready for sender collectionin_transit
customer_collection_requestedCustomer has requested to collect package from a pitstopin_transit
collection_expiry_reminderReminder sent that collection window is expiring soonin_transit
collection_expired_converted_to_deliveryCollection window expired; the parcel will be delivered to the customer's address insteadin_transit
assign_to_routeShipment assigned to a delivery routein_transit
rts_intake_scanReturn to sender package received at facilityin_transit
pitstop_destination_redirectedShipment destination redirected to a different pitstopin_transit
pitstop_origin_redirectedShipment origin redirected to a different pitstopin_transit
delivered
handed_to_customerPackage successfully delivered to customerdelivered
left_in_safe_placePackage left in customer's designated safe locationdelivered
handed_to_neighbourPackage delivered to customer's neighbourdelivered
pod_uploadProof of delivery images uploadeddelivered
rts_dispatch_scanReturn to sender package dispatcheddelivered
handed_to_retailerPackage delivered to retailer locationdelivered
collected_by_customerPackage collected by customer from pickup pointdelivered
collected_by_senderPackage collected by senderdelivered
error
agent_flagged_as_lostAgent marked package as losterror
automatic_cleanup_lostSystem automatically marked shipment as losterror
agent_flagged_as_return_to_senderAgent marked package for return to sendererror
sortation_exception_return_to_senderPackage returned to sender due to sorting exceptionerror
sortation_exception_discardPackage discarded due to sorting exceptionerror
too_many_attempts_rtsPackage returned to sender after too many delivery attemptserror
retailer_cancelledShipment cancelled by retailererror
customer_refused_delivery_rtsCustomer refused delivery, returning to sendererror
pitstop_unavailable_rtsPackage returned to sender because the destination pitstop was unavailableerror
collection_expiredCollection window expirederror
lm_delivery_did_not_attemptDelivery was not attemptederror
drop_off_expiredDrop-off window expirederror
shipment_discardedPackage discarded due to damage or other issueserror
exception_oversizedPackage reported as oversizederror
exception_damagedPackage reported as damagederror

Statuses

Status Explanation Description in API response
pending The shipment is waiting in our system. The shipment can be cancelled while in this status. Order details received
cancelled The shipment has been cancelled. Relay will not collect or attempt to deliver the shipment. Cancelled by the sender
delivered The shipment has been delivered to the end customer. Delivered
failed The shipment failed the delivery attempt to the end customer. Delivery attempt failed
scheduled The shipment has been assigned a delivery route. Scheduled for delivery
out_for_delivery The shipment is on its assigned delivery route. Out for delivery with our courier
lost The shipment location is unknown and therefore considered as lost in transit. Unable to locate your order
manifested_not_received The shipment was expected to be collected but was not. Order not received from the sender
delayed The shipment is delayed. Delayed
discarded The parcel is not suitable for delivery. Parcel discarded by Relay due to exception
inbound_return The delivery is being sent back to the retailer. Delivery back to retailer
damaged_upon_receipt The shipment is damaged. Damaged upon receipt by Relay
received The shipment is confirmed to be collected. Order received from the sender
max_attempts_reached_rts_pending All delivery attempts have failed so the shipment will be returned to the sender. Maximum delivery attempts reached
customer_rejected_rts_pending The end customer refused to accept the delivery. Customer refused delivery
hsc_received_rts_parcel The return to sender shipment has reached the Relay Hub. Parcel returned to Relay Hub,
hsc_received_inbound_return The parcel has been received at the Relay Hub. Parcel received at Relay Hub
rts_parcel_dispatched The return to sender shipment has been dispatched to the sender. Parcel returned to the sender
rts_pending The shipment is being returned to the sender. Returning to the sender
customer_collected The customer has collected the parcel. Customer collected the parcel
preparing_customer_collection The parcel is being prepared for customer collection. Preparing for customer collection
awaiting_customer_collection The shipment is ready for customer collection at the pitstop. Ready for customer collection at pitstop
customer_collection_delayed The customer collection is delayed. Pickup Delayed
received_at_pitstop The shipment is received at a pitstop. Received at pitstop
awaiting_parcel_drop_off The shipment is awaiting a parcel drop off. Expecting Your Parcel
driver_collected_parcel_from_pitstop The courier has collected the parcel from the pitstop. Courier Collected Your Parcel
rts_awaiting_customer_collection The return to sender parcel is ready for customer collection at the pitstop. Ready for customer collection at pitstop
rts_customer_collected The customer has collected the return to sender parcel. Customer collected the parcel
rts_failed The return to sender shipment has failed. Failed to return to the sender
processed_at_gateway The parcel has been processed at a Relay gateway. Parcel was processed at a Relay gateway
entered_relay_network The parcel has entered the Relay network. Parcel has entered the Relay network

Event Categories

Category Description Example Events
shipment_created Shipment creation events new_shipment_to_customer, new_c2c_shipment
shipment_received Package sorting and routing events sortation_scan, sortation_intake_scan
in_transit In-transit movement events pitstop_shipment_checkin, lm_out_for_delivery, lm_delivery_failed
delivered Final delivery outcome events handed_to_customer, left_in_safe_place, collected_by_customer
error Problem and error state events agent_flagged_as_lost, retailer_cancelled, collection_expired

pudos

Locations where end customers can pick up / drop off their parcels

List Pudos

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
query Parameters
services
Array of strings (Services)
Items Enum: "customer_delivery" "customer_collection" "customer_return" "customer_to_customer" "pikachu" "customer_to_customer_offboarding" "customer_drop_off" "l2l_drop_off" "customer_collection_pause" "customer_to_customer_pause"
Postcode (string) or Postcode (null) (Postcode)
Latlon (string) or Latlon (null) (Latlon)
radius_m
integer (Radius M)
Default: 8000
limit
integer (Limit)
Default: 30
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

List All Pudos

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
query Parameters
Array of Services (strings) or Services (null) (Services)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Pudo Available Outcodes

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
query Parameters
services
Array of strings (Services)
Default: "customer_to_customer"
Items Enum: "customer_delivery" "customer_collection" "customer_return" "customer_to_customer" "pikachu" "customer_to_customer_offboarding" "customer_drop_off" "l2l_drop_off" "customer_collection_pause" "customer_to_customer_pause"
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "outcodes": [
    ]
}

shipments

Manage creating and tracking shipments

Create Shipment

This endpoint is used to create a new shipment with the specified details, including origin, destination, parcel information, and service type.

You can optionally specify a label configuration to control how the label is generated. You can also decide not to generate a label in this request.

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
Box Number (string) or Box Number (null) (Box Number)

The box number for the delivery that contains this shipment. This should be applied to every shipment covered by the same box.

required
ExternalApiCustomerLocation (object) or ExternalApiPudoLocationRequiredCode (object) or ExternalApiRetailerLocation (object) (Destination)

The location to which this shipment is destined.

SafePlace (object) or null

A safe place to put the parcel if the shipment cannot be delivered to the destination address.

End Customer Promise Date (string) or End Customer Promise Date (null) (End Customer Promise Date)

Date of the customer delivery promise. What is the last possible date the retailer has committed to the customer that the delivery will occur.

FMOrigin (string) or null

The first mile origin type for the shipment (international or domestic).

Idempotency Key (string) or Idempotency Key (null) (Idempotency Key)

An optional key used to make shipment creation idempotent. If a non-cancelled shipment already exists for the same idempotency_key, that existing shipment is returned instead of creating a new one. Leave unset to disable the idempotency check for this request. If you use your order number as the idempotency_key, you should also populate the parcel.order_number field.

LabelConfig (object) or null
required
ExternalApiPudoLocationWithHandoverInput (object) or ExternalApiRetailerLocation (object) or ExternalApiMarketplaceRetailerLocation (object) (Origin)

The location from which this shipment originates. This could be a retailer or pudo location

required
object (Parcel)
Retailer Brand (string) or Retailer Brand (null) (Retailer Brand)
Retailer Brand Id (string) or Retailer Brand Id (null) (Retailer Brand Id)
Retailer Code (string) or Retailer Code (null) (Retailer Code)

A unique code identifying the retailer initiating the shipment.

service_type
required
string (ExternalApiInputServiceType)
Enum: "next_day" "two_day" "five_day" "next_day_upgrade" "inbound_return" "customer_to_customer" "customer_drop_off"

The type of delivery service. For example 'next_day', means a shipment created on day T (before the daily cut-off time) will be delivered on day T+1 (e.g. Monday -> Tuesday). As Relay adds more delivery services, we will add more options to this field.

shipper_metadata
any (Shipper Metadata)

Capture miscellaneous events and data on the shipment that does not fit into the existing fields.

Waybill Number (string) or Waybill Number (null) (Waybill Number)

The AWB number for the delivery that contains this shipment. This should be applied to every shipment covered by the same waybill.

Responses

Request samples

Content type
application/json
{
  • "box_number": "string",
  • "destination": {
    },
  • "destination_alternative": {
    },
  • "end_customer_promise_date": "2019-08-24",
  • "fm_origin": "international",
  • "idempotency_key": "string",
  • "label_config": {
    },
  • "origin": {
    },
  • "parcel": {
    },
  • "retailer_brand": "string",
  • "retailer_brand_id": "string",
  • "retailer_code": "string",
  • "service_type": "next_day",
  • "shipper_metadata": null,
  • "waybill_number": "string"
}

Response samples

Content type
application/json
{
  • "box_number": "string",
  • "code": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "destination": {
    },
  • "destination_alternative": {
    },
  • "end_customer_promise_date": "2019-08-24",
  • "fm_origin": "international",
  • "idempotency_key": "string",
  • "label": {
    },
  • "origin": {
    },
  • "parcel": {
    },
  • "retailer_brand": "string",
  • "retailer_brand_id": "string",
  • "retailer_code": "string",
  • "service_type": "two_day",
  • "shipper_metadata": null,
  • "sort_centre_code": "string",
  • "waybill_number": "string"
}

Get Shipment Bulk

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
codes
required
Array of strings (Codes)

The list of shipment tracking codes to get shipment details for.

Responses

Request samples

Content type
application/json
{
  • "codes": [
    ]
}

Response samples

Content type
application/json
[
  • {
    }
]

Get Shipment Status Bulk

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
codes
required
Array of strings (Codes)

The list of shipment tracking codes to get statuses for.

Responses

Request samples

Content type
application/json
{
  • "codes": [
    ]
}

Response samples

Content type
application/json
[
  • {
    }
]

Bulk Patch Barcode Waybill

Bulk update barcodes with their associated waybill and box numbers.

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
required
Array of objects (Boxes)

The boxes and their associated barcodes.

waybill_number
required
string (Waybill Number)

The AWB number that applies to all barcodes in this request.

Responses

Request samples

Content type
application/json
{
  • "boxes": [
    ],
  • "waybill_number": "string"
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "success": true
}

Update Shipment Wms Data Bulk

Update WMS data for a list of shipments

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
required
Array of objects (Updates)

The list of shipment WMS data updates.

Responses

Request samples

Content type
application/json
{
  • "updates": [
    ]
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "success": true
}

Get Shipment

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
code
required
string (Code)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "box_number": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "destination": {
    },
  • "destination_alternative": {
    },
  • "end_customer_promise_date": "2019-08-24",
  • "fm_origin": "international",
  • "idempotency_key": "string",
  • "origin": {
    },
  • "parcel": {
    },
  • "retailer_brand": "string",
  • "retailer_brand_id": "string",
  • "retailer_code": "string",
  • "service_type": "two_day",
  • "shipper_metadata": null,
  • "sort_centre_code": "string",
  • "waybill_number": "string"
}

Patch Shipment

Update the details of an existing shipment.

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
code
required
string (Code)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
Box Number (string) or Box Number (null) (Box Number)
End Customer Promise Date (string) or End Customer Promise Date (null) (End Customer Promise Date)
shipper_metadata
any (Shipper Metadata)
Waybill Number (string) or Waybill Number (null) (Waybill Number)

Responses

Request samples

Content type
application/json
{
  • "box_number": "string",
  • "end_customer_promise_date": "2019-08-24",
  • "shipper_metadata": null,
  • "waybill_number": "string"
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "success": true
}

Cancel Shipment

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
code
required
string (Code)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "message": "string"
}

Get Shipment Delivery

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
code
required
string (Code)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "calls_to_customer": [
    ],
  • "courier_note": "string",
  • "delivery_failures": [
    ],
  • "pods": [
    ],
  • "safe_place": {
    },
  • "status": "pending"
}

Get Shipment Label

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
code
required
string (Code)
query Parameters
ShipmentLabelType (string) or Mode (null) (Mode)
LabelFileFormat (string) or Fileformat (null) (Fileformat)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
null

Get Shipment Status

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
code
required
string (Code)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "events": [
    ],
  • "last_scan_location": "string",
  • "last_updated_at": "2019-08-24T14:15:22Z",
  • "pods": [
    ],
  • "shipment_code": "string",
  • "status": "active"
}

Update Shipment Wms Data

Update WMS data for a shipment

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
code
required
string (Code)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
WMSContainerData (object) or null
Array of Items (objects) or Items (null) (Items)
Label Created At (string) or Label Created At (null) (Label Created At)
Order Allocated To Wave At (string) or Order Allocated To Wave At (null) (Order Allocated To Wave At)
Order Packed At (string) or Order Packed At (null) (Order Packed At)
Order Picked At (string) or Order Picked At (null) (Order Picked At)
Order Scanned Into Container At (string) or Order Scanned Into Container At (null) (Order Scanned Into Container At)
WMSOriginRetailerData (object) or null
WMSVolumiserData (object) or null

Responses

Request samples

Content type
application/json
{
  • "container": {
    },
  • "items": [
    ],
  • "label_created_at": "2019-08-24T14:15:22Z",
  • "order_allocated_to_wave_at": "2019-08-24T14:15:22Z",
  • "order_packed_at": "2019-08-24T14:15:22Z",
  • "order_picked_at": "2019-08-24T14:15:22Z",
  • "order_scanned_into_container_at": "2019-08-24T14:15:22Z",
  • "origin_retailer": {
    },
  • "volumiser": {
    }
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "success": true
}

Get Shipment Collection

Get customer collection details for a shipment including QR code, collection code, and pitstop information.

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
tracking_number
required
string (Tracking Number)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "collection_code": "string",
  • "pitstop": {
    },
  • "qr_code": "string"
}

services

The services Relay supports between two points

postcodes

Network coverage and exclusions

Get Postcode Exclusions

Get postcode exclusions for the authenticated shipper.

Returns additions (newly excluded postcodes) and removals (no longer excluded postcodes) based on the timestamp parameter.

If no timestamp is provided, returns all current exclusions as additions.

Polling behavior:

When an outcode is removed from exclusions (e.g., becomes whitelisted), any blacklisted postcodes within that outcode are automatically included as additions. This ensures that individual postcode exclusions are not accidentally cleared when their parent outcode becomes supported.

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
query Parameters
Timestamp (integer) or Timestamp (null) (Timestamp)

Unix timestamp in seconds. If provided, returns only changes since this timestamp. If not provided, returns all current exclusions.

header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "additions": [
    ],
  • "last_updated_at": 0,
  • "removals": [
    ]
}

webhooks

Webhook subscription management and event notifications

Webhook Payload

When events occur, Relay sends a POST request to your webhook URL with a JSON payload:

{
  "event_name": "handed_to_customer",
  "event_category": "delivered",
  "occurred_at": "2024-01-15T14:30:00Z",
  "shipment_code": "RELAY123456",
  "status": "delivered",
  "status_description": "Delivered",
  "event_history": [...],
  "event_details": {...}
}

Event Details

Some webhook events include additional details in an event_details field (only available with the default presenter).

Events with Event Details

Event Name Field Description
pod_upload pods List of proof of delivery images with signed URLs (valid for 7 days)
customer_collection_requested address_change Old and new address details when customer requests pitstop collection
customer_collection_requested extended_collection_selected Whether the customer opted into an extended collection window for this shipment
customer_collection_requested sla_extension_days Number of days the delivery SLA is extended by for an extended collection, if a day-based SLA adjustment is configured for the shipper
pitstop_destination_redirected address_change Old and new address details when shipment destination is redirected to a different pitstop
pitstop_origin_redirected address_change Old and new address details when shipment origin is redirected to a different pitstop
new_c2c_shipment handover_details Handover code and window for parcel drop-off at the origin pitstop
awaiting_customer_collection handover_details Handover code, QR code URL, pudo code, and collection window for customer collection
awaiting_sender_collection handover_details Handover code, QR code URL, pudo code, and collection window for sender collection (RTS)
pitstop_shipment_checkin handover_details PUDO code of the pitstop where the parcel was dropped off (only for received_at_pitstop status)
lm_delivery_failed delivery_failure Failure reason and description when a last-mile delivery attempt fails
exception_oversized source Where in the network the event was recorded. Possible values: 'sortation', 'pitstop', 'middle_mile', 'last_mile'
exception_oversized evidence Evidence supporting the event, e.g. measured dimensions or photos of an oversized parcel.
exception_damaged source Where in the network the event was recorded. Possible values: 'sortation', 'pitstop', 'middle_mile', 'last_mile'
exception_damaged evidence Evidence supporting the event, e.g. photos of the damaged parcel.
exception_damaged is_damaged_on_receipt Whether the damage was reported within one business day of the parcel entering the network (damaged on receipt) rather than later (non-compliant packaging).

Address Change Example

{
  "old_address": {
    "organisation": null,
    "line1": "123 Example Street",
    "line2": "Flat 4",
    "line3": null,
    "line4": null,
    "town": "London",
    "county": null,
    "postcode": "SW1A 1AA",
    "country_iso": "GBR",
    "lat": null,
    "lon": null
  },
  "old_pudo_code": "PST001",
  "new_address": {
    "organisation": null,
    "line1": "123 Example Street",
    "line2": "Flat 4",
    "line3": null,
    "line4": null,
    "town": "London",
    "county": null,
    "postcode": "SW1A 1AA",
    "country_iso": "GBR",
    "lat": null,
    "lon": null
  },
  "new_pudo_code": "PST002",
  "changed_at": "2024-01-15T14:30:00.000000+00:00"
}

Proof of Delivery Example

[{
  "image": "https://storage.googleapis.com/example/pod-image.jpg",
  "captured_at": "2024-01-15T14:30:00.000000+00:00",
  "coordinates": {
    "lat": 51.5074,
    "lon": -0.1278
  }
}, {
  "image": "https://storage.googleapis.com/example/pod-image-2.jpg",
  "captured_at": "2024-01-15T14:30:00.000000+00:00",
  "coordinates": {
    "lat": 51.5074,
    "lon": -0.1278
  }
}]

Handover Details Example

{
  "handover_code": "RELHO12345678",
  "handover_qr_code": "https://relay-production.relaytechapis.co/v0/customer-portal/qr-code?collection_code=RELHO12345678",
  "pudo_code": "PST001",
  "handover_window_begins": "2024-01-15T08:00:00.000000+00:00",
  "handover_window_ends": "2024-01-22T18:00:00.000000+00:00"
}

Delivery Failure Example

{
  "failure_reason": "no_answer_from_customer",
  "failure_reason_description": "No Answer from Customer"
}

Oversized Evidence Example

{
  "dimensions": {
    "length_cm": 120.0,
    "width_cm": 80.0,
    "height_cm": 60.0
  },
  "images": null
}

Webhook Signature

All webhook requests include an x-relay-signature header containing an HMAC-SHA256 signature of the payload. Use your webhook signing key to verify the signature and ensure the request is from Relay.

List Webhook Subscriptions

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
query Parameters
Retailer Code (string) or Retailer Code (null) (Retailer Code)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "webhooks": [
    ]
}

Update Webhook Subscription

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
WebhookCustomConfig (object) or null
ExternalApiWebhookPresenter (string) or null
Include Event History (boolean) or Include Event History (null) (Include Event History)
Retailer Code (string) or Retailer Code (null) (Retailer Code)
Array of Subscribed Events (strings) or Subscribed Events (null) (Subscribed Events)
webhook_uid
required
string <uuid> (Webhook Uid)

Responses

Request samples

Content type
application/json
{
  • "custom_config": {
    },
  • "custom_presenter": "default",
  • "include_event_history": true,
  • "retailer_code": "string",
  • "subscribed_events": [
    ],
  • "webhook_uid": "e00a5c66-81c3-4565-a0c1-eaf5f6e2efe1"
}

Response samples

Content type
application/json
{
  • "created_at": "2019-08-24T14:15:22Z",
  • "custom_config": {
    },
  • "custom_presenter": "default",
  • "detail": "string",
  • "include_event_history": true,
  • "subscribed_events": [
    ],
  • "updated_at": "2019-08-24T14:15:22Z",
  • "webhook_uid": "e00a5c66-81c3-4565-a0c1-eaf5f6e2efe1",
  • "webhook_url": "http://example.com"
}

Create Webhook Subscription

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)
Request Body schema: application/json
required
required
object (WebhookCustomConfig)
custom_presenter
required
string (ExternalApiWebhookPresenter)
Enum: "default" "simple"

Allows API consumers to choose between a simplified or more detailed webhook data format.

Include Event History (boolean) or Include Event History (null) (Include Event History)
Retailer Code (string) or Retailer Code (null) (Retailer Code)
subscribed_events
required
Array of strings (Subscribed Events)
Items Enum: "new_shipment_to_customer" "new_shipment_to_retailer" "new_c2c_shipment" "new_l2l_collection_shipment" "sortation_scan" "pitstop_shipment_checkin" "lm_out_for_delivery" "lm_delivery_failed" "handed_to_customer" "left_in_safe_place" "handed_to_neighbour" "pod_upload" "agent_flagged_as_lost" "automatic_cleanup_lost" "agent_flagged_as_return_to_sender" "sortation_exception_return_to_sender" "sortation_exception_discard" "too_many_attempts_rts" "retailer_cancelled" "sortation_intake_scan" "rts_dispatch_scan" "customer_refused_delivery_rts" "pitstop_unavailable_rts" "inbound_intake_scan" "handed_to_retailer" "collected_by_customer" "collected_by_sender" "awaiting_customer_collection" "awaiting_sender_collection" "customer_collection_requested" "collection_expiry_reminder" "collection_expired" "collection_expired_converted_to_delivery" "assign_to_route" "lm_delivery_did_not_attempt" "rts_intake_scan" "drop_off_expired" "shipment_discarded" "sortation_box_scan_received" "pitstop_destination_redirected" "pitstop_origin_redirected" "sender_dropped_off_at_pitstop" "sortation_scan_after_failed_delivery" "assigned_to_delivery_route" "out_for_delivery" "delivery_attempt_failed" "delivery_not_attempted" "customer_collection_delayed" "collection_expired_rts" "rts_sortation_scan" "sender_collection_expiry_reminder" "sender_collection_expired" "agent_flagged_as_rts" "sortation_exception_rts" "exception_oversized" "exception_damaged" "exception_oversized_discard" "exception_discard" "flagged_as_lost"
webhook_url
required
string <uri> (Webhook Url) [ 1 .. 2083 ] characters

Responses

Request samples

Content type
application/json
{
  • "custom_config": {
    },
  • "custom_presenter": "default",
  • "include_event_history": true,
  • "retailer_code": "string",
  • "subscribed_events": [
    ],
  • "webhook_url": "http://example.com"
}

Response samples

Content type
application/json
{
  • "created_at": "2019-08-24T14:15:22Z",
  • "custom_config": {
    },
  • "custom_presenter": "default",
  • "detail": "string",
  • "include_event_history": true,
  • "subscribed_events": [
    ],
  • "updated_at": "2019-08-24T14:15:22Z",
  • "webhook_uid": "e00a5c66-81c3-4565-a0c1-eaf5f6e2efe1",
  • "webhook_url": "http://example.com"
}

Delete Webhook Subscription

Authorizations:
HTTPRelayHTTPBasicHTTPBearer
path Parameters
webhook_uid
required
string (Webhook Uid)
query Parameters
Retailer Code (string) or Retailer Code (null) (Retailer Code)
header Parameters
Forwarded (string) or Forwarded (null) (Forwarded)

Responses

Response samples

Content type
application/json
{
  • "detail": "string",
  • "webhook_uid": "e00a5c66-81c3-4565-a0c1-eaf5f6e2efe1"
}