Webhooks
PublicX sends one HTTPS POST to your endpoint for each event your company may see.
Setting up an endpoint
- In PublicX: Settings > Webhooks, for members with the Manage integrations permission. There you also see each delivery, resend one, or replay every failed delivery since a time.
- With the API:
POST /v1/webhook-endpoints, with a key that haswebhooks:writeand the read scope of every event type you pick. See the reference.
curl -X POST https://api.publicx.ai/v1/webhook-endpoints \
-H "Authorization: Bearer $PUBLICX_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/publicx", "event_types": ["saved_tender.stage_changed"], "filters": {"stages": ["go"]}}'
- The answer includes the endpoint's signing secret (
whsec_...), only this once. Keep it with your receiver. - Filters narrow an endpoint further:
search_ids(shared saved searches, fortender.matched);stages(for stage changes);days_before(14, 7, 3 or 1, for approaching deadlines);board_ids(for board events);countries.
- An endpoint an API key created belongs to that key. Rolling the key moves the endpoint to the new key. Revoking the key pauses it.
- Limits: Starter can have 2 endpoints, Pro 10 and Enterprise 50. Trials count as Pro.
- Send a test event with
POST /v1/webhook-endpoints/{id}/test, which sends awebhook.testevent.
What your endpoint receives
POST /publicx HTTP/1.1
Content-Type: application/json
User-Agent: PublicX-Webhooks/1
webhook-id: evt_01JDZ3Q6M8T4X2F7K9V0B5N1RC
webhook-timestamp: 1795429443
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=
{
"id": "evt_01JDZ3Q6M8T4X2F7K9V0B5N1RC",
"type": "saved_tender.stage_changed",
"api_version": "2027-01-01",
"timestamp": "2026-11-23T10:14:03.512Z",
"company_id": "4b1e...",
"data": {
"tender": { "id": "6f1c...", "name": "...", "entity": "...", "deadline_at": "...", "app_url": "..." },
"saved_tender": { "stage": "go", "previous_stage": "analysis", "updated_at": "..." },
"actor": { "type": "user", "id": "9a7d...", "name": "Ana Costa" }
}
}
webhook-idis the event id. It stays the same on every retry, so deduplicate on it.- Values: names, titles and text are read when the request is sent, so a retry carries the current values. Ids and stages are those of the moment the event happened.
actorsays who did it: a member, the PublicX assistant, an API key or PublicX itself.
Event types
| Type | When | Scope | Starter |
|---|---|---|---|
tender.matched |
A new tender matches one of your company's shared saved searches | tenders:read |
Yes |
saved_tender.created |
A tender is saved to your pipeline | saved:read |
|
saved_tender.stage_changed |
A saved tender moves to another stage | saved:read |
|
saved_tender.deleted |
A tender leaves your pipeline | saved:read |
|
saved_tender.result_published |
The award result of a saved tender is published | saved:read |
|
tender.deadline_approaching |
14, 7, 3 and 1 days before a saved tender's deadline | saved:read |
Yes |
tender.deadline_changed |
A saved tender's deadline changes | saved:read |
Yes |
tender.deadline_passed |
A saved tender's deadline passes | saved:read |
Yes |
analysis.completed |
The AI analysis of a saved tender against your company is ready | saved:read |
|
document.created, document.updated, document.deleted |
A proposal document changes | documents:read |
|
certificate.expiring |
A certificate in your company documents is about to expire | documents:read |
|
board.task_created, board.task_updated, board.task_deleted |
A board task changes | boards:read |
|
board.comment_created |
Someone comments on a board task | boards:read |
|
renewal.due |
A contract you watch is about to end and may be tendered again | saved:read |
|
renewal.published |
The new tender for a contract you watch is published | saved:read |
|
radar.recommended |
The Tender Radar recommends a tender | Settings only | Yes |
award.published |
A contract is awarded to a buyer or competitor you follow | Settings only |
- Plans: events also need the plan feature behind them, such as boards for board events.
- "Settings only" event types go to endpoints created in Settings > Webhooks, not to endpoints an API key creates.
- Private saved searches never reach a company endpoint.
Verifying a signature
Every request is signed following Standard Webhooks. Its libraries (Go, Python, JavaScript, PHP, Java, Ruby, C#, Rust, Elixir) do all of this for you.
- The signature is HMAC-SHA256, keyed with the base64 part of the
whsec_secret. - It's computed over
webhook-id + "." + webhook-timestamp + "." + body, using the body's exact bytes. Read the raw body before parsing it. webhook-signatureholdsv1,<base64>. While a secret is being rolled, it holds two of them, separated by a space; accept the request if any one matches.- Reject timestamps more than 5 minutes away from your clock.
Node:
import crypto from "node:crypto";
function verify(secret, headers, rawBody) {
const id = headers["webhook-id"], ts = headers["webhook-timestamp"];
if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const want = crypto.createHmac("sha256", key).update(`${id}.${ts}.`).update(rawBody).digest();
return headers["webhook-signature"].split(" ").some((entry) => {
const [version, sig] = entry.split(",");
const got = Buffer.from(sig ?? "", "base64");
return version === "v1" && got.length === want.length && crypto.timingSafeEqual(got, want);
});
}
Python:
import base64, hashlib, hmac, time
def verify(secret: str, headers: dict, raw_body: bytes) -> bool:
msg_id, ts = headers["webhook-id"], headers["webhook-timestamp"]
if abs(time.time() - int(ts)) > 300:
return False
key = base64.b64decode(secret.removeprefix("whsec_"))
want = hmac.new(key, f"{msg_id}.{ts}.".encode() + raw_body, hashlib.sha256).digest()
for entry in headers["webhook-signature"].split():
version, _, sig = entry.partition(",")
if version == "v1" and hmac.compare_digest(base64.b64decode(sig or "="), want):
return True
return False
Delivery and retries
- Success is any
2xxwithin 15 seconds. - Anything else is retried 5 s, 5 min, 30 min, 2 h, 5 h, 10 h, 14 h, 20 h and 24 h after the previous attempt, with up to 10% jitter. So ten attempts span about three days.
429,502,503and504are retried after yourRetry-After(seconds or a date), up to 6 hours.- Redirects are never followed. A
3xxcounts as a failure. 410 Gonedisables the endpoint at once.- Ten failures in a row pause the endpoint for a while. Then one delivery tests it before the rest follow.
- No success for 5 days, with at least 20 failures, disables the endpoint. Its managers get a notice and an email.
- Delivery is at least once, and events aren't ordered. Deduplicate on
webhook-id, and keep the object with the newestupdated_at. - Failed deliveries are kept for 30 days, to resend or replay under the same
webhook-id.
Addresses
- HTTPS only, on port 443, 8443 or any port above 1023.
- Never private, loopback, link-local, CGNAT, NAT64, 6to4 or Teredo addresses, nor PublicX's own hosts.
- Every resolved address is checked again when PublicX connects.
Polling instead
GET /v1/events lists the last 30 days of events your key may see, newest first, in the same envelope. Filter it with type and since. A page can hold fewer items than limit, so follow next_cursor. Events are kept for companies that have a key with webhooks:write.