Skip to main content

Create Callback

Register a new webhook callback so ECGrid posts a JSON notification to your endpoint when a specified event occurs.

Endpoint

POST /v2/callbacks/create

Request Body

FieldTypeRequiredConstraintsDescription
urlstringYesHTTPS onlyThe webhook URL ECGrid will POST to when the event fires.
eventObjectsYesSee ENUMsThe ECGrid event type that triggers this callback.
mailboxIdintNoScope the callback to a specific mailbox. Omit for network-wide.
networkIdintNoScope the callback to a specific network.
httpAuthTypeHTTPAuthTypeNoSee ENUMsAuthentication method ECGrid uses when calling your endpoint.
usernamestringNoUsername for HTTP authentication (required if httpAuthType is not None).
passwordstringNoPassword for HTTP authentication (required if httpAuthType is not None).
{
"url": "https://app.example.com/webhooks/ecgrid",
"event": "Parcel",
"mailboxId": 12345,
"httpAuthType": "Basic",
"username": "webhook_user",
"password": "s3cr3t!"
}
note

The callback URL must use HTTPS. ECGrid will POST a JSON payload to this URL whenever the specified event fires on the scoped mailbox or network.

Response

Returns the newly created callback record, including the assigned callbackId.

{
"success": true,
"data": {
"callbackId": 7001,
"url": "https://app.example.com/webhooks/ecgrid",
"event": "Parcel",
"mailboxId": 12345,
"networkId": 0,
"httpAuthType": "Basic",
"status": "Active"
}
}

ENUMs

Objects

ValueDescription
ParcelTriggered on parcel events (received, sent, error)
InterchangeTriggered on interchange-level events
InterconnectTriggered on partner interconnect status changes
UserTriggered on user account events
MailboxTriggered on mailbox configuration changes
NetworkTriggered on network-level events

See Enums Reference for the complete Objects ENUM.

HTTPAuthType

ValueDescription
NoneNo authentication — endpoint is open
BasicHTTP Basic authentication
DigestHTTP Digest authentication

Code Examples

curl -X POST "https://rest.ecgrid.io/v2/callbacks/create" \
-H "X-API-Key: $ECGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://app.example.com/webhooks/ecgrid", "event": "Parcel", "mailboxId": 12345, "httpAuthType": "Basic", "username": "webhook_user", "password": "s3cr3t!" }'

See Also