> ## Documentation Index
> Fetch the complete documentation index at: https://newscatcherinc-docs.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK

> TypeScript client library for News API

TypeScript SDK provides access to the News API from TypeScript or JavaScript
applications.

## Installation

```bash theme={null}
# npm
npm install newscatcher-sdk

# yarn
yarn add newscatcher-sdk

# pnpm
pnpm add newscatcher-sdk
```

## Basic usage

```typescript theme={null}
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

```typescript theme={null}
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](https://github.com/Newscatcher/newscatcher-typescript).

## Resources

* [GitHub repository](https://github.com/Newscatcher/newscatcher-typescript)
* [npm package](https://www.npmjs.com/package/newscatcher-sdk)
