We use cookies to ensure you get the best experience on our website. Some of these cookies are provided by third parties. You are free to decide which categories you would like to permit and can withdraw this consent at any time (via cookie preferences link on the footer).
By accepting the necessary cookies, you agree to our privacy policy and terms of service, both located in the footer of the website.
Learn more on our terms of service and privacy policy.
Search and inspect AskNews articles
asknews news search [query]Search enriched real-time or historical news
Arguments:
| Argument | Description |
|---|---|
[query] | natural-language or keyword query Default: "". |
Options:
| Option | Description |
|---|---|
-n, --limit <number> | alias for --n-articles Default: "10". |
--start-timestamp <value> | Timestamp to start search from [query, string, optional] |
--end-timestamp <value> | Timestamp to end search at [query, string, optional] |
--time-filter <value> | Control which date type to filter on. 'crawl_date' is the date the article was crawled, 'pub_date' is the date the article was published. [query, string, optional, default: "crawl_date"] Choices: crawl_date, pub_date. |
--return-type <value> | Type of return value. 'string' means that the return is prompt-optimized and ready to be immediately injected into any prompt. 'dicts' means that the return is a structured dictionary, containing additional metadata (like a classic news api). Can be 'string' or 'dicts', or 'both'. 'string' guarantees the lowest-latency response 'dicts' requires more I/O, therefore increases latency (very slightly, depending on your network connection). [query, string, optional, default: "dicts"] Choices: string, dicts, both. |
--historical [boolean] | Search on archive of historical news. Defaults to False, meaning that the search will only look through the most recent news (48 hours) [query, boolean, optional, default: false] |
--method <value> | Method to use for searching. 'nl' means Natural Language, which is a string that can be any phrase, keyword, question, or paragraph that will be used for semantic search on the news. 'kw' means Keyword, which can also be any keyword(s), phrase, or paragraph, however the search is a direct keyword search on the database. 'both' means both methods will be used and results will be ranked according to IRR. 'both' may reduce latency by 10 pct in exchange for improved accuracy. [query, string, optional, default: "kw"] Choices: nl, kw, both. |
--similarity-score-threshold <value> | Similarity score threshold to determine which articles to return. Lower means less similar results are allowed. [query, number, optional, default: 0.5] |
--offset <value> | Offset for pagination. The n_articles is your page size, while your offset is the number of articles to skip to get to your page of interest. For example, if you want to get page 3 for n_article page size of 10, you would set offset to 20. [query, string, optional, default: 0] |
--categories <value> | Categories of news to filter on [query, array<string>, optional] |
--doc-start-delimiter <value> | Document start delimiter for string return. [query, string, optional, default: "<doc>"] |
--doc-end-delimiter <value> | Document end delimiter for string return. [query, string, optional, default: "</doc>"] |
--provocative <value> | Filter articles based on how provocative they are deemed based on the use of provocative language and emotional vocabulary. [query, string, optional] Choices: unknown, low, medium, high, all. |
--reporting-voice <value> | Type of reporting voice to filer by. [query, string, optional] |
--domain-url <value> | filter by domain url of interest. This can be a single domain or a list of domains. For example, 'npr.org' or ['nature.com', 'npr.org'] [query, string, optional] |
--bad-domain-url <value> | blacklist of domains that must be excluded from resultsThis can be a single domain url or a list of domain urls. [query, string, optional] |
--page-rank <value> | Maximum allowed page rank for returned articles. [query, string, optional] |
--diversify-sources [boolean] | Ensure that the return set of articles are selected from diverse sources. This adds latency to the search, but attempts to balance the representation of sources by country and source origins. In summary, a net is cast around your search, then the diversity of sources is analyzed, and your final result matches the large net diversity distribution. This means that your search accuracy is reduced, but you gain more diverse perspectives. [query, boolean, optional, default: false] |
--strategy <value> | Strategy to use for searching. 'latest news' automatically setsmethod='nl', historical=False, and looks within the past 24 hours. 'news knowledge' automatically sets method='kw', historical=True, and looks within the past 60 days. 'news knowledge' will increase latency due to the larger search space in the archive. Use 'default' if you want to control start_timestamp, end_timestamp, historical, and method. [query, string, optional, default: "default"] Choices: latest news, news knowledge, default. |
--hours-back <value> | Can be set to easily control the look back on the search. This is the same as controlling the 'start_timestamp' parameter. The difference is that this is not a timestamp, it is the number of hours back to look from the current time. Defaults to 24 hours. [query, integer, optional, default: 24] |
--string-guarantee <value> | If defined, the search will only occur on articles that contain strings in this list. [query, string, optional] |
--string-guarantee-op <value> | Operator to use for string guarantee list. [query, string, optional, default: "AND"] Choices: AND, OR. |
--reverse-string-guarantee <value> | If defined, the search will only occur on articles that do not contain strings in this list. [query, string, optional] |
--entity-guarantee <value> | Entity guarantee to filter by. This is a list of strings, where each string includes entity type and entity value separated by a colon. The first element is the entity type and the second element is the entity value. For example ['Location:Paris', 'Person:John'] [query, string, optional] |
--reverse-entity-guarantee <value> | Reverse entity guarantee to filter by. This is a list of strings, where each string includes entity type and entity value separated by a colon. The first element is the entity type and the second element is the entity value. For example ['Location:Paris', 'Person:John'] [query, string, optional] |
--entity-guarantee-op <value> | Operator to use for entity guarantee list. [query, string, optional, default: "OR"] Choices: AND, OR. |
--return-graphs [boolean] | Return graphs for the articles. Only available to Analyst tier and above. [query, boolean, optional, default: false] |
--return-geo [boolean] | Return GeoCoordinates associated with locations discussed inside the articles. Only available to Analyst tier and above. [query, boolean, optional, default: false] |
--languages <value> | Languages to filter by. This is the two-letter 'set 1' of the ISO 639-1 standard. For example: English is 'en'. [query, string, optional] |
--countries <value> | Source countries to filter by (this is only for the publisher location, not the locations mentioned in articles. For Locations mentioned in articles, refer to entity_guarantee), countries must be the two-letter ISO country codeFor example: United States is 'US', France is 'FR', Sweden is 'SE'. [query, string, optional] |
--countries-blacklist <value> | Source countries to blacklist from search (this is only for the publisher location, not the locations mentioned in articles. For Locations mentioned in articles, refer to reverse_entity_guarantee), countries must be the two-letter ISO country codeFor example: United States is 'US', France is 'FR', Sweden is 'SE'. [query, string, optional] |
--continents <value> | Continents to filter by. [query, string, optional] |
--sentiment <value> | Sentiment to filter articles by. [query, string, optional] |
--premium [boolean] | Include premium sources. [query, boolean, optional, default: false] |
--authors <value> | Authors to filter articles by. [query, string, optional] |
--try-cache <value> | Enable response caching with the specified TTL. When a cached response is returned, usage is charged at 0.25x the normal rate. Valid values: '1h' (1 hour), '6h' (6 hours), '12h' (12 hours), '24h' (24 hours), '3d' (3 days), '7d' (7 days). [query, string, optional] |
--geo-lat <value> | Latitude for geo-radius filter. Must be provided together with geo_lon and geo_radius. Filters articles whose coordinates fall within the specified circle. [query, string, optional] |
--geo-lon <value> | Longitude for geo-radius filter. Must be provided together with geo_lat and geo_radius. [query, string, optional] |
--geo-radius <value> | Radius in meters for geo-radius filter. Must be provided together with geo_lat and geo_lon. [query, string, optional] |
--geo-polygon <value> | JSON string defining a polygon for geo filtering. Must contain an 'exterior' key with a list of {lon, lat} points. The first and last point must be the same. Optionally include 'interiors' as a list of rings (each a list of {lon, lat} points) to exclude areas. Example: {"exterior": [{"lon": -70, "lat": -70}, {"lon": 60, "lat": -70}, {"lon": 60, "lat": 60}, {"lon": -70, "lat": 60}, {"lon": -70, "lat": -70}]} [query, string, optional] |
Examples:
asknews news search "latest AI policy" --limit 5
asknews news search "semiconductor policy" --strategy "news knowledge" --output jsonasknews news get <article-id>Get an article by ID
Arguments:
| Argument | Description |
|---|---|
<article-id> | AskNews article UUID |
Examples:
asknews news get ARTICLE_ID --output jsonAll commands support --output human|table|json|jsonl|yaml, --json, API/auth URL
overrides, request timeout, and color control. Result data is written to stdout; diagnostics
are written to stderr.