Webhook endpoints

Register the URLs PostWire calls when a post publishes or fails.

View as MarkdownOpenAPIBase URL https://postwire.io

This page lists the endpoints. The events, the signature and how to verify it in Node.js and Python are in the webhooks guide. Up to 5 endpoints, on every plan.

List your webhook endpoints (the signing secret is never returned)

GET/api/webhooks

PostWire calls your endpoints when a post goes out or fails on a network, and when a connection must be signed in again. Every plan; up to 5 endpoints. Events and signature: postwire.io/docs/webhooks/ (payload schema: components.schemas.WebhookEvent).

Needs an API key: Authorization: Bearer pw_live_….

Responses

StatusMeans
200{ webhooks: [Webhook], events: [string], max: 5 }
503code webhooks_unavailable: webhooks are not switched on on this server yet
curl
curl "https://postwire.io/api/webhooks" \
  -H "Authorization: Bearer $POSTWIRE_API_KEY"
Node
const res = await fetch("https://postwire.io/api/webhooks", {
  method: "GET",
  headers: { Authorization: `Bearer ${process.env.POSTWIRE_API_KEY}` },
});
console.log(res.status, await res.json());
Python
import os, requests

r = requests.get(
    "https://postwire.io/api/webhooks",
    headers={"Authorization": f"Bearer {os.environ['POSTWIRE_API_KEY']}"},
)
print(r.status_code, r.json())

Add a webhook endpoint; the response carries its signing secret, once

POST/api/webhooks

Needs an API key: Authorization: Bearer pw_live_….

Body (JSON)

FieldTypeDescription
url requiredstring (uri)A public https URL. Redirects are not followed.
eventsarray of stringDefault: all three. One of: post.published, post.failed, connection.reauth_required.
descriptionstringUp to 200 characters.

Responses

StatusMeans
201{ webhook: Webhook, secret: "whsec_…" } — keep the secret: it is not shown again
400code bad_url (not https, not public, malformed), bad_request (unknown event) or too_many (5 endpoints already)
503code webhooks_unavailable
curl
curl -X POST "https://postwire.io/api/webhooks" \
  -H "Authorization: Bearer $POSTWIRE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://example.com/hooks/postwire",
  "events": [
    "post.published",
    "post.failed"
  ]
}'
Node
const res = await fetch("https://postwire.io/api/webhooks", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.POSTWIRE_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "https://example.com/hooks/postwire",
    "events": [
      "post.published",
      "post.failed"
    ]
  }),
});
console.log(res.status, await res.json());
Python
import os, requests

r = requests.post(
    "https://postwire.io/api/webhooks",
    headers={"Authorization": f"Bearer {os.environ['POSTWIRE_API_KEY']}"},
    json={
        "url": "https://example.com/hooks/postwire",
        "events": ["post.published", "post.failed"],
    },
)
print(r.status_code, r.json())

Delete a webhook endpoint (its pending deliveries are dropped)

DELETE/api/webhooks/{id}

Needs an API key: Authorization: Bearer pw_live_….

Parameters

FieldTypeDescription
id requiredpath, string (uuid)

Responses

StatusMeans
200deleted
404code not_found
curl
curl -X DELETE "https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f" \
  -H "Authorization: Bearer $POSTWIRE_API_KEY"
Node
const res = await fetch("https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f", {
  method: "DELETE",
  headers: { Authorization: `Bearer ${process.env.POSTWIRE_API_KEY}` },
});
console.log(res.status, await res.json());
Python
import os, requests

r = requests.delete(
    "https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f",
    headers={"Authorization": f"Bearer {os.environ['POSTWIRE_API_KEY']}"},
)
print(r.status_code, r.json())

Send a signed webhook.test event to this endpoint now and report what it answered

POST/api/webhooks/{id}/test

Needs an API key: Authorization: Bearer pw_live_….

Parameters

FieldTypeDescription
id requiredpath, string (uuid)

Responses

StatusMeans
200{ delivered: boolean, status: HTTP status or null, error?, delivery_id, event }
404code not_found
curl
curl -X POST "https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f/test" \
  -H "Authorization: Bearer $POSTWIRE_API_KEY"
Node
const res = await fetch("https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f/test", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.POSTWIRE_API_KEY}` },
});
console.log(res.status, await res.json());
Python
import os, requests

r = requests.post(
    "https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f/test",
    headers={"Authorization": f"Bearer {os.environ['POSTWIRE_API_KEY']}"},
)
print(r.status_code, r.json())

The delivery log of an endpoint: the last 50 deliveries with status, attempts, the endpoint's answer and the payload

GET/api/webhooks/{id}/deliveries

Needs an API key: Authorization: Bearer pw_live_….

Parameters

FieldTypeDescription
id requiredpath, string (uuid)
limitquery, integer

Responses

StatusMeans
200{ webhook, deliveries: [{ id, event, status: pending|delivered|failed, attempts, last_status, last_error, next_attempt_at, created_at, delivered_at, payload }] }
curl
curl "https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f/deliveries?limit=20" \
  -H "Authorization: Bearer $POSTWIRE_API_KEY"
Node
const res = await fetch("https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f/deliveries?limit=20", {
  method: "GET",
  headers: { Authorization: `Bearer ${process.env.POSTWIRE_API_KEY}` },
});
console.log(res.status, await res.json());
Python
import os, requests

r = requests.get(
    "https://postwire.io/api/webhooks/7c2a6f0e-5b1d-4c8a-9e3f-2d4b6a8c0e1f/deliveries?limit=20",
    headers={"Authorization": f"Bearer {os.environ['POSTWIRE_API_KEY']}"},
)
print(r.status_code, r.json())