{"_id":"58af0c92c749f61b0061c8b3","githubsync":"","category":{"_id":"58aefce02470660f00b54539","version":"564e5a9b1560880d008d30dc","project":"564e5930c3553e0d003e53d0","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-02-23T15:16:48.589Z","from_sync":false,"order":3,"slug":"events-api-v2","title":"Events API v2"},"project":"564e5930c3553e0d003e53d0","__v":33,"user":"5876ca441a6b5b3900a5b348","version":{"_id":"564e5a9b1560880d008d30dc","project":"564e5930c3553e0d003e53d0","__v":22,"createdAt":"2015-11-19T23:26:19.166Z","releaseDate":"2015-11-19T23:26:19.166Z","categories":["564e5a9b1560880d008d30dd","566318e1f5ca460d00f41896","56631d08cd54d50d005015fa","56631d2a81ad7417006a202c","5668ba19fbd7680d009375f4","5668cb8b10bda80d00797ed9","5668cb9d10bda80d00797eda","56830d8a3f94e00d004e2a7a","56830d9072bb720d0091f594","56830d94cb4d190d0027698e","56830dc44aecbd0d00a464c5","569e90f3c9b43e0d00c4bab1","56a96d338791090d00113bab","56b12d8336d2580d00247877","56c36bf0a869d017002ea55b","56c36bf93d30210d00ea84bb","56c77749b935671700ff0304","56c7ab9e5652c217008e091a","56cb8bdad5c6241d00ef5e61","58aefce02470660f00b54539","58aefd0bebd7370f0078b954","59ca65ca4337830026edf24f"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Foundation","version_clean":"2.0.0","version":"2"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-02-23T16:23:46.059Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"method":"post","results":{"codes":[{"name":"","code":"{\n  \"status\": \"success\",\n  \"message\": \"Event processed\",\n  \"dedup_key\": \"samplekeyhere\"\n}","language":"json","status":202},{"name":"","code":"{\n  \"status\": \"invalid event\",\n  \"message\": \"Event object is invalid\",\n  \"errors\": [\n    \"Length of 'routing_key' is incorrect (should be 32 characters)\"\n  ]\n}","language":"json","status":400},{"status":429,"code":"","language":"text"}]},"settings":"56631e70a504730d00deb708","examples":{"codes":[{"code":"/*\n  This example shows how to send a trigger event without a dedup_key.\n  In this case, PagerDuty will automatically assign a random and unique key\n  and return it in the response object.\n  You should store this key in case you want to send an acknowledge or resolve\n  event to this incident in the future.\n*/\n\n{\n  \"payload\": {\n    \"summary\": \"Example alert on host1.example.com\",\n    \"timestamp\": \"2015-07-17T08:42:58.315+0000\",\n    \"source\": \"monitoringtool:cloudvendor:central-region-dc-01:852559987:cluster/api-stats-prod-003\",\n    \"severity\": \"info\",\n    \"component\": \"postgres\",\n    \"group\": \"prod-datapipe\",\n    \"class\": \"deploy\",\n    \"custom_details\": {\n      \"ping time\": \"1500ms\",\n      \"load avg\": 0.75\n    }\n  },\n  \"routing_key\": \"samplekeyhere\",\n  \"dedup_key\": \"samplekeyhere\",\n  \"images\": [{\n  \t\"src\": \"https://www.pagerduty.com/wp-content/uploads/2016/05/pagerduty-logo-green.png\",\n  \t\"href\": \"https://example.com/\",\n  \t\"alt\": \"Example text\"\n  }],\n  \"links\": [{\n    \"href\": \"https://example.com/\",\n    \"text\": \"Link text\"\n  }],\n  \"event_action\": \"trigger\",\n  \"client\": \"Sample Monitoring Service\",\n  \"client_url\": \"https://monitoring.example.com\"\n}","language":"json","name":"Trigger"},{"code":"{\n  \"routing_key\": \"routingkeyhere\",\n  \"dedup_key\": \"dedupkeyhere\",\n  \"event_action\": \"acknowledge\"\n}\n","language":"json","name":"Acknowledge"},{"code":"{\n  \"routing_key\": \"routingkeyhere\",\n  \"dedup_key\": \"dedupkeyhere\",\n  \"event_action\": \"resolve\"\n}\n","language":"json","name":"Resolve"}]},"auth":"required","params":[{"_id":"58af1c13c749f61b0061c8ea","ref":"","in":"body","required":true,"desc":"A version 4 UUID expressed as a 32-digit hexadecimal number. This is the \"Integration Key\" for an integration on any given service.","default":"","type":"string","name":"routing_key"},{"_id":"58b8f94ea15dcc0f00c829f5","ref":"","in":"body","required":true,"desc":"The type of event. Can be `trigger`, `acknowledge` or `resolve`. See [Event Action](doc:events-api-v2#event-action).","default":"trigger","type":"string","name":"event_action"},{"_id":"58fa92e7d5b9b70f0009407a","ref":"","in":"body","required":false,"desc":"Deduplication key for correlating triggers and resolves. The maximum permitted length of this property is **255 characters.**","default":"","type":"string","name":"dedup_key"},{"_id":"58bda6e1fa3a9d2500d16669","ref":"","in":"body","required":true,"desc":"A brief text summary of the event, used to generate the summaries/titles of any associated alerts. The maximum permitted length of this property is **1024 characters.**","default":"","type":"string","name":"payload.summary"},{"_id":"58bda6e1fa3a9d2500d16668","ref":"","in":"body","required":true,"desc":"The unique location of the affected system, preferably a hostname or FQDN.","default":"","type":"string","name":"payload.source"},{"_id":"58bda6e1fa3a9d2500d16667","ref":"","in":"body","required":true,"desc":"The perceived severity of the status the event is describing with respect to the affected system. This can be `critical`, `error`, `warning` or `info`.","default":"","type":"string","name":"payload.severity"},{"_id":"58bda7d7b4e9640f00e4bdb0","ref":"","in":"body","required":false,"desc":"The time at which the emitting tool detected or generated the event.","default":"","type":"timestamp","name":"payload.timestamp"},{"_id":"58bdab000efb980f00066566","ref":"","in":"body","required":false,"desc":"Component of the source machine that is responsible for the event, for example `mysql` or `eth0`","default":"","type":"string","name":"payload.component"},{"_id":"58bdab000efb980f00066565","ref":"","in":"body","required":false,"desc":"Logical grouping of components of a service, for example `app-stack`","default":"","type":"string","name":"payload.group"},{"_id":"58bdab000efb980f00066564","ref":"","in":"body","required":false,"desc":"The class/type of the event, for example `ping failure` or `cpu load`","default":"","type":"string","name":"payload.class"},{"_id":"58bdab000efb980f00066563","ref":"","in":"body","required":false,"desc":"Additional details about the event and affected system","default":"","type":"object","name":"payload.custom_details"},{"_id":"58af1486c749f61b0061c8d2","ref":"","in":"header","required":false,"desc":"","default":"application/json","type":"string","name":"Content-Type"},{"_id":"5913997c9dcb4e1900a19055","ref":"","in":"body","required":false,"desc":"List of images to include.","default":"","type":"array_object","name":"images"},{"_id":"5913997c9dcb4e1900a19054","ref":"","in":"body","required":false,"desc":"List of links to include.","default":"","type":"array_object","name":"links"},{"_id":"5b63109ad3f56b0003d15f62","ref":"","in":"header","required":false,"desc":"Optional header that can be set instead of `routing_key` in the body params. If both are set, this header takes precedence over the key passed in the body.","default":"","type":"string","name":"X-Routing-Key"}],"url":"/v2/enqueue"},"isReference":false,"order":1,"body":"Your monitoring tools should send PagerDuty an event with its `event_action` as `trigger` to report a new or ongoing problem. When PagerDuty receives a `trigger` action event, it will either open a new incident, or add a new trigger [log entry](/v2/page/api-reference#!/Log_Entries/get_log_entries) to an existing incident, depending on the provided value of `dedup_key`. See [Alert De-Duplication](doc:events-api-v2#alert-de-duplication)\n\nIf the event is improperly formatted, a `400 Bad Request` will be returned.\n\nThere is a limit on the number of events that a service can accept at any given time. Depending on the behavior of the incoming traffic and how many incidents are being created at once, we reduce our throttle dynamically to ensure that important events continue to be processed.\n\nIf the service has received too many events, a `Status: 429 Too Many Requests` response will be returned. If it is vital that all events your monitoring tool sends be received, be sure to retry on a 429 response code (preferably with a back off).\n[block:api-header]\n{\n  \"title\": \"Context Properties\"\n}\n[/block]\nThese properties can be used to attach informational assets to the incident record. Each element of these arrays is an [object](doc:types#object).  \n\n## The `images` property\n\nThis property is used to attach images to the incident. Each object in the list has the following properties:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Required\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`src`\",\n    \"0-1\": \"Yes\",\n    \"0-2\": \"The source of the image being attached to the incident. This image must be served via HTTPS.\",\n    \"1-0\": \"`href`\",\n    \"1-1\": \"No\",\n    \"1-2\": \"Optional URL; makes the image a clickable link.\",\n    \"2-0\": \"`alt`\",\n    \"2-1\": \"No\",\n    \"2-2\": \"Optional alternative text for the image.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n## The `links` property\n\nThis property is used to attach text links to the incident. Each object in the list has the following properties:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Required\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`href`\",\n    \"0-1\": \"Yes\",\n    \"0-2\": \"URL of the link to be attached.\",\n    \"1-0\": \"`text`\",\n    \"1-1\": \"Yes\",\n    \"1-2\": \"Plain text that describes the purpose of the link, and can be used as the link's text.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]","excerpt":"Send a sample event for the Events API v2 from this guide","slug":"send-an-event-events-api-v2","type":"endpoint","title":"Send an event"}

postSend an event

Send a sample event for the Events API v2 from this guide

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

routing_key:
required
string
A version 4 UUID expressed as a 32-digit hexadecimal number. This is the "Integration Key" for an integration on any given service.
event_action:
required
stringtrigger
The type of event. Can be `trigger`, `acknowledge` or `resolve`. See [Event Action](doc:events-api-v2#event-action).
dedup_key:
string
Deduplication key for correlating triggers and resolves. The maximum permitted length of this property is **255 characters.**
payload.summary:
required
string
A brief text summary of the event, used to generate the summaries/titles of any associated alerts. The maximum permitted length of this property is **1024 characters.**
payload.source:
required
string
The unique location of the affected system, preferably a hostname or FQDN.
payload.severity:
required
string
The perceived severity of the status the event is describing with respect to the affected system. This can be `critical`, `error`, `warning` or `info`.
payload.timestamp:
timestamp
The time at which the emitting tool detected or generated the event.
payload.component:
string
Component of the source machine that is responsible for the event, for example `mysql` or `eth0`
payload.group:
string
Logical grouping of components of a service, for example `app-stack`
payload.class:
string
The class/type of the event, for example `ping failure` or `cpu load`
payload.custom_details:
object
Additional details about the event and affected system
images:
array of objects
List of images to include.
links:
array of objects
List of links to include.

Headers

Content-Type:
stringapplication/json
X-Routing-Key:
string
Optional header that can be set instead of `routing_key` in the body params. If both are set, this header takes precedence over the key passed in the body.

Examples


Result Format


Documentation

Your monitoring tools should send PagerDuty an event with its `event_action` as `trigger` to report a new or ongoing problem. When PagerDuty receives a `trigger` action event, it will either open a new incident, or add a new trigger [log entry](/v2/page/api-reference#!/Log_Entries/get_log_entries) to an existing incident, depending on the provided value of `dedup_key`. See [Alert De-Duplication](doc:events-api-v2#alert-de-duplication) If the event is improperly formatted, a `400 Bad Request` will be returned. There is a limit on the number of events that a service can accept at any given time. Depending on the behavior of the incoming traffic and how many incidents are being created at once, we reduce our throttle dynamically to ensure that important events continue to be processed. If the service has received too many events, a `Status: 429 Too Many Requests` response will be returned. If it is vital that all events your monitoring tool sends be received, be sure to retry on a 429 response code (preferably with a back off). [block:api-header] { "title": "Context Properties" } [/block] These properties can be used to attach informational assets to the incident record. Each element of these arrays is an [object](doc:types#object). ## The `images` property This property is used to attach images to the incident. Each object in the list has the following properties: [block:parameters] { "data": { "h-0": "Name", "h-1": "Required", "h-2": "Description", "0-0": "`src`", "0-1": "Yes", "0-2": "The source of the image being attached to the incident. This image must be served via HTTPS.", "1-0": "`href`", "1-1": "No", "1-2": "Optional URL; makes the image a clickable link.", "2-0": "`alt`", "2-1": "No", "2-2": "Optional alternative text for the image." }, "cols": 3, "rows": 3 } [/block] ## The `links` property This property is used to attach text links to the incident. Each object in the list has the following properties: [block:parameters] { "data": { "h-0": "Name", "h-1": "Required", "h-2": "Description", "0-0": "`href`", "0-1": "Yes", "0-2": "URL of the link to be attached.", "1-0": "`text`", "1-1": "Yes", "1-2": "Plain text that describes the purpose of the link, and can be used as the link's text." }, "cols": 3, "rows": 2 } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}