Webhooks
Receive solve results via HTTP POST. Skip polling entirely.
How it works
Pass a callback URL in your /api/solve body. You still get a taskId immediately, but instead of polling, VexSolver will POST the full result to your URL as soon as the solve finishes.
Submit with a callback
curl -X POST https://api.vexsolver.com/api/solve \
-H "X-API-Key: sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.target-site.com/path",
"callback": "https://your-server.com/vexsolver-hook"
}'
# → { "taskId": "abc123xyz" }Webhook payload — success
When the solve succeeds, VexSolver POSTs JSON to your callback URL:
{
"taskId": "abc123xyz",
"success": true,
"vendor": "datadome",
"cookies": "datadome=3y1u8z...",
"cookie_map": { "datadome": "3y1u8z..." },
"user_agent": "Mozilla/5.0 ...",
"elapsed_ms": 1840,
"cached": false
}Webhook payload — failure
{
"taskId": "abc123xyz",
"success": false,
"error": "solve failed: timeout",
"vendor": "datadome",
"elapsed_ms": 15000
}Express handler (Node.js)
import express from "express";
const app = express();
app.use(express.json());
app.post("/vexsolver-hook", (req, res) => {
const { taskId, success, cookies, user_agent, vendor, error } = req.body;
if (success) {
console.log("Solve OK", taskId, "vendor:", vendor);
// Store cookies + user_agent keyed by taskId, kick off your real request.
} else {
console.log("Solve FAIL", taskId, error);
}
res.sendStatus(200);
});
app.listen(8080, () => console.log("listening on :8080"));Flask handler (Python)
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.post("/vexsolver-hook")
def hook():
data = request.json
if data["success"]:
print("OK", data["taskId"], data["vendor"])
# store data["cookies"], data["user_agent"]
else:
print("FAIL", data["taskId"], data.get("error"))
return "", 200
app.run(port=8080)Requirements & rules
- Callback URLs must be https://.
- Your endpoint must respond with HTTP 2xx within 10 seconds — otherwise VexSolver treats the delivery as failed (no retry).
- The
taskIdfield lets you match callbacks back to your original requests. - You can still poll
/api/getTaskResulteven if you set a callback — both work.
