data
NewsAPI CLI for AI Agents
Use the NewsAPI CLI from KosmoKrator to call NewsAPI tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.NewsAPI CLI Setup
NewsAPI can be configured headlessly with `kosmokrator integrations:configure newsapi`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure newsapi --set api_key="$NEWSAPI_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor newsapi --json
kosmokrator integrations:status --json Credentials
Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
api_key | NEWSAPI_API_KEY | Secret secret | yes | API Key |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call newsapi.newsapi_everything '{}' --json kosmo integrations:newsapi newsapi_everything '{}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs newsapi --json
kosmo integrations:docs newsapi.newsapi_everything --json
kosmo integrations:schema newsapi.newsapi_everything --json
kosmo integrations:search "NewsAPI" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
newsapi.newsapi_everything
Search across indexed news articles.
read - Parameters
- none
kosmo integrations:call newsapi.newsapi_everything '{}' --json kosmo integrations:newsapi newsapi_everything '{}' --json newsapi.newsapi_top_headlines
Retrieve live top and breaking headlines.
read - Parameters
- none
kosmo integrations:call newsapi.newsapi_top_headlines '{}' --json kosmo integrations:newsapi newsapi_top_headlines '{}' --json newsapi.newsapi_sources
List news sources available for top headlines.
read - Parameters
- none
kosmo integrations:call newsapi.newsapi_sources '{}' --json kosmo integrations:newsapi newsapi_sources '{}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
newsapi.newsapi_everything 0 parameters
kosmo integrations:schema newsapi.newsapi_everything --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
newsapi.newsapi_top_headlines 0 parameters
kosmo integrations:schema newsapi.newsapi_top_headlines --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
newsapi.newsapi_sources 0 parameters
kosmo integrations:schema newsapi.newsapi_sources --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.