Skip to main content
Grid tells your backend about agent activity with the same signed webhooks it uses for everything else. Configure your endpoint in the dashboard, then handle the events below.

Agent events

The money itself moves with the standard INCOMING_PAYMENT and OUTGOING_PAYMENT webhooks, and agent cards send the same card status and card transaction webhooks as any card.

Pending approval example

Handling agent webhooks

  • Respond 200 quickly and do the work asynchronously. A webhook whose id you have already processed can be acknowledged and skipped.
  • On AGENT_ACTION.PENDING_APPROVAL, notify the customer immediately. A send without priceTolerance expires with its quote, often within minutes.
  • Don’t rely on webhooks alone for the approval queue. GET /agents/approvals rebuilds it if your endpoint was down.
  • Send a signed test event to your endpoint at any time with POST /webhooks/test.
All webhooks sent by the Grid API include a signature in the X-Grid-Signature header, which allows you to verify the authenticity of the webhook. This is critical for security, as it ensures that only legitimate webhooks from Grid are processed by your system.

Signature Verification Process

  1. Obtain your Grid public key
    • This is available in your dashboard under Developers webhook settings.
    • The key is in PEM format and can be used with standard cryptographic libraries
  2. Verify incoming webhooks
    • Extract the signature from the X-Grid-Signature header
    • Decode the base64 signature
    • Create a SHA-256 hash of the entire request body
    • Verify the signature using the Grid webhook public key and the hash
    • Only process the webhook if the signature verification succeeds

Verification Examples

Node.js Example

Python Example

Testing

To test your webhook implementation, you can trigger a test webhook from the Grid dashboard. This will send a test webhook to the endpoint you provided during the integration process. The test webhook will also be sent automatically when you update your platform configuration with a new webhook URL. An example of the test webhook payload is shown below:
You should verify the signature of the webhook using the Grid public key and the process outlined in the Signature Verification Process section and then reply with a 200 OK response to acknowledge receipt of the webhook.

Security Considerations

  • Always verify signatures: Never process webhooks without verifying their signatures.
  • Use HTTPS: Ensure your webhook endpoint uses HTTPS to prevent man-in-the-middle attacks.
  • Implement idempotency: Use the id field to prevent processing duplicate webhooks.
  • Timeout handling: Implement proper timeout handling and respond to webhooks promptly.

Retry Policy

The Grid API will retry webhooks with the following policy based on the webhook type: