π©Webhooks API
Manage webhook notification destinations via the public API.
A webhook is a destination that receives HTTPS POST requests whenever a followed wallet produces a notification β the same events the Telegram bots deliver to chats.
Attaching wallets to a webhook is a separate step. This API only manages the webhook destination itself (URL, label, auth header, pause/resume). To add or remove the addresses that feed into a webhook, reuse the existing
/publicapi/wallets/add,/publicapi/wallets/delete, and/publicapi/wallets/showendpoints, passing the webhook'sid(returned by this API) as theiruser_idparameter andbot: 0.
π Base URL
All requests are made to:
https://webapi.raybot.appπ Authentication
Same as the rest of /publicapi β obtain an API key with /api in the RayBot Telegram Bot and pass it on every request.
Required Query Parameters:
api_user(string, required): Your API user ID
token(string, required): API authentication token
GET /publicapi/webhooks?api_user=your_user_id&token=your_api_keyRate Limits
Public API endpoints (/publicapi): β 5 requests per 10 seconds
Plan gating
Webhooks are a paid feature. Your plan determines how many active webhooks you can have at once (paused and expired webhooks do not count toward the cap). On a free plan the cap is 0 β POST /publicapi/webhooks returns 403 WEBHOOK_NOT_AVAILABLE.
π Endpoints
List Webhooks
Endpoint: GET /publicapi/webhooks
Return every webhook owned by the caller (excluding soft-deleted ones), along with the plan's webhook limit and the number currently in use.
Parameters:
Query Parameters:
api_user(string, required): Your API user ID
token(string, required): API authentication token
Response:
idβ use this asuser_idwhen calling/publicapi/wallets/*to attach addresses.
auth_header_setβ whether anAuthorizationheader is configured. The value itself is never returned.
statusβ one ofsend,pause,expired. Onlysendcounts towardused.
Status Codes:
200: Success
400: Invalid authentication parameters
401: Invalid authentication
429: Rate limit exceeded
Create Webhook
Endpoint: POST /publicapi/webhooks
Register a new webhook destination. The server sends a verification POST to the URL during creation and refuses to persist the webhook if that call does not return a 2xx response.
Parameters:
Query Parameters:
api_user(string, required): Your API user ID
token(string, required): API authentication token
Request Body:
Validation Rules:
urlrequired, β€500 characters, must behttps://. Hostnameslocalhost,.local,.internal, and private / loopback / link-local / ULA IPs (both IPv4 and IPv6) are rejected.
labeloptional, β€50 characters.
auth_headeroptional, β€200 characters. Sent verbatim as theAuthorizationheader on deliveries.
Verification Payload
While creating the webhook, the server POSTs this to your URL (5-second timeout, no redirects):
Headers: Content-Type: application/json, User-Agent: RayBot-Webhook/1.0, X-RayBot-Event: test, plus Authorization: <auth_header> if you set one. Reply with any 2xx status to accept.
Response:
Status Codes:
201: Webhook created
400: Validation error (INVALID_URL,INVALID_LABEL,INVALID_AUTH_HEADER)
401: Invalid authentication
403: Plan limits βWEBHOOK_NOT_AVAILABLE(plan has 0 webhooks) orWEBHOOK_LIMIT_REACHED(already at cap)
422:TEST_FAILEDβ the verification POST did not succeed; the response body includesupstream_statusanderror
429: Rate limit exceeded
Get Webhook
Endpoint: GET /publicapi/webhooks/{id}
Return a single webhook by id.
Parameters:
Query Parameters:
api_user(string, required): Your API user ID
token(string, required): API authentication tokenPath Parameters:
id(string, required): Webhook id returned from create/list.
Response: Same object shape as an item in the list response.
Status Codes:
200: Success
401: Invalid authentication
404:WEBHOOK_NOT_FOUND
429: Rate limit exceeded
Update Webhook
Endpoint: PATCH /publicapi/webhooks/{id}
Update the mutable fields on a webhook. The URL itself is immutable β to change it, delete and recreate the webhook.
Parameters:
Query Parameters:
api_user(string, required): Your API user ID
token(string, required): API authentication tokenPath Parameters:
id(string, required): Webhook id
Request Body (any subset):
Validation / Semantics:
labelβ same rules as create.nullor""clears it.
auth_headerβ same rules as create.nullor""removes the stored header.
activeβ toggle delivery:
falseβ pauses the webhook (status: "pause") and sets every active address on the webhook topause.
trueβ resumes delivery (status: "send"), resetsconsecutive_failuresto0, and restores paused addresses toactive.Passing a
urlfield returns400 INVALID_URL.
Response: Full webhook object after the update (same shape as create).
Status Codes:
200: Updated
400:INVALID_URL(URL change attempted),INVALID_LABEL,INVALID_AUTH_HEADER
401: Invalid authentication
404:WEBHOOK_NOT_FOUND
429: Rate limit exceeded
Delete Webhook
Endpoint: DELETE /publicapi/webhooks/{id}
Delete the webhook. All addresses attached to it are also deleted. Allowed regardless of plan (free users can clean up after downgrade).
Parameters:
Query Parameters:
api_user(string, required): Your API user ID
token(string, required): API authentication tokenPath Parameters:
id(string, required): Webhook id
Response: Empty body.
Status Codes:
204: Deleted
401: Invalid authentication
404:WEBHOOK_NOT_FOUND
429: Rate limit exceeded
Send Test Delivery
Endpoint: POST /publicapi/webhooks/{id}/test
Send the same verification payload as on creation, using the webhook's current URL and auth header. Useful for confirming a rotated auth_header or diagnosing delivery failures. Does not touch consecutive_failures and does not auto-disable the webhook.
Parameters:
Query Parameters:
api_user(string, required): Your API user ID
token(string, required): API authentication tokenPath Parameters:
id(string, required): Webhook id
Response (success):
Status Codes:
200: Upstream returned 2xx
401: Invalid authentication
404:WEBHOOK_NOT_FOUND
422:TEST_FAILEDβ body includesupstream_status,error,latency_ms
429: Rate limit exceeded
π Managing Addresses
Use the existing /publicapi/wallets/* endpoints, setting:
user_id= the webhook'sid(from list / create / get)bot=0
Addresses attached to a webhook respect the wallet limits that applied when the webhook was created. Use /publicapi/wallets/settings the same way to adjust per-address tx filters.
π¨ Error Codes
Errors returned by this API use a structured envelope:
UNAUTHORIZED
400 / 401
Missing or invalid api_user/token
INVALID_URL
400
URL is malformed, not https, too long, or points at a private/internal host
INVALID_LABEL
400
label exceeds 50 characters
INVALID_AUTH_HEADER
400
auth_header exceeds 200 characters
WEBHOOK_NOT_FOUND
404
No webhook with that id owned by the caller
WEBHOOK_NOT_AVAILABLE
403
Plan limit is 0
WEBHOOK_LIMIT_REACHED
403
Plan limit reached β body includes limit, used
TEST_FAILED
422
Verification POST returned non-2xx or errored β body includes upstream_status, error
RATE_LIMIT_EXCEEDED
429
/publicapi rate limit hit
π¦ Delivery Payload
Real notifications (not test pings) arrive as HTTPS POSTs with these headers:
The body carries the same event schema the Telegram bots render β swaps, transfers, token mints, etc. After 10 consecutive failed deliveries the webhook auto-disables (active: false, status: "pause"); use PATCH β¦ { "active": true } to re-enable once you've fixed the receiver.
π§ SDKs and Examples
JavaScript/Node.js Example
Python Example
Last updated