## Documentation Index Fetch the complete documentation index at: https://docs.relay.link/llms.txt Use this file to discover all available pages before exploring further.
## Agent Instructions To quote bridges and swaps, look up chains and tokens, or track Relay transactions from an agent, use the Relay MCP server: npx -y @relayprotocol/relay-mcp. It is read-only and does not sign or broadcast transactions. Setup: https://docs.relay.link/resources/developing-with-ai.md For Relay Protocol's trust model, security architecture, and audits, see https://docs.relay.link/references/protocol/security.md. For address screening, see https://docs.relay.link/security/transaction-screening.md.Webhooks
Simplify your Integration with Low-Latency Relay Webhooks
Building applications at scale requires integrating with Relay's system at instant speed. Rather than polling the API for status updates, webhooks push transaction lifecycle events directly to your server the moment they happen. Configure a webhook endpoint and Relay will notify your backend in real time as quotes are processed — lightweight, no polling, low latency.
Configuring a Webhook
Webhooks are self-serve in the Relay Dashboard. Each App can have one webhook endpoint. Relay posts events to this endpoint for requests made with any API key in the App. To configure one:
- Sign in to the Relay Dashboard.
- Open Apps and select the App you want to configure.
- Open the Advanced tab. In the Webhooks section, click Configure.
- Enable the webhook and enter your Webhook URL — an HTTPS endpoint to POST to when the status of a request changes (e.g.
https://my.server/receive-relay-event). - Optionally add Custom Headers to include on every webhook request (e.g.
Authorization: Bearer 0x123), then save.
Destination restrictions
Relay validates the webhook destination when you save a configuration and again at delivery time, so a configuration that passes save-time checks will still be refused on delivery if the hostname later resolves to a blocked address. Invalid configurations are rejected with a 400 from the save endpoint; invalid destinations detected at delivery time cause the event to be skipped and recorded in delivery logs.
URL requirements:
- Must use the
httporhttpsscheme — other schemes are rejected. - Must not embed credentials (
https://user:pass@host). - Must not resolve to a loopback, private, link-local, or otherwise reserved IP range. Every DNS answer for the hostname is checked at both save time and delivery time.
- Redirects are not followed. Point the configured URL directly at the endpoint that should receive events.
Custom header restrictions:
- Header names must match
[A-Za-z0-9-]+, and header values must not contain carriage returns or line feeds. - The following headers cannot be set as custom headers, because they would override routing or HTTP framing:
Host,Connection,Keep-Alive,Proxy-Authenticate,Proxy-Authorization,Proxy-Connection,TE,Trailer,Transfer-Encoding,Upgrade,Content-Length.
[!NOTE] If you host the receiving endpoint behind infrastructure that only exposes an internal-range IP, point the webhook at a publicly reachable gateway or proxy (for example, Hookdeck) rather than the internal host directly.
Webhook Events
Relay Webhooks specifically stream transaction statuses for both cross and same-chain status, though the stages differ slightly.
| status | indication | |
|---|---|---|
| waiting | waiting for origin chain deposit | |
| depositing | origin deposit confirmed via /execute API, fill pending | |
| pending | origin chain deposit confirmed, fill pending submission | |
| submitted | fill submitted on destination chain | |
| success | fill succeeded | |
| failure | fill failed | |
| refund | refunded |
Only success and refund are final. A failure can still move back to pending on a retry or on to refund, so do not treat it as the last event for a request. See Get Status for the full lifecycle.
Example Payload
{
"event": "request.status.updated",
"timestamp": 1774993296140,
"data": {
"status": "refund",
"inTxHashes": [
"0x..."
],
"txHashes": [],
"updatedAt": 1774993296121,
"originChainId": 8453,
"destinationChainId": 42161,
"depositAddress": {
"address": "0x..",
"depositAddressType": "open", // open / strict
"depositor": "0x..", //nullable
"depositTxHash": "0x..", //nullable — origin-chain tx hash of the depositor's transfer into the deposit address
}, //nullable
"requestId": "0x...",
"referrer": "your-referrer", //nullable — echoes the referrer supplied on the originating quote request
"details": null,
"failReason": "DOUBLE_SPEND",
"refundFailReason": "N/A"
}
}The referrer field echoes the value supplied on the originating quote request, or null if no referrer was provided. Use it to attribute webhook events back to the request source (campaign, partner, or integration surface) without an extra lookup.
The details, failReason, and refundFailReason fields mirror the same fields returned by `GET /intents/status/v3`:
| Field | Description | |
|---|---|---|
details | Additional status context (e.g. decoded revert data on failures). null when no extra detail is available. | |
failReason | Reason a fill failed. Returns "N/A" on non-failure statuses. On failure, fallback, and refund statuses, returns the recorded reason or "UNKNOWN" when no specific reason is available. See `/intents/status/v3` for the enum. | |
refundFailReason | Reason a refund leg failed. Defaults to "N/A" when no refund-leg failure is recorded. See `/intents/status/v3` for the enum. |
For deposit-address requests, events are sent under the requestId that owns the fill. If Relay regenerates the quote, events carry the new requestId and nothing is sent for the quote-time one. Match these events to your order with depositAddress.address, and to the funding transfer with depositAddress.depositTxHash. See Tracking Transactions.
By default we post all status updates. If you're only interested in certain statuses you can filter on the status property in your endpoint.
Verification
Each webhook request includes two headers for verification:
| Header | Description | |
|---|---|---|
X-Signature-Timestamp | Unix timestamp of when the webhook was sent | |
X-Signature-SHA256 | HMAC-SHA256 signature of the request |
Relay signs each event with the API key used for the request. To verify a webhook is authentic, compute the HMAC-SHA256 hash of ${timestamp}.${body} using that API key as the secret, and compare it to the X-Signature-SHA256 header value.
The App's webhook receives events for requests made with any active key in the App. Check the signature against each of these keys. During a key rotation, that means both the old and the new key. Relay stops sending events for a key's requests once you deactivate it, including requests that are still in progress.
import crypto from 'crypto';
function verifyWebhook(req, apiKeys) {
const timestamp = req.headers['x-signature-timestamp'];
const signature = req.headers['x-signature-sha256'];
const body = JSON.stringify(req.body);
const signatureBuffer = Buffer.from(signature, 'hex');
return apiKeys.some((apiKey) => {
const expectedBuffer = crypto
.createHmac('sha256', apiKey)
.update(`${timestamp}.${body}`)
.digest();
return (
signatureBuffer.length === expectedBuffer.length &&
crypto.timingSafeEqual(signatureBuffer, expectedBuffer)
);
});
}Requests that fail verification should be rejected with a non-2xx status code.
Webhook Delivery & Reliability
Relay's built-in webhook service includes up to 10 retries with exponential backoff. For most integrations, this is sufficient.
For production deployments requiring guaranteed delivery, routing, fan-out, or detailed observability, we recommend using a webhook gateway like Hookdeck. A gateway sits between Relay and your server, giving you:
- Guaranteed delivery with configurable retry policies
- Routing & fan-out to multiple destinations from a single source
- Event inspection & replay for debugging
- Rate limiting to match your server's capacity
To set this up, use your Hookdeck ingestion URL as the Relay webhook endpoint and route events to your server from there. See Hookdeck's getting started guide for setup instructions.
This documentation is built and hosted on Mintlify, a developer documentation platform.