πŸ”ŒSubscribers API: How to use it

πŸ”Œ How to Use Subscribers Endpoints

This document focuses specifically on managing WebHook Subscribers using the Clara API endpoints under /api/v1/subscribers.

Each section includes request format, parameters, example payloads, and HTTP responses.

πŸ“˜ How to Use Subscribers via Clara API

This document provides detailed usage instructions for the /api/v1/subscribers endpoint, including payloads, descriptions, and HTTP status codes.


βž• Create Subscriber

Endpoint

POST /api/v1/subscribers

Request Body

FieldTypeRequiredDescription
namestringβœ… YesName of the webhook subscriber
callbackUrlstringβœ… YesURL to which webhook POSTs will be delivered
eventsstring[]βœ… YesList of subscribed event types (e.g. PAYMENT_PAID)
enabledboolean❌ NoWhether the subscriber is active
companyUuiduuid❌ NoCompany UUID if not passed in credential

Example

{
  "name": "My Webhook",
  "callbackUrl": "https://example.com/my/webhook/endpoint",
  "events": [
    "PAYMENT_PAID",
    "CARD_CREATION_REQUEST_CREATED"
  ],
  "enabled": true,
  "companyUuid": "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"
}

Responses

StatusMeaning
201Subscriber created successfully
400Bad Request
401Unauthorized
403Forbidden

♻️ Update Subscriber

Endpoint

PATCH /api/v1/subscribers/{uuid}

Request Body

FieldTypeRequiredDescription
namestring❌ NoUpdated name
callbackUrlstring❌ NoNew webhook target URL
eventsstring[]❌ NoUpdated list of event types
enabledboolean❌ NoWhether the subscriber is active or not
companyUuiduuid❌ NoOptional company identifier

Example

{
  "name": "Updated Webhook",
  "callbackUrl": "https://api.company.com/hook",
  "events": [
    "CARD_CREATION_REQUEST_ERROR"
  ],
  "enabled": false
}

Responses

StatusMeaning
200Subscriber updated
400Bad Request
401Unauthorized
403Forbidden

βž• Add Event to Subscriber

Endpoint

POST /api/v1/subscribers/add-event

Request Body

FieldTypeRequiredDescription
callbackUrlstringβœ… YesCallback URL of the target subscriber
eventstringβœ… YesEvent to add (e.g. CARD_CREATION_REQUEST_CREATED)
companyUuiduuid❌ NoOptional company UUID

Example

{
  "callbackUrl": "https://example.com/my/webhook/endpoint",
  "event": "CARD_CREATION_REQUEST_CREATED"
}

Responses

StatusMeaning
201Event added
400Bad Request
401Unauthorized
403Forbidden

βž– Delete Event from Subscriber

Endpoint

DELETE /api/v1/subscribers/delete-event

Request Body

FieldTypeRequiredDescription
callbackUrlstringβœ… YesCallback URL of the subscriber
eventstringβœ… YesEvent to remove
companyUuiduuid❌ NoOptional company UUID

Example

{
  "callbackUrl": "https://example.com/my/webhook/endpoint",
  "event": "CARD_CREATION_REQUEST_CREATED"
}

Responses

StatusMeaning
204Event removed
400Bad Request
401Unauthorized
403Forbidden

πŸ—‘οΈ Delete Subscriber

Endpoint

DELETE /api/v1/subscribers/{uuid}

Request Body

FieldTypeRequiredDescription
companyUuiduuid❌ NoOptional company UUID

Example

{
  "companyUuid": "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"
}

Responses

StatusMeaning
204Subscriber deleted
400Bad Request
401Unauthorized
403Forbidden