Webhook format
If you're an Inner Circle member using your own HTTPS endpoint for Knight calls, each event arrives as one HTTPS POST with a signed JSON body. Discord webhooks receive the calls as Discord messages.
Events
postdelivers a new Knight call or closing post.editdelivers the updated version of a post.deletetells you a post was removed.testis a test sent by you or the desk.
Edits and deletes arrive only for posts your link received. They carry the original post's id.
Headers
| Header | Value |
|---|---|
Content-Type | application/json |
User-Agent | KingTradezz-Webhooks/1.0 (+https://kingtradezz.com/webhooks) |
X-KingTradezz-Event | The event name from the body. |
X-KingTradezz-Timestamp | The time of sending in Unix seconds. |
X-KingTradezz-Signature | v1= followed by the HMAC-SHA256 signature in hexadecimal. |
Body
The body is UTF-8 JSON. A delete carries only version, event, id, sent_at and personal_use.
| Field | Meaning |
|---|---|
version | The format version, currently the number 1. |
event | One of the four event names above. |
id | The post ID as a string. A test uses test-<unix seconds>. |
sent_at | When this event was sent, in ISO 8601 UTC. |
posted_at | When the original post appeared, in ISO 8601 UTC. A test uses null. |
author | The poster's name. For a test it is The King's Court. |
content | The text as it appears in the Discord copy, with the formatted personal-use line at the end. |
cards | An array of rich embeds. Each card has a title, description, url, color, timestamp, fields and footer. Each field has a name, value and inline flag. Missing parts are null. A test has an empty array. |
text | The content without its last line, followed by each card's title, description and fields written as Name: value. Each part has its own line. Empty parts are skipped. The personal-use line comes last. |
personal_use | The personal-use line with your display name in plain text. |
Example post
{
"version": 1,
"event": "post",
"id": "example-post-1",
"sent_at": "2099-01-01T00:00:01Z",
"posted_at": "2099-01-01T00:00:00Z",
"author": "The King's Court",
"content": "I entered EXAMPLE-MARKET.\n-# For Alex's personal use only · The King's Court",
"cards": [{
"title": "EXAMPLE-MARKET",
"description": "This is an example fill.",
"url": null,
"color": null,
"timestamp": null,
"fields": [{"name": "My fill", "value": "42¢", "inline": false}],
"footer": null
}],
"text": "I entered EXAMPLE-MARKET.\nEXAMPLE-MARKET\nThis is an example fill.\nMy fill: 42¢\nFor Alex's personal use only · The King's Court",
"personal_use": "For Alex's personal use only · The King's Court"
}
Example delete
{
"version": 1,
"event": "delete",
"id": "example-post-1",
"sent_at": "2099-01-01T00:05:00Z",
"personal_use": "For Alex's personal use only · The King's Court"
}
Checking the signature
Read the raw body bytes before parsing JSON. Take the timestamp header exactly as received, add a period, then append the raw body. Compute HMAC-SHA256 using the UTF-8 bytes of your full signing key, including ktwh_. Compare the result with the hex after v1= in constant time. Reject a timestamp more than five minutes before or after your clock.
These functions take the signing key, timestamp and signature as strings and the raw body as bytes. They return true when the checks pass.
Python
import hashlib, hmac, re, time
def verify(key, timestamp, signature, body):
if not re.fullmatch(r"[0-9]{1,16}", timestamp or ""):
return False
if abs(int(time.time()) - int(timestamp)) > 300:
return False
if not re.fullmatch(r"v1=[0-9a-f]{64}", signature or ""):
return False
message = timestamp.encode("ascii") + b"." + body
expected = hmac.new(key.encode("utf-8"), message, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, signature[3:])
Node
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(key, timestamp, signature, body) {
if (!/^[0-9]{1,16}$/.test(timestamp)) return false;
if (Math.abs(Math.floor(Date.now() / 1000) - Number(timestamp)) > 300) return false;
if (!/^v1=[0-9a-f]{64}$/.test(signature)) return false;
const expected = createHmac('sha256', key).update(timestamp + '.').update(body).digest();
return timingSafeEqual(expected, Buffer.from(signature.slice(3), 'hex'));
}
Answering
Your link needs an IPv4 address; we don't send to IPv6-only hosts. Events for one post arrive in order. Events for different posts can arrive in any order.
Return any 2xx status within 10 seconds to accept an event. We don't follow redirects or retry deliveries. If your link misses a message, it won't receive it again. Return HTTP 410 Gone to switch your integration off.
After three failed deliveries in a row, we tell you and the desk. Your integration stays on. Replacing your link gives you a new signing key.
Personal use
What your webhook receives is for your own use under the terms you agreed to. Every event includes a personal_use line naming you.