Events
The Events API is a read-only API to the GitHub events. These events power the various activity streams on the site.
The Events API can return different types of events triggered by activity on GitHub Enterprise Server. For more information about the specific events that you can receive from the Events API, see "GitHub Event types." An events API for repository issues is also available. For more information, see the "Issue Events API."
Events are optimized for polling with the "ETag" header. If no new events have been triggered, you will see a "304 Not Modified" response, and your current rate limit will be untouched. There is also an "X-Poll-Interval" header that specifies how often (in seconds) you are allowed to poll. In times of high server load, the time may increase. Please obey the header.
$ curl -I http(s)://[hostname]/api/v3/users/tater/events
> HTTP/2 200
> X-Poll-Interval: 60
> ETag: "a18c3bded88eb5dbb5c849a489412bf3"
# The quotes around the ETag value are important
$ curl -I http(s)://[hostname]/api/v3/users/tater/events \
$ -H 'If-None-Match: "a18c3bded88eb5dbb5c849a489412bf3"'
> HTTP/2 304
> X-Poll-Interval: 60
Only events created within the past 90 days will be included in timelines. Events older than 90 days will not be included (even if the total number of events in the timeline is less than 300).
List public events
We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago.
get /events
Parameters
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
http(s)://{hostname}/api/v3/eventsJavaScript (@octokit/core.js)
await octokit.request('GET /events')
Response
Status: 200 OK
Not modified
Status: 304 Not Modified
Forbidden
Status: 403 Forbidden
Service unavailable
Status: 503 Service Unavailable
Notes
get /networks/{owner}/{repo}/events
Parameters
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
owner |
string | path | |
repo |
string | path | |
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
http(s)://{hostname}/api/v3/networks/octocat/hello-world/eventsJavaScript (@octokit/core.js)
await octokit.request('GET /networks/{owner}/{repo}/events', {
owner: 'octocat',
repo: 'hello-world'
})
Response
Status: 200 OK
Moved permanently
Status: 301 Moved Permanently
Not modified
Status: 304 Not Modified
Forbidden
Status: 403 Forbidden
Resource not found
Status: 404 Not Found
Notes
get /orgs/{org}/events
Parameters
| Name | Type | In | Description |
|---|---|---|---|
accept |
string | header |
Setting to
|
org |
string | path | |
per_page |
integer | query |
Results per page (max 100) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
http(s)://{hostname}/api/v3/orgs/ORG/eventsJavaScript (@octokit/core.js)
await octokit.request('GET /orgs/{org}/events', {
org: 'org'
})
Response
Status: 200 OK