πŸ“©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/show endpoints, passing the webhook's id (returned by this API) as their user_id parameter and bot: 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_key

Rate 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 as user_id when calling /publicapi/wallets/* to attach addresses.

  • auth_header_set β€” whether an Authorization header is configured. The value itself is never returned.

  • status β€” one of send, pause, expired. Only send counts toward used.

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:

  • url required, ≀500 characters, must be https://. Hostnames localhost, .local, .internal, and private / loopback / link-local / ULA IPs (both IPv4 and IPv6) are rejected.

  • label optional, ≀50 characters.

  • auth_header optional, ≀200 characters. Sent verbatim as the Authorization header 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) or WEBHOOK_LIMIT_REACHED (already at cap)

  • 422: TEST_FAILED β€” the verification POST did not succeed; the response body includes upstream_status and error

  • 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 token

Path 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 token

Path Parameters:

  • id (string, required): Webhook id

Request Body (any subset):

Validation / Semantics:

  • label β€” same rules as create. null or "" clears it.

  • auth_header β€” same rules as create. null or "" removes the stored header.

  • active β€” toggle delivery:

    • false β†’ pauses the webhook (status: "pause") and sets every active address on the webhook to pause.

    • true β†’ resumes delivery (status: "send"), resets consecutive_failures to 0, and restores paused addresses to active.

  • Passing a url field returns 400 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 token

Path 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 token

Path 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 includes upstream_status, error, latency_ms

  • 429: Rate limit exceeded


πŸ”— Managing Addresses

Use the existing /publicapi/wallets/* endpoints, setting:

  • user_id = the webhook's id (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:

Code
HTTP
When

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