A fully typed TypeScript SDK for social media data.

@bridgly/sdk is the official TypeScript and JavaScript client for Bridgly. Every endpoint is a typed function, client.linkedin.getProfileFromUrl(), client.x.getUserTweets(), client.reddit.searchPosts(), so your editor autocompletes every input and result field. Pagination, concurrency and rate-limit retries are built in.

enrich.ts
import { Bridgly } from "@bridgly/sdk";
const bridgly = new Bridgly({ apiKey: process.env.BRIDGLY_KEY });
const profile = await bridgly.linkedin.getProfileFromUrl({
memberIdentity: "satya-nadella",
});
profile.▮
◆followersnumber
◆handlestring
◆headlinestring
◆locationstring
◆namestring
◆verifiedboolean
(property) Profile.followers: number
[ QUICK START ]

Get started with the TypeScript SDK in 3 steps

  1. 1

    Install the package

    Install from npm with your package manager of choice. Types ship in the package, there is no separate @types install.

    terminal
    npm install @bridgly/sdk
  2. 2

    Create a client

    Pass your API key, ideally from an environment variable. The constructor throws if the key is missing, so a misconfigured deploy fails at startup.

    bridgly.ts
    import { Bridgly } from "@bridgly/sdk";
    export const client = new Bridgly({
    apiKey: process.env.BRIDGLY_API_KEY!,
    });
  3. 3

    Call an endpoint

    Every call returns a result you narrow on type. On success you get typed data, plus creditsCost and timeMs.

    profile.ts
    const res = await client.reddit.getUser({ username: "spez" });
    if (res.type === "success") {
    console.log(res.data.linkKarma, res.creditsCost);
    } else {
    console.error(res.status, res.message);
    }
[ FEATURES ]

What you get with the Bridgly TypeScript SDK

Typed end to end

Inputs and outputs come from the same schemas the API validates with. Rename a field upstream and your build tells you.

Errors you cannot forget

API and network failures come back as { type: "error", status, message } instead of throwing, so TypeScript makes you handle them.

Automatic pagination

Pass pagination: true and count: 500 to any list function. The SDK walks the pages and returns one combined result.

Concurrency control

Fire hundreds of calls with Promise.all. The client sends at most maxConcurrency per platform at a time and queues the rest.

Rate-limit retries

A 429 is retried after the wait the API asks for, up to maxRetries times. Rejected requests cost nothing.

Account management

Create and revoke API keys, read your balance and set auto top-up from code with client.apiKeys and client.billing.

Namespaces and functions

The client groups functions by platform. Each function maps to one API endpoint and takes the same fields as its JSON body.

NamespaceFunctions
client.linkedingetProfileFromUrl, getCompanyFromUrl, getJob, getPostsFromProfile, getPostDetail, searchJobs, searchCompanies, searchPosts and more
client.xgetUser, getUserTweets, getTweetDetail, getTweetReplies, getFollowers, getFollowing, search, searchUsers
client.redditgetPost, getUser, getSubreddit, listSubredditPosts, listUserComments, searchPosts, searchComments
client.githubgetProfile, getContributions, listRepositories, searchRepositories, searchCode, searchIssues
client.instagramgetUser, getUserPosts, getFollowers, getPost, getPostComments, searchUsers
client.tiktokgetUser, getUserPosts, getVideo, getVideoComments, getHashtagVideos, searchVideos
client.youtubegetVideo, with an optional transcript
client.apiKeys, client.billingcreate, list, revoke, getInfo, updateAutoTopUp

Collect every page with one call

List functions return one page and a nextCursor. With pagination: true, count becomes the total you want and the SDK requests pages until it has them or the list ends. creditsCost and timeMs add up across pages, and the last nextCursor lets you resume later.

followers.ts
const res = await client.x.getFollowers({
userId: "44196397",
count: 500,
pagination: true,
});
if (res.type === "success") {
console.log(res.data.users.length); // about 500
console.log(res.creditsCost); // every page together
console.log(res.data.nextCursor); // resume from here later
}

Run calls in parallel safely

Map over a list of inputs and await them together. The client keeps at most maxConcurrency requests in flight per platform (2 by default) and retries rate-limited ones, so a big batch does not fail halfway. Raise maxConcurrency if your plan allows more requests per second.

enrich-leads.ts
import { Bridgly } from "@bridgly/sdk";
const client = new Bridgly({
apiKey: process.env.BRIDGLY_API_KEY!,
maxConcurrency: 5, // Growth tier allows 5 requests per second
maxRetries: 3,
});
const urls = [
"https://www.linkedin.com/in/satya-nadella",
"https://www.linkedin.com/in/williamhgates",
];
const results = await Promise.all(
urls.map((memberIdentity) =>
client.linkedin.getProfileFromUrl({ memberIdentity }),
),
);
const profiles = results.flatMap((res) =>
res.type === "success" ? [res.data] : [],
);

Use the types in your own code

Every request and response type is exported, so you can type your database rows, API routes and React props with the exact shape Bridgly returns.

types.ts
import type {
GetXUserRequest,
XUserResponse,
RedditUserResponse,
TikTokUser,
} from "@bridgly/sdk";

Configuration

OptionDefaultWhat it does
apiKeyrequiredYour bgly_ API key.
baseUrlhttps://api.bridgly.appWhere requests are sent.
maxConcurrency2Requests per platform sent at once. Extra calls queue.
maxRetries3Retries after a 429, waiting for Retry-After each time.

Run the SDK on the server: Node.js, serverless functions or a background worker. Shipping your API key to a browser lets anyone spend your credits.

[ FAQ ]

TypeScript SDK questions

Does the SDK work with plain JavaScript?

Yes. It ships ESM and CommonJS builds, so import and require both work. TypeScript adds autocomplete and type checking on top.

Which runtimes are supported?

The SDK uses the standard fetch API and has a single dependency, Zod. It runs on current Node.js versions and in server-side runtimes and serverless functions that provide fetch.

Does the SDK throw errors?

API and network errors are returned as { type: "error", status, message }. It only throws when the client is created without an API key, or when an input fails validation before any request is sent.

Is there a Python SDK?

Not yet. From Python, call the REST API directly with requests or httpx. Every endpoint is a single POST request with a JSON body.

Is the SDK open source?

Yes, it is MIT licensed and published to npm as @bridgly/sdk.

Pull your first profile in minutes.

Start with 100 free credits on a business email. The same data flows through the API, MCP, SDK and CLI.

APIMCPSDKCLI
free credits

On business email signup. No credit card required.

Start with 100 credits