DocumentationAPI v1
API Reference • Real-Time Event Delivery

Webhooks

POST/api/v1/createTask
Manage in Dashboard → Webhooks

Instead of polling, ByeCap can POST a task's final result directly to your server. Account webhook endpoints configured in Dashboard → Webhooks can also subscribe to account events such as low balance alerts, completed deposits, refunds, and expiring API keys or quota packages.

Two Ways to Receive Webhooks

AspectPer-Task CallbackAccount Endpoint (Dashboard)
SetupPass webhook_url or callbackUrl inside POST /createTask.Add an endpoint URL in Dashboard → Webhooks and toggle the events you want.
EventsThat task's final result (task.solved / task.failed or flat getTaskResult payload).task.solved, task.failed, plus account & billing events (balance.low, payment.*, key.expiring).
Signed WithYour account's default webhook signing secret.The endpoint's dedicated secret (whsec_...).
Webhooks complement—rather than replace—polling. Task results remain retrievable via POST /api/v1/getTaskResult for 10 minutes as a fallback in case your receiver experiences a network outage.

Per-Task Callbacks

Attach webhook_url (or callbackUrl for CapSolver/Anti-Captcha compatibility) when creating a task. Passing null or an empty string disables the callback. Invalid URLs are rejected immediately at task creation with zero charge.

POST /api/v1/createTask (with callbackUrl)
curl -X POST https://api.byecap.org/api/v1/createTask \
  -H "Content-Type: application/json" \
  -d '{
    "clientKey": "YOUR_API_KEY",
    "callbackUrl": "https://api.myapp.io/webhooks/byecap",
    "task": {
      "type": "RecaptchaV2TaskProxyless",
      "websiteURL": "https://example.com/login",
      "websiteKey": "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-"
    }
  }'

Account Endpoints & Delivery History

Endpoint Management

Configure up to 10 webhook endpoints in Dashboard → Webhooks. Each endpoint has its own whsec_... signing secret, independent event subscriptions, and 1-click webhook.test delivery.

Auto-Disable & 7-Day Logs

Delivery logs (HTTP status, latency, attempt count) are retained for 7 days. Any endpoint failing continuously for 24 hours is automatically paused and can be re-enabled from the Dashboard once healthy.

Webhook Events

Account events are only delivered to subscribed Dashboard endpoints—never to per-task callbackUrl receivers. Always ignore unrecognized event types and respond with 2xx so future event additions never break your handler.

EventTriggered Whendata Payload
task.solvedA captcha task finished with a verified solutionFull task object identical to POST /getTaskResult (id, type, status, solution, cost)
task.failedA task ended without a solution (100% auto-refunded)Task object with status: "failed" and error details explaining the cause
balance.lowWallet balance drops below your configured alert thresholdbalance, threshold, currency
payment.succeededA wallet top-up (Bank QR, USDT, or Card) settles and credits your balanceid, amount, currency, created_at, credited_at (alias: deposit.completed)
payment.refundedA top-up refund is completedid, payment_id, amount, currency, refunded_at
payment.disputedA payment dispute / chargeback is opened on a top-upid, payment_id, amount, currency, opened_at
key.expiringAn API key with an expiration date expires within 7 days (or quota package within 48h)id, name, prefix, last4, mode, expires_at (package alias: package.expiring)
webhook.testYou click "Send Test Event" on an endpoint in Dashboard → Webhooksendpoint_id and test confirmation message

Event Body Formats

Event Envelope (task.solved)
{
  "type": "task.solved",
  "timestamp": "2026-12-05T08:00:07.456Z",
  "data": {
    "id": "7259140378796032",
    "type": "RecaptchaV2TaskProxyless",
    "status": "ready",
    "solution": {
      "gRecaptchaResponse": "03AFcWeA..."
    },
    "error": null,
    "cost": { "amount": "0.000800", "currency": "USD" },
    "created_at": "2026-12-05T08:00:01.120Z",
    "completed_at": "2026-12-05T08:00:07.456Z"
  }
}
Account Event (balance.low & payment.succeeded)
// balance.low
{
  "type": "balance.low",
  "timestamp": "2026-12-05T08:00:07.456Z",
  "data": {
    "balance": "4.500000",
    "threshold": "5.000000",
    "currency": "USD"
  }
}

// payment.succeeded
{
  "type": "payment.succeeded",
  "timestamp": "2026-12-05T08:00:07.456Z",
  "data": {
    "id": "tp_3k9x0q2m8w1v7c5b4n6z",
    "amount": "20.000000",
    "currency": "USD",
    "created_at": "2026-12-05T07:58:40.120Z",
    "credited_at": "2026-12-05T08:00:07.456Z"
  }
}

Headers & Signature Verification

HeaderDescription
webhook-idUnique message ID. Remains identical across every retry and manual resend (e.g. msg_t7259140378796032, msg_t..._cb, msg_test_...).
webhook-timestampUnix timestamp in seconds when this delivery attempt was sent.
webhook-signatureOne or more space-separated v1,<base64-signature> entries (multiple entries appear during secret rotation grace periods).
Content-Typeapplication/json
Standard Webhooks HMAC-SHA256 Algorithm
  1. Read the raw request body bytes before parsing JSON—never re-serialize.
  2. Build the signed string: <webhook-id>.<webhook-timestamp>.<raw body>.
  3. Strip the whsec_ prefix from your secret and Base64-decode it to get the signing key.
  4. Compute base64(HMAC-SHA256(key, signed)) and compare in constant time against every v1,<sig> entry in webhook-signature.
  5. Reject requests whose webhook-timestamp drifts more than 5 minutes (300s) from your server clock to prevent replay attacks.
Zero-Downtime Secret Rotation: Never commit whsec_... secrets to source control. After rotating a secret in the Dashboard, both the new and previous secrets sign requests for 24 hours so you can roll out the updated secret without dropping events.
Signature Verification Examples
import base64, hashlib, hmac, time

def verify_webhook(secret: str, headers: dict, raw_body: bytes, tolerance: int = 300) -> bool:
    """secret: "whsec_..."; headers: lower-cased header dict; raw_body: raw request bytes."""
    msg_id = headers.get("webhook-id", "")
    timestamp = headers.get("webhook-timestamp", "")
    try:
        if abs(time.time() - int(timestamp)) > tolerance:
            return False
    except ValueError:
        return False

    key = base64.b64decode(secret.removeprefix("whsec_"))
    signed = f"{msg_id}.{timestamp}.".encode("utf-8") + raw_body
    expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode("ascii")

    for entry in headers.get("webhook-signature", "").split():
        version, _, sig = entry.partition(",")
        if version == "v1" and hmac.compare_digest(sig.encode(), expected.encode()):
            return True
    return False
Delivery, Retries & Deduplication
  • Any 2xx HTTP status within 5 seconds acknowledges delivery; redirects are not followed.
  • Task events retry at 5s, 25s, 60s, 150s, 300s (±10%) up to the 10-minute result retention window.
  • Account events retry up to 8 times over 24 hours (5s, 5m, 30m, 1h, 2h, 4h, 8h, 8h).
  • Deliveries are at-least-once and may arrive out of order: deduplicate on webhook-id and make handlers idempotent on data.id.
Callback URL Validation Rules
  • Scheme must be https (recommended) or http on ports 80, 443, 8080, 8443.
  • Maximum length 2,048 bytes; embedded credentials (user:pass@) and #fragments are rejected.
  • Host must resolve strictly to public IP addresses—private, loopback (127.0.0.1), and link-local ranges are blocked at both creation and delivery time.
  • The legacy 2Captcha pingback field is not supported—use webhook_url or callbackUrl.