Documentation Index
Fetch the complete documentation index at: https://newscatcherinc-docs.mintlify.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
TypeScript SDK provides access to the News API from TypeScript or JavaScript
applications.
Installation
# npm
npm install newscatcher-sdk
# yarn
yarn add newscatcher-sdk
# pnpm
pnpm add newscatcher-sdk
Basic usage
import { NewscatcherApiClient } from "newscatcher-sdk";
const client = new NewscatcherApiClient({ apiKey: "YOUR_API_KEY" });
// Search for articles
await client.search.post({
q: "renewable energy",
predefinedSources: ["top 50 US"],
lang: ["en"],
from_: "2024-01-01T00:00:00Z",
to_: "2024-06-30T00:00:00Z",
additionalDomainInfo: true,
isNewsDomain: true,
});
Error handling
import { NewscatcherApiError } from "newscatcher-sdk";
try {
await client.search.post({
q: "renewable energy",
});
} catch (err) {
if (err instanceof NewscatcherApiError) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.body);
}
}
For complete documentation, including request/response types, retry
configuration, and timeouts, see the
GitHub repository.
Resources