Skip to content
payrocdevelopers

Create event subscription

Browse API reference

POST/event-subscriptionscreateEventSubscription

Use this method to create an event subscription that we use to notify you when an event occurs, for example, when we change the status of a processing account.

In the request, include the events that you want to subscribe to and the public endpoint that we send event notifications to. For a complete list of events that you can subscribe to, go to Events List.

In the response, our gateway returns the id of the event subscription, which you can use to perform follow-on actions.

Parameters

NameInTypeDescription
Idempotency-KeyRequiredheaderstring

Unique identifier that you generate for each request. You must use the UUID v4 format for the identifier. For more information about the idempotency key, go to Idempotency.

Request body

application/json
  • enabledbooleanrequired
    Indicates if we should notify you when the event occurs. The value is one of the following: true We notify you when the event occurs. false We don't notify you when the event occurs.
  • eventTypesstring[]required
    Array of events that you want to subscribe to. For a list of events, go to Events List.
  • metadataobject
    Object that you can send to include custom data in the request. For more information about how to use metadata, go to Metadata.
  • notificationsobject[]required
    Array of polymorphic notification objects that contain information about how we contact you when an event occurs.
    • option 1object
      • secretstringrequired
        String that we send with a notification so that you can ensure it is a valid notification from our gateway. We include the value in the Payroc-Secret header parameter in the webhook call. Note: In the response, we truncate the secret to the last 16 characters and mask the first 10 characters.16–64 chars
      • supportEmailAddressstringrequired
        Email address of the person or team that we contact if we can't deliver notifications.
      • typestringrequired
        Type of notification method. Note: To receive notifications by webhook, your server must be able to handle POST requests.webhook
      • uristringrequired
        Public endpoint that we send notifications to.

Responses

Successful request. We created the event subscription.

201 Created · application/json
{
  "enabled": true,
  "eventTypes": [
    "processingAccount.status.changed"
  ],
  "id": 2565435189324,
  "metadata": {
    "responsiblePerson": "Jane Doe"
  },
  "notifications": [
    {
      "secret": "**********oP3456",
      "supportEmailAddress": "jane.doe@example.com",
      "type": "webhook",
      "uri": "https://my-server/notification/endpoint"
    }
  ],
  "status": "registered"
}
Response schema · 11 fields
  • enabledbooleanrequired
    Indicates if we should notify you when the event occurs. The value is one of the following: true We notify you when the event occurs. false We don't notify you when the event occurs.
  • eventTypesstring[]required
    Array of events that you want to subscribe to. For a list of events, go to Events List.
  • idintegerint64
    Unique identifier that we assigned to the event subscription.
  • metadataobject
    Object that you can send to include custom data in the request. For more information about how to use metadata, go to Metadata.
  • notificationsobject[]required
    Array of polymorphic notification objects that contain information about how we contact you when an event occurs.
    • option 1object
      • secretstringrequired
        String that we send with a notification so that you can ensure it is a valid notification from our gateway. We include the value in the Payroc-Secret header parameter in the webhook call. Note: In the response, we truncate the secret to the last 16 characters and mask the first 10 characters.16–64 chars
      • supportEmailAddressstringrequired
        Email address of the person or team that we contact if we can't deliver notifications.
      • typestringrequired
        Type of notification method. Note: To receive notifications by webhook, your server must be able to handle POST requests.webhook
      • uristringrequired
        Public endpoint that we send notifications to.
  • statusstring
    Status of the subscription. We return one of the following values: registered You have set up the subscription, and we will notify you when an event occurs. suspended We have deactivated the event subscription, and we won't notify you when an event occurs. failed We couldn't contact your URI endpoint. We email the supportEmailAddress.registeredsuspendedfailed

Used in workflows

Search documentation

API reference169
Guides118
Knowledge38
legal1
Solutions32
Workflows74
↑↓highlight↵openView all search results

Menu

Theme

Sign out

Your saved plans remain in your organization. This browser’s private draft and account view will be cleared.

Talk to an engineer