Delivery Webhook
The Delivery Webhook is an essential part of any courier integration into our API. On this page, we'll dive into the different events you can use to programmatically notify GPC of delivery status changes. We'll look at how to create, update, complete, and cancel deliveries.
Event Model
This Event model contains all the information about the top level structure our API is expecting when receiving a new Webhook Event.
event
enum
required
The name of the event.
Possible enum values
ORDER_ADD
ORDER_UPDATE
ORDER_COMPLETE
ORDER_CANCELED
event_date
utc timestamp
required
The timestamp when the event occurred in UTC.
event_payload
object
required
The event payload. For each specific event data structure refer to the specific event (below).
Example event
Error Codes
api_key_missing
The request's Authorization header did not contain an API key.
invalid_api_key
The API key failed to authenticate. Double check that it has not been rotated.
api_key_forbidden
The API key provided does not have permission to perform the requested action.
insecure_connection
A non-HTTPS request was detected. The exposed API key has been revoked and rotated.
no_body
The request body was empty.
unknown_event
The request body was missing the event type or contained an invalid event.
bad_request
The event payload contains invalid data types or is missing required fields.
not_found
The order with the specified ID could not be located.
locked
The order with the specified ID was previously canceled or completed. It can no longer be modified.
conflict
An order already exists for the specified ID.
server_error
Something went wrong on our end. The GPC development team has been notified.
Add an Order
This ORDER_ADD
event allows you to add a new order between your system and GPC.
Parameters
No parameters.
Attributes
customer
string
required
The ID of the customer who will be receiving the delivery.
location
string
required
The ID of the customer's location where the order will be delivered.
order_id
string
required
status
enum
required
Possible enum values
pending
in_progress
address
string
required
delivery_date
utc timestamp
required
The planned/estimated delivery date.
Returns
An empty 201 Created
response upon success. If an error occurs an Error model will be returned.
Request
POST /v1/deliveries
Update an Order
This ORDER_UPDATE
event allows you to update an order.
Parameters
No parameters.
Attributes
order_id
string
required
status
enum
required
Possible enum values
pending
in_progress
address
string
required
delivery_date
utc timestamp
required
The planned/estimated delivery date.
Returns
An empty 202 Accepted
response upon success. If an error occurs an Error model will be returned.
Request
POST /v1/deliveries
Complete an Order
This ORDER_COMPLETE
event allows you to inform GPC an order has been delivered.
Parameters
No parameters.
Attributes
order_id
string
required
address
string
required
delivery_date
utc timestamp
required
A timestamp of when the delivery occurred.
pod
base64-encoded data url
required
A base64-encoded Data URL image of the delivery location.
recipient
string
required
The name of the person who received and signed for the delivery.
signature
base64-encoded data url
A base64-encoded Data URL image of the recipients signature.
Returns
An empty 202 Accepted
response upon success. If an error occurs an Error model will be returned.
Request
POST /v1/deliveries
Cancel an Order
This ORDER_CANCELED
event allows you to notify GPC that and order has been canceled.
Parameters
No parameters.
Attributes
order_id
string
required
reason
string
required
The reason why the order was canceled.
Returns
An empty 202 Accepted
response upon success. If an error occurs an Error model will be returned.