Back to siteAPI Documentation
POST

/api/v1/webhooks/subscriptions

Auth: Bearer token

Create Subscription

Creates a webhook subscription for selected event types.

Body parameters

NameTypeRequiredDescription
urlstringYesHTTPS destination for webhook deliveries.
eventstringNoSingle event key (legacy payload format from Postman).
eventsstring[]NoList of event keys to subscribe to.

Example response

<?php

return [
  'success' => true,
  'data' => [
    'subscription_id' => 'wh_22',
    'status' => 'active',
    'url' => 'https://example.com/webhooks/pickndrop',
    'events' => [
      'shipment.created',
      'booking.updated'
    ],
    'createdAt' => '2026-02-17T10:45:00Z'
  ]
];

Request examples

curl -X POST \
  "https://api.spaces.za.com/api/v1/webhooks/subscriptions" \
  -H "Authorization: Bearer <token>" \\
  -H "Content-Type: application/json" \\
  --data '{
  "url": "https://example.com/webhooks/pickndrop",
  "event": "shipment.updated",
  "events": [
    "shipment.created",
    "booking.updated"
  ]
}'