Query examples

This page provides additional examples of various queries for Alerts API

Find Alerts for a set of Companies between certain dates

We're using where filter with multiple fields to find all of the Alerts from January 2021 for two given companies. You may find more details about filters in Alerts API in the Filtering and sorting guide.

query findAlerts {
alerts(
where: {
company: {
id: { in: [334, 1842] }
},
publishedAt: {
gte: "2021-01-01",
lte: "2021-02-01"
}
}
) {
id
text
title
company {
displayName
}
}
}

Find all Alerts from a certain date till now

Such a query might potentially return more entities than allowed per page. Please see the Alerts API pagination guide for more details on how to work with paginated queries.

query findAlerts($after: ID!, $where: AlertBoolExpression!) {
alerts(
first: 100,
after: $after,
where: $where,
) {
text
title
class {
label
}
}
}

where argument could have the following shape:

{
"publishedAt": { "gt": "2021-01-01" }
}

Fetch all available Alert fields

This query demonstrates all of the fields currently available on the Alert node. You may find the full type definitions available in the Alerts API Reference.

query findAlerts {
alerts {
id
dataset
class {
code
label
}
title
text
source
value
variable
company {
id
displayName
homepage
}
period
publishedAt
occuredAt
}
}