# Create an event subscription, then discover, retrieve, and delete it.

Create an event subscription, then discover, retrieve, and delete it.

1. Create the event subscription. Sends the events to subscribe to plus the webhook notification target. Returns the subscriptionId at #/id, which every management step below reuses.
 [createEventSubscription](/api/create-event-subscription)
2. When a subscribed event occurs, Payroc sends a webhook POST carrying the CloudEvents payload to the notificationUri registered in step 1. The receiver is caller-side and not a Payroc API operation: verify the Payroc-Secret header against your copy of the secret and return a 200 to each delivery.

3. OPTIONAL — list event subscriptions, optionally filtered by status or event type, to find a subscriptionId when you did not retain the one from create.
 [listEventSubscriptions](/api/list-event-subscriptions)
4. Retrieve the full details of the subscription created above. [getEventSubscription](/api/get-event-subscription)
5. OPTIONAL — delete the subscription. This is irreversible and stops all notifications from it. To pause notifications without deleting, patch the subscription and set enabled to false instead (see patch-an-event-subscription). Returns 204 No Content.
 [deleteEventSubscription](/api/delete-event-subscription)

## Workflow diagram

```mermaid
flowchart TD
  step0["1. create event subscription · API"]
  step1["2. deliver event notification · Manual"]
  step0 --> step1
  step2["3. list event subscriptions · API"]
  step1 --> step2
  step3["4. get event subscription · API"]
  step2 --> step3
  step4["5. delete event subscription · API"]
  step3 --> step4
```
