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 '{"description":"ip policy creations","destination_ids":["ed_2hrGyrF4wPic8yIGrchlpSRert3"],"metadata":"{\"environment\": \"staging\"}","sources":[{"type":"ip_policy_created.v0"}]}' \
https://api.ngrok.com/event_subscriptions

Parameters

NameTypeDescription
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

NameTypeDescription
typestringType of event for which an event subscription will trigger

Response

Returns a 201 response on success

Example Response

{
"created_at": "2024-06-14T06:03:59Z",
"description": "ip policy creations",
"destinations": [
{
"id": "ed_2hrGyrF4wPic8yIGrchlpSRert3",
"uri": "https://api.ngrok.com/event_destinations/ed_2hrGyrF4wPic8yIGrchlpSRert3"
}
],
"id": "esb_2hrGyppGFG9dgvpjYdztK8NhtfQ",
"metadata": "{\"environment\": \"staging\"}",
"sources": [
{
"type": "ip_policy_created.v0",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2hrGyppGFG9dgvpjYdztK8NhtfQ/sources/ip_policy_created.v0"
}
],
"uri": "https://api.ngrok.com/event_subscriptions/esb_2hrGyppGFG9dgvpjYdztK8NhtfQ"
}

Fields

NameTypeDescription
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

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

Ref fields

NameTypeDescription
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_2hrGyppGFG9dgvpjYdztK8NhtfQ

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_2hrGyppGFG9dgvpjYdztK8NhtfQ

Response

Returns a 200 response on success

Example Response

{
"created_at": "2024-06-14T06:03:59Z",
"description": "IP Policy Creations",
"destinations": [
{
"id": "ed_2hrGyrF4wPic8yIGrchlpSRert3",
"uri": "https://api.ngrok.com/event_destinations/ed_2hrGyrF4wPic8yIGrchlpSRert3"
}
],
"id": "esb_2hrGyppGFG9dgvpjYdztK8NhtfQ",
"metadata": "{\"environment\": \"staging\"}",
"sources": [
{
"type": "ip_policy_created.v0",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2hrGyppGFG9dgvpjYdztK8NhtfQ/sources/ip_policy_created.v0"
}
],
"uri": "https://api.ngrok.com/event_subscriptions/esb_2hrGyppGFG9dgvpjYdztK8NhtfQ"
}

Fields

NameTypeDescription
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

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

Ref fields

NameTypeDescription
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": [
{
"created_at": "2024-06-14T06:03:59Z",
"description": "ip policy creations",
"destinations": [
{
"id": "ed_2hrGyrF4wPic8yIGrchlpSRert3",
"uri": "https://api.ngrok.com/event_destinations/ed_2hrGyrF4wPic8yIGrchlpSRert3"
}
],
"id": "esb_2hrGyppGFG9dgvpjYdztK8NhtfQ",
"metadata": "{\"environment\": \"staging\"}",
"sources": [
{
"type": "ip_policy_created.v0",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2hrGyppGFG9dgvpjYdztK8NhtfQ/sources/ip_policy_created.v0"
}
],
"uri": "https://api.ngrok.com/event_subscriptions/esb_2hrGyppGFG9dgvpjYdztK8NhtfQ"
}
],
"next_page_uri": null,
"uri": "https://api.ngrok.com/event_subscriptions"
}

Fields

NameTypeDescription
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

NameTypeDescription
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

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

Ref fields

NameTypeDescription
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_2hrGyppGFG9dgvpjYdztK8NhtfQ

Parameters

NameTypeDescription
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

NameTypeDescription
typestringType of event for which an event subscription will trigger

Response

Returns a 200 response on success

Example Response

{
"created_at": "2024-06-14T06:03:59Z",
"description": "IP Policy Creations",
"destinations": [
{
"id": "ed_2hrGyrF4wPic8yIGrchlpSRert3",
"uri": "https://api.ngrok.com/event_destinations/ed_2hrGyrF4wPic8yIGrchlpSRert3"
}
],
"id": "esb_2hrGyppGFG9dgvpjYdztK8NhtfQ",
"metadata": "{\"environment\": \"staging\"}",
"sources": [
{
"type": "ip_policy_created.v0",
"uri": "https://api.ngrok.com/event_subscriptions/esb_2hrGyppGFG9dgvpjYdztK8NhtfQ/sources/ip_policy_created.v0"
}
],
"uri": "https://api.ngrok.com/event_subscriptions/esb_2hrGyppGFG9dgvpjYdztK8NhtfQ"
}

Fields

NameTypeDescription
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

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

Ref fields

NameTypeDescription
idstringa resource identifier
uristringa uri for locating a resource