Threads API for developers for programmatic access

Threads, An Instagram app is all the rage now. Threads is an alternative to Twitter and everyone’s hoping on the new platform now. If you’re a developer and looking for Threads API then continue reading.

Threads API

Threads API

There is no official developer API for Threads yet but a developer reverse-engineered the Threads API requests and created an unofficial API client.

The API client is an unofficial, Reverse-Engineered Node.js/TypeScript client for Meta’sĀ Threads.

šŸ“¦ Installation

yarn add threads-api
# or with npm
npm install threads-api
# or with pnpm
pnpm install threads-api

// or in Deno šŸ¦–
import ThreadsAPI from 'npm:threads-api';

const threadsAPI = new ThreadsAPI.ThreadsAPI({});

Threads API Usage

It is as simple as importing the API client and using the client’s methods. If you want to access public data then you can directly use the API but if you want to access private methods such as publishing a thread or following someone then you should initialize the API with username and password

Checkout the examples below:

How to fetch threads user profile from API

import APIClient from "threads-api";

const main = async () => {
  const threadsAPI = new APIClient.ThreadsAPI();

  const username = "codingislove";

  // šŸ‘¤ Details for a specific user
  const userID = await threadsAPI.getUserIDfromUsername(username);
  if (!userID) {
  const user = await threadsAPI.getUserProfile(username, userID);



  "is_private": false,
  "profile_pic_url": "",
  "username": "codingislove",
  "hd_profile_pic_versions": null,
  "is_verified": false,
  "biography": "If you're a developer, you should follow this account šŸ¤–",
  "biography_with_entities": null,
  "follower_count": 4,
  "profile_context_facepile_users": null,
  "bio_links": [{ "url": "" }],
  "pk": "5635301639",
  "full_name": "Coding is Love",
  "id": null

āœØ How to publish a thread using API

import APIClient from "threads-api";

const publishThread = async () => {
  const threadsAPI = new APIClient.ThreadsAPI({
    username: '_junhoyeo', // Your username
    password: 'PASSWORD', // Your password

  await threadsAPI.publish({
    text: 'šŸ¤– Hello World',


āœØ Threads with Image

await threadsAPI.publish({
  text: 'šŸ¤– Threads with Image',
  image: '',

āœØ Threads with Link Attachment

await threadsAPI.publish({
  text: 'šŸ¤– Threads with Link Attachment',
  url: '',

āœØ Reply to Other Threads

const parentURL = '';
const parentPostID = await threadsAPI.getPostIDfromURL(parentURL); // or use `getPostIDfromThreadID`

await threadsAPI.publish({
  text: 'šŸ¤– Beep',
  link: '',
  parentPostID: parentPostID,

āœØ Like/Unlike a Thread

const threadURL = '';
const postIDToLike = await threadsAPI.getPostIDfromURL(threadURL); // or use `getPostIDfromThreadID`

// šŸ’” Uses current credentials
await threadsAPI.unlike(postIDToLike);

āœØ Follow/Unfollow a User

const userIDToFollow = await threadsAPI.getUserIDfromUsername('junhoyeo');

// šŸ’” Uses current credentials
await threadsAPI.follow(userIDToFollow);
await threadsAPI.unfollow(userIDToFollow);

ā¤ļøā€šŸ”„ Delete a Post

const postID = await threadsAPI.publish({
  text: 'šŸ¤– This message will self-destruct in 5 seconds.',

await new Promise((resolve) => setTimeout(resolve, 5_000));
await threadsAPI.delete(postID);

Supported features

  • āœ… Read public data
    •  āœ… Fetch UserID(314216) via username(zuck)
    •  āœ… Read User Profile Info
    •  āœ… Read the list of User Threads
    •  āœ… Read the list of User Replies
    •  āœ… Fetch PostID(3140957200974444958) via PostID(CuW6-7KyXme) or PostURL(
    •  āœ… Read Threads via PostID
    •  āœ… Read Likers in Thread via PostID
    •  šŸš§ Read User Followers
    •  šŸš§ Read User Followings
  •  šŸš§ Read private data
  • āœ… Write data (i.e. write automated Threads)
    • āœ… Create a new Thread with text
      •  āœ… Make link previews to get shown
    •  āœ… Create a new Thread with a single image
    •  šŸš§ Create a new Thread with multiple images
    •  āœ… Reply to existing Thread
    •  āœ… Delete Thread
  • āœ… Friendships
    •  āœ… Follow User
    •  āœ… Unfollow User
  • āœ… Interactions
    •  āœ… Like Thread
    •  āœ… Unlike Thread


Checkout the official repo for more options and updates

Also, read How to Send SMS from API or Backend šŸ“²

Ranjith kumar
5 2 votes
Article Rating
Notify of

Inline Feedbacks
View all comments