Use this sample app to try the Threads API. We update the app over time, so it may not cover the latest features. See the Developer Documentation Changelog for the latest API updates.
- Login and Account: Sign in with Threads. View your profile details or sign out.
- Publishing: Publish text, image, video, and carousel posts.
- Publishing Options: Add topic tags, link attachments, alt text, and polls. Set the reply audience, add spoilers, or create ghost posts.
- Replies, Quotes, and Reposts: Reply to, quote, or repost an existing post.
- Post Browsing: Browse your posts, your replies, and posts that mention you. View post details and conversations.
- Reply Management: Hide or unhide replies in the direct-replies view.
- Search: Search by keyword or topic tag. Choose Top or Recent results. Filter by date, media type, and author. See the Search Guide for parameters and limits.
- Public Profiles: Look up a public profile. Browse its posts.
- Post Insights: View post metrics. Filter by date.
- User Insights: View account metrics. Filter by date.
- Quotas: View API usage. Refresh the reported counts.
- Token Debugging: Inspect an access token's permissions and expiration date.
- Post and Profile Embeds: Preview public Threads post or profile embeds in light or dark mode.
- Deletion: Delete a post you own from the posts list or post details page. Confirm the warning to continue. Deletion cannot be undone. Use a test app and test user. See Delete Posts for permissions and limits.
- Postman Collection: Use the public Threads Postman Collection or import
postman/threads-api.postman_collection.jsoninto Postman.
Use Node.js 18 or later. You also need mkcert to generate a local HTTPS certificate. If you use the included devcontainer, make sure your IDE supports devcontainers. Enable them before starting.
-
Install Node.js and mkcert. On macOS with Homebrew, run
brew install node. Then runbrew install mkcert. If you use the included devcontainer, skip to step 2. -
Run
npm installin the sample app directory. -
Create a new file called
.envand copy/paste all the environment variables from.env.template. Replace the placeholder values. SetAPP_IDandAPI_SECRETto the Threads app ID and secret from your app dashboard. These differ from the regular app ID and secret. Add the fullREDIRECT_URI, such ashttps://threads-sample.meta:8000/callback, to your app’s redirect callback URLs. -
Map your local domain to
127.0.0.1. Threads apps do not acceptlocalhostin redirect URLs. On Linux or macOS, add this entry to/etc/hosts:127.0.0.1 threads-sample.metaUse the same domain for
HOSTin.env. If you use a different domain or port, updateHOSTorPORTas needed. Make sureREDIRECT_URIand the registered callback URL match. -
Run
mkcert threads-sample.metafrom the sample app directory. OAuth redirects require HTTPS. The command createsthreads-sample.meta.pemandthreads-sample.meta-key.pem. If you chose a different domain, use it in the command instead. -
Run
npm start. Open https://threads-sample.meta:8000 once the app starts. If you chose a different domain or port, use those values in the URL.
Run lint, formatting, and tests before opening a pull request:
npm install --ignore-scripts --no-audit --no-fund --package-lock=false
npm run lint
npm run format:check
npm testTests use mocked API responses. They do not call the Threads API.
GitHub Actions runs these checks for pull requests. It also runs them for pushes to main. Both Node.js 24 and 26 are covered.
See LICENSE for the software license and the platform policy that applies to its use.