Introducing the Instagram APIRead more →

X (Twitter) Friendship API. Send a handle or profile link.

Does one account follow another, and back. We handle the proxies, blocks and platform changes.

In your agent: X (Twitter) MCP server →

X (Twitter) Friendship API at a glance

Returns whether one X (formerly Twitter) account follows another, from two usernames, links or user IDs: is_following, is_followed_by (both true when they follow each other), each account's user ID and current username, and whether X lets the first send the second a direct message. Unknown accounts return not_found, naming which one.

GET /v1/x/friendship

Read the API reference
  • 1 credit per request, $0.75–$1.97 per 1,000 requests
  • 5 typed fields null when unknown
  • handle is all it needs, e.g. elonmusk
  • 100 credits free when you sign up, no card, so you can build before you spend

Send one request. Get 5 fields back.

Copy the request in your language, or hand it to your agent. Sign up for an API key and your first 100 credits are free.

$ npm install socialtap
handle = elonmusk
GET /v1/x/friendshipTry in
const params = new URLSearchParams({
  handle: "elonmusk",
  target: "SpaceX",
});
const res = await fetch(`https://socialtap.dev/v1/x/friendship?${params}`, {
  headers: { "x-api-key": process.env.SOCIALTAP_API_KEY ?? "" },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const { data, meta } = body;
console.log(data, meta.credits_charged);
200 OK · GET https://socialtap.dev/v1/x/friendshipDocs

What you send and what comes back.

The response reference lists every field, its type and when it is null. See the full schema.

  • Null means unknown

    A field X doesn't show is null, never zero or an empty string, so a real zero always means zero.

  • What it accepts

    The account whose follow is checked (the source): a username with or without the @ (NASA, @NASA), a numeric user ID (11348282), or a profile link (x.com/NASA, twitter.com/NASA, x.com/i/user/11348282, an intent link with ?screen_name= or ?user_id=).

  • What comes back

    Follow relationship between two accounts: whether the first follows the second, and whether it is followed back.

platformstring
Platform ID (x, …).
sourceobject
The account whose follow is checked (the handle param): is_following says whether it follows target. At least its id or username.
targetobject
The other account (the target param): is_followed_by says whether it follows source. At least its id or username.
is_followingboolean
True when source follows target, false when it does not; null when the platform did not say.
is_followed_byboolean
True when target follows source, false when it does not; null when the platform did not say. Both true: they follow each other.

What teams build with the X (Twitter) Friendship API.

  • Check whether a creator follows your brand back

  • Verify a follow for a giveaway entry

  • Map who follows whom among a set of accounts

  • Resolve two usernames to user IDs in one request

Good to know before you build.

  • source and target in the answer carry each account's ID, username and profile link. Display names, pictures and checks are null: the X Profile API returns them.
  • platform_specific.x.is_messageable is true when the target follows the source or accepts messages from anyone.
  • A suspended account comes back with is_following and is_followed_by false: X doesn't flag the suspension here.
  • The same account as both handle and target returns invalid_input in any two forms, such as a username and its user ID, and costs nothing.

1 credit per request. Failed requests are free.

Buy credits once and spend them on any endpoint, on any platform.

SourcePrice per successful requestPer 1,000 requests
Any source1 credit$0.75–$1.97
  • Cache hits are free.
  • Credits from packs and top-ups never expire.
  • A monthly plan's credits are spent first, and what is left of them ends at each renewal.
  • Prices exclude tax: sales tax is added at checkout where it applies.
  • Outside the US, plans and packs are sold to businesses: checkout asks for your VAT, GST or other business tax ID.

Questions about the X (Twitter) Friendship API.

More in the API reference.

Can I check if two Twitter accounts follow each other?
Yes. One request answers both directions: is_following says whether the first follows the second, is_followed_by whether the second follows back.
Does it work for protected accounts?
Yes. X answers the relationship of a protected account too, though its follower and following lists stay hidden.
Can I use user IDs instead of usernames?
Yes. Send a numeric user ID, a username or a profile link for either account, in any mix.
How much does the X (Twitter) Friendship API cost?
A request costs 1 credit. SocialTap credits cost $0.75–$1.97 per 1,000, depending on the plan or pack.

Try it on an account you know.

Paste its handle or link in the playground, or copy the request into your code.

100free credits
  • No credit card
  • Failed requests are free
  • Works on all 276 endpoints
Start for free Read the docs