Webhooks

Webhooks tell your server when something happens: a post publishes or fails, an account needs reconnecting, a download is ready, a comment arrives. Every delivery is signed, retried when your server is down, and kept in a delivery history.

Add an endpoint

POST /v1/webhooks registers a URL for the events you choose. It needs the webhooks scope.

NameTypeDescription
urlrequiredurlYour HTTPS endpoint.
eventsrequiredstring[]Event types to receive, or ["*"] for all of them.
descriptionstringA note for your team, for example the environment.
profileIdstring | nullOnly receive events about accounts and posts of this profile.
activebooleanTurn deliveries on or off.Default: true
curl -X POST "https://postkea.com/api/v1/webhooks" \
  -H "Authorization: Bearer $POSTKEA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://yourapp.com/webhooks/postkea",
  "events": [
    "post.published",
    "post.partial",
    "post.failed",
    "job.completed"
  ],
  "description": "Production"
}'

The response includes the signing secret (whsec_...) in full. This is the only time it is shown; later reads show only its first characters.

Events

GET /v1/webhooks/events returns this list.

EventWhen it is sent
post.scheduledA post was scheduled or moved to a new time. data.post
post.publishedEvery platform of a post published without warnings. data.post
post.partialSome platforms failed while others published, or all published but at least one returned warnings (for example a failed first comment). data.post
post.failedNo platform published. data.post has each platform's error.
post.approval_requestedA post is waiting for approval. data.post
post.approvedA post was approved. data.post
post.rejectedA post was rejected. data.post and data.note
account.connectedAn account was connected. data.account
account.disconnectedAn account was disconnected. data.account
account.reauthorization_requiredAn account lost access and needs to be connected again. data.account
job.completedA download, batch, pipeline or repurpose job is ready. data.job
job.failedA job failed. data.job has the error and errorCode.
clips.readyA clipping job finished. data.job has the clips with their media items.
clips.failedA clipping job failed. data.job has the error and errorCode.
comment.receivedA new comment arrived in the inbox. data.accountId and data.comment
comments.negative_wavedocs.webhooks.s.events.list.comments_negative_wave
message.receivedA new direct message arrived. data.accountId, data.conversationId and data.preview
monitor.new_itemsA monitor found new content. data.monitorId, data.name, data.platform and data.items
automation.run_failedAn automation run failed. data.automationId, data.runId and data.error
plug.executeddocs.webhooks.s.events.list.plug_executed
credits.lowThe workspace credit balance is running low.

Payload and headers

Each delivery is a POST with a JSON body of id, type, createdAt and data, and these headers:

NameDescription
X-Postkea-Event-IdThe event id. The same event delivered twice has the same id, so use it to ignore duplicates.
X-Postkea-Event-TypeThe event type.
X-Postkea-TimestampUnix time in seconds when this delivery attempt was signed.
X-Postkea-Signaturesha256= followed by the hex HMAC-SHA256 of timestamp.rawBody with your signing secret.
X-Postkea-Delivery-IdThe delivery id, as shown in the delivery history.
User-AgentPostkea-Webhooks/1.0
A post.partial event
{
  "id": "evt_3kX9q2LmV0",
  "type": "post.partial",
  "createdAt": "2026-11-03T08:00:04.512Z",
  "data": {
    "post": {
      "id": "post_8f2k1x9q0m3v7n4b2c6d",
      "status": "partial",
      "platforms": [
        {
          "accountId": "acc_x_8f2k",
          "platform": "x",
          "status": "published",
          "platformPostUrl": "https://x.com/studiolumen/status/1849"
        },
        {
          "accountId": "acc_ig_5t1p",
          "platform": "instagram",
          "status": "failed",
          "error": "Instagram: the video is longer than 15 minutes",
          "errorCode": "video_too_long"
        }
      ]
    }
  }
}

Verify signatures

Compute the HMAC-SHA256 of the timestamp header, a dot, and the raw request body, using your signing secret, and compare it with the signature header in constant time. Reject requests whose timestamp is more than a few minutes old to stop replays.

import crypto from "node:crypto";
import express from "express";

const app = express();
const SECRET = process.env.POSTKEA_WEBHOOK_SECRET; // whsec_...

// Keep the raw body: the signature is computed over the exact bytes sent.
app.post("/webhooks/postkea", express.raw({ type: "application/json" }), (req, res) => {
  const timestamp = req.header("X-Postkea-Timestamp");
  const signature = req.header("X-Postkea-Signature") ?? "";
  const body = req.body.toString("utf8");

  const expected = "sha256=" + crypto.createHmac("sha256", SECRET).update(`${timestamp}.${body}`).digest("hex");
  const valid =
    signature.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
  const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) < 300;
  if (!valid || !fresh) return res.status(401).end();

  const event = JSON.parse(body);
  if (event.type === "post.failed") {
    // event.data.post has every platform's error
  }
  res.status(200).end(); // answer fast, do slow work in the background
});

app.listen(3000);
Verify against the raw body exactly as received. Parsing the JSON and serializing it again changes the bytes and the signature will not match.

Responses and retries

Answer with any 2xx status within 10 seconds. Anything else, or no answer in time, counts as a failure.

  • Failed deliveries are retried after 1 minute, 5 minutes, 30 minutes and 2 hours, so each event is tried up to 5 times.
  • Deliveries can arrive more than once and out of order. Deduplicate with the event id and use createdAt or the post's current state to order them.
  • An endpoint that fails 50 times in a row is paused. Fix it, then turn it back on with active: true; that also resets its failure count.

Test, inspect and redeliver

  • POST /v1/webhooks/test sends a webhook.test event to a saved endpoint (webhookId) or to any url before you save it, and reports the status, body and time of the answer. Tests to an unsaved URL are signed with the secret whsec_test.
  • GET /v1/webhooks/{id}/deliveries lists deliveries with their status (pending, succeeded, retrying, failed, cancelled), attempts, response status and body.
  • POST /v1/webhooks/deliveries/{id}/redeliver sends a delivery again.
  • POST /v1/webhooks/{id}/secret issues a new signing secret. Update your server first, the old secret stops working at once.
  • PATCH changes the URL, events, profile or active, and DELETE removes the endpoint.
curl -X POST "https://postkea.com/api/v1/webhooks/test" \
  -H "Authorization: Bearer $POSTKEA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://yourapp.com/webhooks/postkea"
}'