Alerts API Queries
Alerts API follows the same basic principles as other GraphQL APIs. There are two top-level nodes available: alerts and alert. It's possible to specify custom filters and sort order to retrieve a required subset of Alerts. Larger workflows could benefit from using pagination when the number of Alerts returned doesn't fit into a single API response.
You may find all entity types defined in Alerts API Reference.

Examples

Find Alerts by Company ID:

1
query findAlerts($id: ID!) {
2
alerts(
3
where: {
4
# Will filter for both "company.id"
5
# and "relatedCompanies.id"
6
company: {
7
id: { eq: $id }
8
}
9
}
10
) {
11
id
12
title
13
text
14
company {
15
id
16
displayName
17
}
18
relatedCompanies {
19
id
20
displayName
21
}
22
}
23
}
Copied!
Alerts have two main fields storing the Company data:
  • company
    • Represents the specific company that is a subject of a given Alert. It's present on the Alerts describing events that happened to that particular Company. For example, headcount change or financial metrics change. If Alert describes an event that is generally related to multiple companies, this field will be null, to process the list of related companies, please refer to the field below.
  • relatedCompanies
    • Represents all the companies related to the event described by the Alert. Will contain a single item for events that are specific to the given Company or multiple items for more general events affecting multiple Companies at once.

Find Alerts by dataset and class

1
query findAlerts($dataset: String!, $class: String!) {
2
alerts(
3
where: {
4
dataset: { eq: $dataset },
5
class: { code: { eq: $class } }
6
}
7
) {
8
id
9
title
10
text
11
dataset
12
class {
13
code
14
label
15
}
16
}
17
}
Copied!
Dataset examples:
  • news for Alerts about news articles describing a certain change for a particular Company
  • employees for Alerts describing changes in the employee count for a particular Company
  • news_commodities for Alerts representing news on certain Commodities
  • balance_sheet
  • news_events
  • pnl
  • jobs
Class examples:
awards, bankruptcy, commodity, conference, cybersecurity, environmental_impact, epidemic, financial_changes, ...
Please, note that particular dataset and class availability depends on your contractual agreement with Craft. Reach out to [email protected] for additional details.

Find Alerts for a particular date range

1
query findAlerts($from: String!, $to: String!) {
2
alerts(
3
where: {
4
publishedAt: {
5
gte: $from
6
lte: $to
7
}
8
}
9
) {
10
id
11
title
12
text
13
company {
14
displayName
15
}
16
publishedAt
17
}
18
}
Copied!

Find a single Alert by its id

1
query findAlert($id: ID) {
2
alert(id: $id) {
3
id
4
title
5
text
6
}
7
}
Copied!
Copy link
Contents
Examples