{"_id":"@apitwitter/sdk","name":"@apitwitter/sdk","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@apitwitter/sdk","version":"1.0.0","description":"JavaScript/TypeScript SDK for the ApiTwitter REST API — Twitter/X data access","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"keywords":["twitter","api","sdk","x","tweets","social-media","typescript"],"author":{"name":"ApiTwitter","email":"support@apitwitter.com"},"license":"MIT","homepage":"https://apitwitter.com","repository":{"type":"git","url":"git+https://github.com/apitwitter/js-sdk.git"},"devDependencies":{"typescript":"^5.0.0"},"engines":{"node":">=18.0.0"},"_id":"@apitwitter/sdk@1.0.0","bugs":{"url":"https://github.com/apitwitter/js-sdk/issues"},"_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-4CwXALjoFlMoxX13jxMQttFtps9fo3GZNMS1x+6prO+tbEZN2jSHSYoutDYdC+YaE+BhIxki7knwJBd1Rxcyrg==","shasum":"b241988bf79f3640b8838d8f476893a65c05aa16","tarball":"https://registry.npmjs.org/@apitwitter/sdk/-/sdk-1.0.0.tgz","fileCount":6,"unpackedSize":26558,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDn3btxcbmriRMBd0DH4mbq9NbuMuulGDRdLPVP3iUl4QIgGkCcERTl14AlUetRGhc/Av6SMbFYC61FkAOiQzwF97k="}]},"_npmUser":{"name":"apitwitter","email":"wotpremsss@gmail.com"},"directories":{},"maintainers":[{"name":"apitwitter","email":"wotpremsss@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.0_1773399900299_0.6093929186993263"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-13T11:05:00.214Z","1.0.0":"2026-03-13T11:05:00.435Z","modified":"2026-03-13T11:05:00.635Z"},"maintainers":[{"name":"apitwitter","email":"wotpremsss@gmail.com"}],"description":"JavaScript/TypeScript SDK for the ApiTwitter REST API — Twitter/X data access","homepage":"https://apitwitter.com","keywords":["twitter","api","sdk","x","tweets","social-media","typescript"],"repository":{"type":"git","url":"git+https://github.com/apitwitter/js-sdk.git"},"author":{"name":"ApiTwitter","email":"support@apitwitter.com"},"bugs":{"url":"https://github.com/apitwitter/js-sdk/issues"},"license":"MIT","readme":"# ApiTwitter JavaScript/TypeScript SDK\n\nOfficial SDK for the [ApiTwitter](https://apitwitter.com) REST API — access Twitter/X data without the official developer portal.\n\n## Installation\n\n```bash\nnpm install apitwitter\n```\n\n## Quick Start\n\n```typescript\nimport { ApiTwitter } from \"apitwitter\";\n\nconst client = new ApiTwitter(\"your-api-key\");\n\n// Get user profile (uses server pool — no cookies needed)\nconst user = await client.getUser(\"elonmusk\");\nconsole.log(user.name, user.followers);\n\n// Search tweets\nconst results = await client.search(\"javascript\", \"Top\", 10);\nresults.tweets.forEach((tweet) => console.log(tweet.text));\n\n// Get user tweets\nconst tweets = await client.getUserTweets(\"elonmusk\");\n```\n\n## Read Operations (Server Pool)\n\nNo cookies or proxy needed:\n\n```typescript\nconst client = new ApiTwitter(\"your-api-key\");\n\n// Users\nconst user = await client.getUser(\"username\");\nconst userById = await client.getUserById(\"12345\");\nconst users = await client.getUsersBatch([\"id1\", \"id2\"]);\nconst followers = await client.getFollowers(\"username\", 100);\nconst following = await client.getFollowing(\"username\", 100);\n\n// Tweets\nconst tweets = await client.getUserTweets(\"username\");\nconst tweetsById = await client.getTweets([\"id1\", \"id2\"]);\n\n// Search (product: \"Top\" | \"Latest\" | \"People\" | \"Photos\" | \"Videos\")\nconst results = await client.search(\"query\", \"Top\", 20);\n```\n\n## Write Operations (Own Credentials)\n\nRequires your own Twitter cookies and proxy:\n\n```typescript\nconst creds = {\n  cookie: \"ct0=...;auth_token=...\",\n  proxy: \"http://user:pass@host:port\",\n};\n\n// Tweet\nawait client.createTweet(\"Hello from ApiTwitter!\", creds);\n\n// Like / unlike\nawait client.like(\"tweet_id\", creds);\nawait client.unlike(\"tweet_id\", creds);\n\n// Retweet\nawait client.retweet(\"tweet_id\", creds);\n\n// Follow / unfollow\nawait client.follow(\"user_id\", creds);\nawait client.unfollow(\"user_id\", creds);\n\n// DM\nawait client.sendDm(\"user_id\", \"Hello!\", creds);\n\n// Bookmarks\nawait client.addBookmark(\"tweet_id\", creds);\nconst bookmarks = await client.getBookmarks(creds);\n\n// Timeline\nconst foryou = await client.getTimelineForYou(creds, 20);\nconst latest = await client.getTimelineLatest(creds, 20);\n```\n\n## Pagination\n\n```typescript\nlet result = await client.getFollowers(\"username\", 100);\nlet allFollowers = [...result.followers];\n\nwhile (result.next_cursor) {\n  result = await client.getFollowers(\"username\", 100, result.next_cursor);\n  allFollowers.push(...result.followers);\n}\n```\n\n## Error Handling\n\n```typescript\nimport {\n  ApiTwitter,\n  AuthenticationError,\n  InsufficientCreditsError,\n  RateLimitError,\n  NotFoundError,\n} from \"apitwitter\";\n\nconst client = new ApiTwitter(\"your-api-key\");\n\ntry {\n  const user = await client.getUser(\"username\");\n} catch (err) {\n  if (err instanceof AuthenticationError) {\n    console.log(\"Invalid API key\");\n  } else if (err instanceof InsufficientCreditsError) {\n    console.log(\"Top up your balance\");\n  } else if (err instanceof RateLimitError) {\n    console.log(`Rate limited, retry after ${err.retryAfter}s`);\n  } else if (err instanceof NotFoundError) {\n    console.log(\"User not found\");\n  }\n}\n```\n\n## Configuration\n\n```typescript\n// Simple\nconst client = new ApiTwitter(\"your-api-key\");\n\n// With options\nconst client = new ApiTwitter({\n  apiKey: \"your-api-key\",\n  baseUrl: \"https://api.apitwitter.com\", // default\n  timeout: 30, // seconds\n});\n```\n\n## Links\n\n- [Documentation](https://docs.apitwitter.com)\n- [API Reference](https://docs.apitwitter.com/api-reference)\n- [Website](https://apitwitter.com)\n- [Get API Key](https://apitwitter.com/dashboard)\n- [Telegram Support](https://t.me/ApiTwitter)\n","readmeFilename":"README.md","_rev":"1-51d46a3e4583c70100b467de438c1ddb"}