Notes on the Sentry Web API
These notes focus on Sentry’s web API, not server installation.
Official docs: https://docs.sentry.io/api/
Community: https://forum.sentry.io/
As of May 2017, the v0 API is still in draft—endpoints may change.
Authentication
All requests must include an auth header:
1 | headers = {'Authorization': 'Bearer TOKEN'} |
Missing credentials yield {"detail": "Authentication credentials were not provided."}
; bad tokens return {"detail": "Invalid token"}
. Generate tokens under Settings → API → Auth Tokens.
Example API
Sentry offers several categories. Take Events → List a Project’s Events
as an example:
1 | GET /api/0/projects/{organization_slug}/{project_slug}/events/ |
- Method:
GET
- URL:
<your-sentry>/api/0/projects/<org_slug>/<project_slug>/events/
organization_slug
is the org slug, project_slug
the project slug.
Not every endpoint uses GET; deletions use DELETE
, updates use PUT
, and some require additional headers such as Content-Type: application/json
.
Handling responses
The endpoint returns at most 100 events per page. Parse with json.loads(response.text)
to get a list of dicts.
Pagination info lives in the Link
header:
1 | Link: <...cursor=...>; rel="previous"; results="false", <...cursor=...>; rel="next"; results="true" |
Fetch the Link
header (response.headers.get('Link')
), extract the rel="next"
URL, and repeat until there is no next link or the page is empty.
Notes
- The web UI hits internal endpoints; payloads may differ from the public API (e.g., event IDs are longer).
- The documentation is incomplete—expect to experiment.