Sign In

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

{ "event": "ORDER_ADD", "event_date": "2024-03-23T15:09:22Z", "event_payload": { ... } } Copy

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.


POST /v1/deliveries

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

curl -X POST shipping.webhooks.gpcoservices.com/v1/deliveries \ -H "GPC-Api-Key: {key}" \ -d event="ORDER_ADD" \ -d event_date="2024-03-23T15:09:22Z" \ -d "event_payload[customer]"="b3a3017a-4d9e-41a2-95a4-cc90330227d8" \ -d "event_payload[location]"="46424e5c-0b5d-424c-aa36-5d04faeed6d8" \ -d "event_payload[order_id]"="5323443" \ -d "event_payload[status]"="pending" \ -d "event_payload[address]"="4719 Ivanrest Ave SW, Grandville, MI 49418" \ -d "event_payload[delivery_date]"="2024-03-24T15:09:22Z" Copy

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

curl -X POST shipping.webhooks.gpcoservices.com/v1/deliveries \ -H "GPC-Api-Key: {key}" \ -d event="ORDER_UPDATE" \ -d event_date="2024-03-23T15:09:22Z" \ -d "event_payload[order_id]"="5323443" \ -d "event_payload[status]"="in_progress" \ -d "event_payload[address]"="4719 Ivanrest Ave SW, Grandville, MI 49418" \ -d "event_payload[delivery_date]"="2024-03-24T15:09:22Z" Copy

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

curl -X POST shipping.webhooks.gpcoservices.com/v1/deliveries \ -H "GPC-Api-Key: {key}" \ -d event="ORDER_COMPLETE" \ -d event_date="2024-03-23T15:09:22Z" \ -d "event_payload[order_id]"="5323443" \ -d "event_payload[address]"="4719 Ivanrest Ave SW, Grandville, MI 49418" \ -d "event_payload[delivery_date]"="2024-03-24T15:09:22Z" \ -d "event_payload[pod]"="data:image/jpeg;base64,/9j/4gHYSUNDX1BST0Z=" \ -d "event_payload[recipient]"="John Smith" \ -d "event_payload[signature]"="data:image/jpeg;base64,/9j/4gHYSUNDX1BST0Z=" Copy

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.

Request

POST /v1/deliveries

curl -X POST shipping.webhooks.gpcoservices.com/v1/deliveries \ -H "GPC-Api-Key: {key}" \ -d event="ORDER_CANCELED" \ -d event_date="2024-03-23T15:09:22Z" \ -d "event_payload[order_id]"="5323443" \ -d "event_payload[reason]"="Customer requested cancellation." Copy