Skip to main content
The events query endpoint is the primary way to search and analyze event data in Sentry. It supports flexible field selection, filtering, aggregations, and sorting — the same query engine that powers Sentry’s Discover and Performance views.

Query events

GET /api/0/organizations/{organization_id_or_slug}/events/
Returns a list of events matching the given query, with the fields you specify. Required scope: org:read

Path parameters

organization_id_or_slug
string
required
The ID or slug of the organization.

Query parameters

field
string
required
The fields to include in the response. Repeat this parameter for multiple fields. Examples: field=id&field=title&field=count(). See Available fields below.
query
string
A Sentry search query to filter results. Supports the same syntax as the Sentry UI search bar. Examples:
  • error.type:TypeError — filter by exception type
  • transaction:/api/users/ — filter by transaction name
  • release:2.0.0 — filter by release version
  • user.email:[email protected] — filter by user
project
integer
Filter by project ID. Repeat for multiple projects.
environment
string
Filter by environment name (e.g. production, staging).
statsPeriod
string
A relative time window. Examples: 24h, 7d, 14d, 30d. Cannot be combined with start/end.
start
string
ISO 8601 start of the time range. Requires end.
end
string
ISO 8601 end of the time range. Requires start.
orderby
string
Sort order. Prefix with - for descending. Example: -count() or transaction.duration.
limit
integer
Number of results to return. Maximum is 100. Defaults to 50.
cursor
string
Pagination cursor from the Link response header.
referrer
string
An optional string identifying the caller, used for query attribution.

Example request

curl "https://sentry.io/api/0/organizations/my-org/events/?field=id&field=title&field=count()&query=is:unresolved&statsPeriod=24h" \
  -H "Authorization: Bearer <token>"

Example response

{
  "data": [
    {
      "id": "9999aaaaca8b46d797c23c6077c6ff01",
      "title": "TypeError: Cannot read property 'id' of undefined",
      "count()": 142
    }
  ],
  "meta": {
    "fields": {
      "id": "string",
      "title": "string",
      "count()": "integer"
    }
  }
}

Response fields

data
array
An array of event objects containing the requested fields.
meta
object
Metadata about the response, including a fields map of field names to their data types.

Available fields

Event fields

FieldTypeDescription
idstringEvent ID
titlestringEvent title
messagestringRaw event message
platformstringPlatform (e.g. python)
timestampstringEvent timestamp
releasestringRelease version
diststringRelease distribution
environmentstringEnvironment name
user.idstringUser ID
user.emailstringUser email
user.usernamestringUsername
user.ipstringUser IP address
transactionstringTransaction name
error.typearrayException type(s)
error.valuearrayException message(s)
stack.filenamearrayStack frame filenames
stack.functionarrayStack frame functions
levelstringSeverity level
projectstringProject slug
issuestringIssue ID
os.namestringOS name
browser.namestringBrowser name
device.familystringDevice family

Aggregation functions

Use aggregation functions when you need summary statistics across events:
FunctionDescriptionExample
count()Total number of eventscount()
count_unique(field)Number of unique valuescount_unique(user.email)
avg(field)Average valueavg(transaction.duration)
sum(field)Sum of valuessum(transaction.duration)
min(field)Minimum valuemin(transaction.duration)
max(field)Maximum valuemax(transaction.duration)
p50(field)50th percentilep50(transaction.duration)
p75(field)75th percentilep75(transaction.duration)
p95(field)95th percentilep95(transaction.duration)
p99(field)99th percentilep99(transaction.duration)
failure_rate()Rate of failed transactionsfailure_rate()
apdex(threshold)Apdex scoreapdex(300)
eps()Events per secondeps()
epm()Events per minuteepm()

Example queries

Top error types in production

curl "https://sentry.io/api/0/organizations/my-org/events/?field=error.type&field=count()&query=event.type:error&environment=production&orderby=-count()&statsPeriod=24h" \
  -H "Authorization: Bearer <token>"

Slow transactions by P95

curl "https://sentry.io/api/0/organizations/my-org/events/?field=transaction&field=p95(transaction.duration)&field=count()&query=event.type:transaction&orderby=-p95(transaction.duration)&statsPeriod=7d" \
  -H "Authorization: Bearer <token>"

Users affected by a specific error

curl "https://sentry.io/api/0/organizations/my-org/events/?field=user.email&field=count()&query=TypeError&orderby=-count()&statsPeriod=24h" \
  -H "Authorization: Bearer <token>"

Build docs developers (and LLMs) love