Subscribe to a webhook

POST /webhook/createSubscription
application/json

Body object Required

The configuration for the webhook subscription.

One of:

Responses

  • 200 application/json

    Webhook subscription created successfully

    Hide response attributes Show response attributes object
    • data object Required
      Hide data attributes Show data attributes object
      • webhookId string Required

        The unique identifier for the webhook subscription

      • config object Required

        The configuration for the webhook subscription, which includes the event type, target URL, and any additional metadata.

        One of:
    • warnings array[string]
  • 400 application/json

    Invalid request. The request was malformed or missing required parameters.

    Hide response attribute Show response attribute object
    • message string Required
  • 403 application/json

    Forbidden. The caller does not have permission to perform this action.

    Hide response attribute Show response attribute object
    • message string Required
POST /webhook/createSubscription
curl \
 --request POST 'https://public-api.joinswsh.com/webhook/createSubscription' \
 --header "x-api-key: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"event":"newPhoto","targetUrl":"https://example.com/webhook","metadata":{},"albumId":"22222222-2222-2222-2222-222222222222"}'
Request examples
{
  "event": "newPhoto",
  "targetUrl": "https://example.com/webhook",
  "metadata": {},
  "albumId": "22222222-2222-2222-2222-222222222222"
}
{
  "event": "newAlbum",
  "targetUrl": "https://example.com/webhook",
  "metadata": {}
}
Response examples (200)
{
  "data": {
    "webhookId": "33333333-3333-3333-3333-333333333333",
    "config": {
      "event": "newPhoto",
      "targetUrl": "https://example.com/webhook",
      "metadata": {},
      "albumId": "22222222-2222-2222-2222-222222222222"
    }
  },
  "warnings": [
    "Example warning"
  ]
}
Response examples (400)
{
  "message": "Invalid request"
}
Response examples (403)
{
  "message": "Forbidden"
}