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:

query findAlerts($id: ID!) {
alerts(
where: {
# Will filter for both "company.id"
# and "relatedCompanies.id"
company: {
id: { eq: $id }
}
}
) {
id
title
text
company {
id
displayName
}
relatedCompanies {
id
displayName
}
}
}
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

query findAlerts($dataset: String!, $class: String!) {
alerts(
where: {
dataset: { eq: $dataset },
class: { code: { eq: $class } }
}
) {
id
title
text
dataset
class {
code
label
}
}
}
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

query findAlerts($from: String!, $to: String!) {
alerts(
where: {
publishedAt: {
gte: $from
lte: $to
}
}
) {
id
title
text
company {
displayName
}
publishedAt
}
}

Find a single Alert by its id

query findAlert($id: ID) {
alert(id: $id) {
id
title
text
}
}
Copy link
On this page
Examples