Tutorial

Threads API Tutorial: Profiles, Posts & Search

Step-by-step Threads API tutorial: fetch public profiles, self-threads, user replies, post threads and search results in Python and Node.js.

Updated 3 December 2026 · 6 min read

If you are building brand monitoring, creator research or social analytics for Meta’s Threads, you usually need five things: profile headers, a creator’s published threads and self-threads, their public replies with parent context, full post conversations and keyword search. This tutorial walks through every Threads API endpoint with working cURL, Python and Node.js examples using a single API key.

Before you start

  • An IGramAPI key. The free plan gives you 100 credits every month with no card, and every Threads endpoint works on it.
  • Both threads.com and threads.net URLs (as well as plain @handles) work across the link and profile endpoints.

Store your key in an environment variable:

export IGRAMAPI_KEY="igk_your_key_here"

1. Fetch a public Threads profile

Call the Threads Profile API with a username (with or without @) or pass ?url= to /v1/threads/profiles:

curl "https://api.igramapi.com/v1/threads/profiles/example_creator" \
  -H "Authorization: Bearer $IGRAMAPI_KEY"

The profile object returns user_id, lowercase username, full_name, biography, extracted bio_mentions, bio_links, pinned profile_tags, integer followers, is_verified, is_private and the largest profile_picture_url.

{
  "profile": {
    "user_id": "63456789012",
    "username": "example_creator",
    "full_name": "Example Creator",
    "followers": 284500,
    "is_verified": true,
    "is_private": false,
    "bio_links": [{ "url": "https://example.com", "title": "Website", "is_verified": true }]
  },
  "cached": false
}

2. Read published threads and self-threads

A single post on Threads is often part of a numbered multi-post thread written by the same author. The Threads Profile Posts API returns each entry as { id, post, thread } so follow-up posts remain grouped under the opening post.

Python

import os
import requests

BASE = "https://api.igramapi.com"
HEADERS = {"Authorization": f"Bearer {os.environ['IGRAMAPI_KEY']}"}

def get_threads(username, pages=2):
    cursor, rows = None, []
    for _ in range(pages):
        params = {"limit": 10}
        if cursor:
            params["cursor"] = cursor
        r = requests.get(
            f"{BASE}/v1/threads/profiles/{username}/threads",
            headers=HEADERS,
            params=params,
            timeout=30,
        )
        r.raise_for_status()
        data = r.json()
        rows.extend(data["items"])
        if not data["page"]["has_next_page"]:
            break
        cursor = data["page"]["end_cursor"]
    return rows

for item in get_threads("example_creator"):
    root = item["post"]
    print(root["shortcode"], root["like_count"], f"+{len(item['thread'])} in self-thread")

Always cap your pagination loop (for example with pages=2) so long timelines do not spend more credits than planned.

3. Read a profile’s Replies tab with parent context

An isolated reply is hard to interpret without knowing what post prompted it. The Threads Profile Replies API returns each item with parent_posts (the message or ancestor chain being answered), post (the profile owner’s reply) and thread (immediate follow-ups).

curl "https://api.igramapi.com/v1/threads/profiles/example_creator/replies?limit=10" \
  -H "Authorization: Bearer $IGRAMAPI_KEY"

This keeps sentiment analysis and outreach tracking accurate without extra lookups for parent posts.

4. Fetch a single post, parent chain and replies

When a user pastes a Threads link (threads.com, threads.net or /t/{shortcode}), send it to the Threads Post API:

Node.js

const BASE = "https://api.igramapi.com";
const headers = { Authorization: `Bearer ${process.env.IGRAMAPI_KEY}` };

const url = new URL(`${BASE}/v1/threads/posts`);
url.searchParams.set("url", "https://www.threads.com/@example_creator/post/DCxAbCdEfGh");

const response = await fetch(url, { headers });
if (!response.ok) throw new Error((await response.json()).error.message);

const data = await response.json();
console.log("Target post:", data.post.text);
console.log("Parent posts above it:", data.parent_chain.length);
console.log("Direct replies:", data.replies.length);

In one 1-credit call you receive:

  • post: full text, mentions, embedded links, topic tags, media URLs, video formats, voice note audio, link previews, quoted/reposted posts and public counters.
  • parent_chain: parent/root posts above the target when resolving a mid-thread reply link.
  • replies: direct reply branches with unrelated “More threads” suggestions filtered out.

5. Search Threads posts and creators by keyword

The Threads Search API supports three modes (type=top, type=recent and type=profiles) for 2 credits per request:

curl "https://api.igramapi.com/v1/threads/search?q=developer+tools&type=recent" \
  -H "Authorization: Bearer $IGRAMAPI_KEY"
type profiles[] posts[] Best for
top Matching accounts Ranked posts Overview of a topic or creator space
recent Empty or subset Latest posts Chronological brand & launch monitoring
profiles Matching accounts Empty Creator discovery and handle matching

Handling errors and credits

Every response includes X-Credits-Charged, X-Credits-Remaining and X-RateLimit-Remaining. Missing targets return HTTP 404 (profile_not_found or post_not_found), while private Threads accounts return HTTP 403 (private_account). Errors on our side (HTTP 5xx) and invalid requests (400, 422) are refunded automatically — see the error handling reference for details.

Get your free API key

100 credits every month, no credit card.