Integrate · 07
API and webhooks
The platform exposes focused JSON endpoints for its own frontend and signed webhook receivers for providers. There is no public partner API or Swagger schema in this build.
Internal JSON endpoints
| Endpoint | Purpose | Access |
|---|---|---|
/dashboard/api/media/ | Media picker search; returns up to 80 images. | Staff |
/notifications/ | Notification list, unread state and actions. | Signed-in user |
/push/public-key/ | VAPID public key for browser subscription. | Public |
/push/subscribe/ | Store a browser push subscription. | Signed-in user |
/finder/ | Scent finder quiz and profile result. | Public |
/social/ | Public social gallery and shoppable posts. | Public |
/dashboard/search/ | Capability-scoped staff search JSON. | Staff |
These endpoints are implementation details of this application, not a stable public API contract. Treat them as internal unless you document and version them separately.
Inbound webhooks
POST /payments/stripe/webhook/
POST /payments/flutterwave/webhook/
POST /payments/paypal/webhook/
POST /newsletter/webhooks/mailchimp/<secret>/The payment endpoints verify provider signatures or secrets before changing order state. Mailchimp uses a secret in the URL and processes unsubscribe, bounce and profile events. Return the expected status quickly; do not perform slow work in the webhook path.
Outbound webhooks
Staff can register webhook endpoints at /dashboard/webhooks/. Lifecycle events are dispatched with a signed payload and recorded in the delivery log. Failed deliveries can be retried with retry_webhooks or the jobs timer.
| Event family | Examples |
|---|---|
| Orders | Order placed, payment received, shipped, cancelled, refunded. |
| Reviews | Approved, hidden, verified, deleted, replied. |
| Affiliates | Applied, approved, suspended, payout requested/paid/cancelled. |
| Support | New ticket, reply, status change. |
| Content | Page published, banner changed, journal comment approved. |
API and webhook security
- Use HTTPS only; never send a webhook secret over plain HTTP.
- Verify the provider signature against the raw request body before parsing.
- Keep idempotency keys or provider event IDs to avoid double processing.
- Do not expose the Django admin or dashboard JSON endpoints to anonymous traffic.
- Rotate a webhook secret if it appears in logs or a ticket.
A webhook endpoint is a public attack surface. Rate-limit it at the edge where possible and keep the handler small, verified and idempotent.
Testing webhooks
# Re-deliver failed outbound deliveries
python manage.py retry_webhooks
# Inspect recent deliveries in the dashboard
open http://127.0.0.1:8000/dashboard/webhooks/
# Verify the receiver returns 2xx and records the event idFor provider events, use the provider dashboard to replay a signed event after deploying a handler change. Replays are safer than fabricating a payload because they exercise the real signature and ordering.