|
| 1 | +# @creatorcrawl/sdk |
| 2 | + |
| 3 | +Official TypeScript / JavaScript SDK for the [CreatorCrawl](https://creatorcrawl.com) social media data API. |
| 4 | + |
| 5 | +One typed client, six platforms: **TikTok, Instagram, YouTube, LinkedIn, Twitter/X, and Reddit**. Profiles, posts, comments, transcripts, ads, search, and trending data as structured JSON. |
| 6 | + |
| 7 | +- 60+ endpoints across six platforms |
| 8 | +- Fully typed, ESM + CJS, zero runtime dependencies |
| 9 | +- Works in Node 18+, Bun, Deno, Cloudflare Workers, and browsers |
| 10 | +- Same endpoints are also available as a native MCP server for Claude, Cursor, Windsurf, and Zed |
| 11 | + |
| 12 | +## Install |
| 13 | + |
| 14 | +```bash |
| 15 | +npm install @creatorcrawl/sdk |
| 16 | +# or |
| 17 | +pnpm add @creatorcrawl/sdk |
| 18 | +# or |
| 19 | +yarn add @creatorcrawl/sdk |
| 20 | +``` |
| 21 | + |
| 22 | +## Quick start |
| 23 | + |
| 24 | +Get a key at [creatorcrawl.com](https://creatorcrawl.com). 250 credits are free on signup, no card required. |
| 25 | + |
| 26 | +```ts |
| 27 | +import { CreatorCrawl } from '@creatorcrawl/sdk' |
| 28 | + |
| 29 | +const cc = new CreatorCrawl({ apiKey: process.env.CREATORCRAWL_API_KEY! }) |
| 30 | + |
| 31 | +const profile = await cc.tiktok.profile({ handle: 'khaby.lame' }) |
| 32 | +const transcript = await cc.youtube.transcript({ url: 'https://youtu.be/...' }) |
| 33 | +const company = await cc.linkedin.company({ url: 'https://www.linkedin.com/company/openai' }) |
| 34 | +``` |
| 35 | + |
| 36 | +## Resources |
| 37 | + |
| 38 | +```ts |
| 39 | +cc.tiktok.profile({ handle }) |
| 40 | +cc.tiktok.profileVideos({ handle }) |
| 41 | +cc.tiktok.videoInfo({ url }) |
| 42 | +cc.tiktok.transcript({ url }) |
| 43 | +cc.tiktok.searchKeyword({ query }) |
| 44 | +cc.tiktok.searchUsers({ query }) |
| 45 | +cc.tiktok.comments({ url }) |
| 46 | + |
| 47 | +cc.instagram.profile({ handle }) |
| 48 | +cc.instagram.posts({ handle }) |
| 49 | +cc.instagram.postInfo({ url }) |
| 50 | +cc.instagram.reels({ handle }) |
| 51 | +cc.instagram.comments({ url }) |
| 52 | +cc.instagram.transcript({ url }) |
| 53 | + |
| 54 | +cc.youtube.channel({ handle }) |
| 55 | +cc.youtube.channelVideos({ handle }) |
| 56 | +cc.youtube.channelShorts({ handle }) |
| 57 | +cc.youtube.video({ url }) |
| 58 | +cc.youtube.search({ query }) |
| 59 | +cc.youtube.transcript({ url }) |
| 60 | +cc.youtube.comments({ url }) |
| 61 | +cc.youtube.playlist({ url }) |
| 62 | + |
| 63 | +cc.linkedin.profile({ url }) |
| 64 | +cc.linkedin.company({ url }) |
| 65 | +cc.linkedin.companyPosts({ url }) |
| 66 | +cc.linkedin.post({ url }) |
| 67 | +cc.linkedin.adsSearch({ query }) |
| 68 | +cc.linkedin.ad({ url }) |
| 69 | + |
| 70 | +cc.twitter.profile({ handle }) |
| 71 | +cc.twitter.tweet({ url }) |
| 72 | +cc.twitter.userTweets({ handle }) |
| 73 | +cc.twitter.transcript({ url }) |
| 74 | +cc.twitter.community({ url }) |
| 75 | +cc.twitter.communityTweets({ url }) |
| 76 | + |
| 77 | +cc.reddit.search({ query }) |
| 78 | +cc.reddit.subredditDetails({ subreddit }) |
| 79 | +cc.reddit.subredditPosts({ subreddit }) |
| 80 | +cc.reddit.subredditSearch({ subreddit, query }) |
| 81 | +cc.reddit.postComments({ url }) |
| 82 | +``` |
| 83 | + |
| 84 | +## Configuration |
| 85 | + |
| 86 | +```ts |
| 87 | +const cc = new CreatorCrawl({ |
| 88 | + apiKey: 'cc_...', |
| 89 | + baseUrl: 'https://app.creatorcrawl.com/api', // optional |
| 90 | + timeout: 30_000, // optional, ms |
| 91 | + fetch: customFetch, // optional |
| 92 | +}) |
| 93 | +``` |
| 94 | + |
| 95 | +## Error handling |
| 96 | + |
| 97 | +Failed requests throw a typed `CreatorCrawlError`: |
| 98 | + |
| 99 | +```ts |
| 100 | +import { |
| 101 | + AuthenticationError, |
| 102 | + CreatorCrawlError, |
| 103 | + InsufficientCreditsError, |
| 104 | + RateLimitError, |
| 105 | + UpstreamError, |
| 106 | +} from '@creatorcrawl/sdk' |
| 107 | + |
| 108 | +try { |
| 109 | + await cc.tiktok.profile({ handle: 'khaby.lame' }) |
| 110 | +} catch (err) { |
| 111 | + if (err instanceof InsufficientCreditsError) { |
| 112 | + // top up credits |
| 113 | + } else if (err instanceof RateLimitError) { |
| 114 | + // back off |
| 115 | + } else if (err instanceof CreatorCrawlError) { |
| 116 | + console.error(err.status, err.message) |
| 117 | + } |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +## Cancellation |
| 122 | + |
| 123 | +Every method accepts a `RequestOptions` argument with an `AbortSignal`: |
| 124 | + |
| 125 | +```ts |
| 126 | +const controller = new AbortController() |
| 127 | +setTimeout(() => controller.abort(), 5_000) |
| 128 | + |
| 129 | +await cc.tiktok.profile({ handle: 'khaby.lame' }, { signal: controller.signal }) |
| 130 | +``` |
| 131 | + |
| 132 | +## Links |
| 133 | + |
| 134 | +- API docs: [creatorcrawl.com/mcp-docs](https://creatorcrawl.com/mcp-docs) |
| 135 | +- Pricing: [creatorcrawl.com/#pricing](https://creatorcrawl.com/#pricing) |
| 136 | +- MCP server: native MCP at `app.creatorcrawl.com/api/mcp` for AI agents |
| 137 | +- Status / issues: [github.com/simonbalfe/creator-crawl/issues](https://github.com/simonbalfe/creator-crawl/issues) |
| 138 | + |
| 139 | +## License |
| 140 | + |
| 141 | +MIT |
0 commit comments