Skip to main content

Event Subscriptions


Create Event Subscription

Create an Event Subscription.

Request

POST /event_subscriptions

Example Request

curl \
-X POST \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"metadata":"{\"environment\": \"staging\"}","description":"ip policy creations","sources":[{"type":"ip_policy_created.v0"}],"destination_ids":["ed_2NTVHNH46kJT5TzzV7gowqhVwRW"]}' \
https://api.ngrok.com/event_subscriptions

Parameters

   
metadatastringArbitrary customer supplied information intended to be machine readable. Optional, max 4096 chars.
descriptionstringArbitrary customer supplied information intended to be human readable. Optional, max 255 chars.
sourcesEventSourceReplaceSources containing the types for which this event subscription will trigger
destination_idsList<string>A list of Event Destination IDs which should be used for this Event Subscription.

EventSourceReplace parameters

   
typestringType of event for which an event subscription will trigger

Response

Returns a 201 response on success

Example Response

{
"id": "esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar",
"created_at": "2023-03-24T19:59:30Z",
"metadata": "{\"environment\": \"staging\"}",
"description": "ip policy creations",
"sources": [
{
"type": "ip_policy_created.v0",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar/sources/ip_policy_created.v0"
}
],
"destinations": [
{
"id": "ed_2NTVHNH46kJT5TzzV7gowqhVwRW",
"uri": "https://api.ngrok.com/event_destinations/ed_2NTVHNH46kJT5TzzV7gowqhVwRW"
}
]
}

Fields

   
idstringUnique identifier for this Event Subscription.
uristringURI of the Event Subscription API resource.
created_atstringWhen the Event Subscription was created (RFC 3339 format).
metadatastringArbitrary customer supplied information intended to be machine readable. Optional, max 4096 chars.
descriptionstringArbitrary customer supplied information intended to be human readable. Optional, max 255 chars.
sourcesEventSourceSources containing the types for which this event subscription will trigger
destinationsRefDestinations to which these events will be sent

EventSource fields

   
typestringType of event for which an event subscription will trigger
uristringURI of the Event Source API resource.

Ref fields

   
idstringa resource identifier
uristringa uri for locating a resource

Delete Event Subscription

Delete an Event Subscription.

Request

DELETE /event_subscriptions/{id}

Example Request

curl \
-X DELETE \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar

Response

Returns a 204 response with no body on success

Get Event Subscription

Get an Event Subscription by ID.

Request

GET /event_subscriptions/{id}

Example Request

curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar

Response

Returns a 200 response on success

Example Response

{
"id": "esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar",
"created_at": "2023-03-24T19:59:30Z",
"metadata": "{\"environment\": \"staging\"}",
"description": "IP Policy Creations",
"sources": [
{
"type": "ip_policy_created.v0",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar/sources/ip_policy_created.v0"
}
],
"destinations": [
{
"id": "ed_2NTVHNH46kJT5TzzV7gowqhVwRW",
"uri": "https://api.ngrok.com/event_destinations/ed_2NTVHNH46kJT5TzzV7gowqhVwRW"
}
]
}

Fields

   
idstringUnique identifier for this Event Subscription.
uristringURI of the Event Subscription API resource.
created_atstringWhen the Event Subscription was created (RFC 3339 format).
metadatastringArbitrary customer supplied information intended to be machine readable. Optional, max 4096 chars.
descriptionstringArbitrary customer supplied information intended to be human readable. Optional, max 255 chars.
sourcesEventSourceSources containing the types for which this event subscription will trigger
destinationsRefDestinations to which these events will be sent

EventSource fields

   
typestringType of event for which an event subscription will trigger
uristringURI of the Event Source API resource.

Ref fields

   
idstringa resource identifier
uristringa uri for locating a resource

List Event Subscriptions

List this Account's Event Subscriptions.

Request

GET /event_subscriptions

Example Request

curl \
-X GET \
-H "Authorization: Bearer {API_KEY}" \
-H "Ngrok-Version: 2" \
https://api.ngrok.com/event_subscriptions

Response

Returns a 200 response on success

Example Response

{
"event_subscriptions": [
{
"id": "esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar",
"created_at": "2023-03-24T19:59:30Z",
"metadata": "{\"environment\": \"staging\"}",
"description": "ip policy creations",
"sources": [
{
"type": "ip_policy_created.v0",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar/sources/ip_policy_created.v0"
}
],
"destinations": [
{
"id": "ed_2NTVHNH46kJT5TzzV7gowqhVwRW",
"uri": "https://api.ngrok.com/event_destinations/ed_2NTVHNH46kJT5TzzV7gowqhVwRW"
}
]
}
],
"uri": "https://api.ngrok.com/event_subscriptions",
"next_page_uri": null
}

Fields

   
event_subscriptionsEventSubscriptionThe list of all Event Subscriptions on this account.
uristringURI of the Event Subscriptions list API resource.
next_page_uristringURI of next page, or null if there is no next page.

EventSubscription fields

   
idstringUnique identifier for this Event Subscription.
uristringURI of the Event Subscription API resource.
created_atstringWhen the Event Subscription was created (RFC 3339 format).
metadatastringArbitrary customer supplied information intended to be machine readable. Optional, max 4096 chars.
descriptionstringArbitrary customer supplied information intended to be human readable. Optional, max 255 chars.
sourcesEventSourceSources containing the types for which this event subscription will trigger
destinationsRefDestinations to which these events will be sent

EventSource fields

   
typestringType of event for which an event subscription will trigger
uristringURI of the Event Source API resource.

Ref fields

   
idstringa resource identifier
uristringa uri for locating a resource

Update Event Subscription

Update an Event Subscription.

Request

PATCH /event_subscriptions/{id}

Example Request

curl \
-X PATCH \
-H "Authorization: Bearer {API_KEY}" \
-H "Content-Type: application/json" \
-H "Ngrok-Version: 2" \
-d '{"description":"IP Policy Creations"}' \
https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar

Parameters

   
idstringUnique identifier for this Event Subscription.
metadatastringArbitrary customer supplied information intended to be machine readable. Optional, max 4096 chars.
descriptionstringArbitrary customer supplied information intended to be human readable. Optional, max 255 chars.
sourcesEventSourceReplaceSources containing the types for which this event subscription will trigger
destination_idsList<string>A list of Event Destination IDs which should be used for this Event Subscription.

EventSourceReplace parameters

   
typestringType of event for which an event subscription will trigger

Response

Returns a 200 response on success

Example Response

{
"id": "esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar",
"created_at": "2023-03-24T19:59:30Z",
"metadata": "{\"environment\": \"staging\"}",
"description": "IP Policy Creations",
"sources": [
{
"type": "ip_policy_created.v0",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2NTVHQCVS4evvT6MHg5Kc0UB6Ar/sources/ip_policy_created.v0"
}
],
"destinations": [
{
"id": "ed_2NTVHNH46kJT5TzzV7gowqhVwRW",
"uri": "https://api.ngrok.com/event_destinations/ed_2NTVHNH46kJT5TzzV7gowqhVwRW"
}
]
}

Fields

   
idstringUnique identifier for this Event Subscription.
uristringURI of the Event Subscription API resource.
created_atstringWhen the Event Subscription was created (RFC 3339 format).
metadatastringArbitrary customer supplied information intended to be machine readable. Optional, max 4096 chars.
descriptionstringArbitrary customer supplied information intended to be human readable. Optional, max 255 chars.
sourcesEventSourceSources containing the types for which this event subscription will trigger
destinationsRefDestinations to which these events will be sent

EventSource fields

   
typestringType of event for which an event subscription will trigger
uristringURI of the Event Source API resource.

Ref fields

   
idstringa resource identifier
uristringa uri for locating a resource