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

# TypeScript SDK

> A fully typed client for the Bridgly API, for Node.js and the browser runtime of your choice.

[`bridgly`](https://www.npmjs.com/package/bridgly) is the official
TypeScript/JavaScript client for the Bridgly API. It
wraps every LinkedIn, X (Twitter), and Reddit endpoint — plus API-key and
billing management — in typed methods, so your editor autocompletes each request
field and knows the exact shape of every response.

<CardGroup cols={2}>
  <Card title="Fully typed" icon="brackets-curly">
    Request and response types are generated from the same schemas the API
    validates against, so they never drift.
  </Card>

  <Card title="No exceptions to catch" icon="circle-check">
    Every method returns a discriminated result you branch on — success or
    error, always typed.
  </Card>

  <Card title="One client, every platform" icon="layer-group">
    Grouped namespaces: `client.x`, `client.reddit`, `client.linkedin`, plus
    `client.apiKeys` and `client.billing`.
  </Card>

  <Card title="Zero dependencies to manage" icon="feather">
    Uses the built-in `fetch`. Works in Node.js 18+ and modern runtimes.
  </Card>
</CardGroup>

## Install

<CodeGroup>
  ```bash npm theme={"dark"}
  npm install bridgly
  ```

  ```bash pnpm theme={"dark"}
  pnpm add bridgly
  ```

  ```bash yarn theme={"dark"}
  yarn add bridgly
  ```

  ```bash bun theme={"dark"}
  bun add bridgly
  ```
</CodeGroup>

## Create a client

Construct the client once with your API key and reuse it across your app. Get a
key from the **API Keys** page of your
[dashboard](https://bridgly.app/dashboard).

```ts theme={"dark"}
import { Bridgly } from 'bridgly';

const client = new Bridgly({ apiKey: process.env.BRIDGLY_API_KEY });
```

<Warning>
  Keep your key server-side. Never ship it in a browser bundle, mobile app, or
  public repository — anyone with the key can spend your credits.
</Warning>

## Configuration

```ts theme={"dark"}
new Bridgly({
  apiKey: 'bgly_...', // required
  baseUrl: 'https://api.bridgly.app', // optional — override the API base URL
});
```

<ResponseField name="apiKey" type="string" required>
  Your Bridgly API key. Starts with `bgly_`. The client throws immediately if
  this is missing or empty.
</ResponseField>

<ResponseField name="baseUrl" type="string">
  Override the API base URL. Defaults to the hosted Bridgly API. Useful for
  pointing at a staging environment.
</ResponseField>

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/sdk/quickstart">
    Make your first typed call and read the result.
  </Card>

  <Card title="Functions" icon="grid-2" href="/sdk/functions">
    Every scraping function across X, Reddit, and LinkedIn.
  </Card>

  <Card title="Account management" icon="key" href="/sdk/account">
    Create keys and manage credits from code.
  </Card>

  <Card title="Errors" icon="list-check" href="/sdk/errors-and-types">
    Handle API and network failures predictably.
  </Card>
</CardGroup>
