๐Ÿ”Œ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