Create a New Explore Saved Query
ExperimentalThis API is under active development and may change.
POST /api/0/organizations/{organization_id_or_slug}/explore/saved/
Create a new Explore saved query for the given organization.
Path Parameters
organization_id_or_slug(string)REQUIREDThe ID or slug of the organization the resource belongs to.
Body Parameters
name(string)REQUIREDThe user-defined saved query name.
query(array(object))REQUIREDThe Explore query definitions to save.
projects(array(integer))The saved projects filter for this query.
dataset(string)The dataset you would like to query. Supported values:
spans,logs,metrics,replays,ai_conversations.spanslogssegment_spansmetricsreplaysai_conversations
start(string)The saved start time for this saved query.
end(string)The saved end time for this saved query.
statsPeriod(string)The saved time range period for this saved query.
environment(array(string))The name of environments to filter by.
interval(string)Resolution of the time series.
crossEvents(array(object))Optional cross-event queries across event types. Max 2 entries.
agent(array(string))Agent names to filter conversations by.
errorsOnly(boolean)Whether to only show conversations with errors.
queryPriority(string)The query priority. Supported values:
normal,faster.normalfaster
Scopes
You need to authenticate via bearer auth token.
<auth_token> requires one of the following scopes:org:adminorg:readorg:write
Copied
curl https://sentry.io/api/0/organizations/{organization_id_or_slug}/explore/saved/ \ -H 'Authorization: Bearer <auth_token>' \ -H 'Content-Type: application/json' \ -d '{}'
RESPONSESCHEMA
Copied{ "id": "1", "name": "Pageloads", "projects": [], "dateAdded": "2024-07-25T19:35:38.422859Z", "dateUpdated": "2024-07-25T19:35:38.422874Z", "environment": [], "query": [ { "query": "span.op:pageload", "fields": [ "span.op", "project", "count(span.duration)", "avg(span.duration)", "p75(span.duration)", "p95(span.duration)" ], "orderby": "-count(span.duration)", "mode": "samples" } ], "statsPeriod": "24h", "dataset": "spans", "expired": false, "lastVisited": null, "starred": false, "position": null, "isPrebuilt": false, "changedReason": null, "queryPriority": "normal", "createdBy": { "id": "1", "name": "Admin", "username": "admin", "email": "admin@sentry.io", "avatarUrl": "www.example.com", "isActive": true, "isSuspended": false, "hasPasswordAuth": true, "isManaged": false, "dateJoined": "2021-10-25T17:07:33.190596Z", "lastLogin": "2024-07-16T15:28:39.261659Z", "has2fa": true, "lastActive": "2024-07-16T20:45:49.364197Z", "isSuperuser": false, "isStaff": false, "experiments": {}, "emails": [ { "id": "1", "email": "admin@sentry.io", "is_verified": true } ], "avatar": { "avatarType": "letter_avatar", "avatarUuid": null, "avatarUrl": "www.example.com" } } }
Was this helpful?