Does A Follow B? Checking the Relationship Between Two Accounts You Don't Own

8 min readSocialAPI Engineering

Does A Follow B? Checking the Relationship Between Two Accounts You Don't Own

The obvious way to answer this is the expensive way.

To find out whether one account follows another, most code pages through a follower list looking for a match. ★For an account with a million followers that is thousands of requests to answer a yes/no question★ — and it gets slower as the account grows.

There is a direct way, and the thing most people miss is that ★the answer has two independent halves★.


The relationship is directional

"Do these two accounts follow each other" is really two questions:

A → B ?     does A follow B
B → A ?     does B follow A

Four possible states, and only one of them is "mutuals":

A follows B B follows A Meaning
✅ ✅ ★Mutuals★
✅ ❌ A is a fan
❌ ✅ B is a fan
❌ ❌ No relationship

★Collapsing this into a single boolean is the most common modelling error here★ — and it is the reason "are they connected?" features give confusing answers.

Both directions come back from a single call, which is what makes the check cheap.


The direct check

import requests

BASE = "https://api.socialapi.tech"
KEY  = "your_api_key"
HDRS = {"X-API-Key": KEY}

def relationship(source, target):
    """Both directions between two accounts, neither of which is yours."""
    r = requests.get(f"{BASE}/v1/user/relationship",
                     params={"source": source, "target": target},
                     headers=HDRS, timeout=60)
    r.raise_for_status()
    d = r.json()["data"]
    return {
        "follows":     d["following"],     # source → target
        "followed_by": d["followed_by"],   # target → source
        "mutual":      d["following"] and d["followed_by"],
    }

r = relationship("nasa", "esa")
print(f"nasa → esa: {r['follows']}   esa → nasa: {r['followed_by']}   mutual: {r['mutual']}")

★Neither account has to be yours.★ This is a third-party-to-third-party check — you are reading a public relationship between two accounts you have no connection to.

Worth verifying rather than trusting: we tested this against known-asymmetric pairs, ★because a plausible failure mode is an API silently answering "our account versus target" while ignoring the source parameter★. Running both directions on an asymmetric pair produced strict mirrors, which is what proves source is honoured.

That check is worth doing on any relationship API you use, including ours — a wrong-but-plausible boolean is the kind of bug that survives for months.


When to use this instead of a follower list

★The rule: if you know both accounts, check directly. If you need to discover who they are, page the list.★

Question Approach
Does A follow B? ★One relationship call★
Do these 50 accounts follow B? 50 relationship calls
★Who follows B?★ ★Page the follower list★
Which of B's followers also follow C? Page once, then check

The crossover point is lower than people expect. ★Checking 50 known pairs directly beats paging one large follower list★, because a list of any real size is many pages while each check is one small request.

⚠️ The exception: once you need the identities rather than a yes/no, ★no number of relationship checks substitutes for the list★ — you cannot enumerate by guessing.

Both shapes are one call each — the choice is about which question you are asking.


What this does not tell you

The response carries fields beyond following status, and one of them deserves a warning.

★Block and mute status is not third-party-visible.★ Whether B blocked A is ★not something any API can tell you about two accounts you don't own★ — that boundary is real and universal, and it is the same one that makes "who viewed my profile" impossible.

If you need to know whether someone blocked you, that is a different method entirely — the logged-out comparison.

★Treat this endpoint as answering exactly two questions: does A follow B, and does B follow A.★ Anything more is a boundary nobody crosses.


Questions people ask

How do I check if someone follows someone else? One relationship call with both usernames. ★Neither has to be your account.★

Can I check a relationship between two accounts I don't own? ★Yes.★ Follow relationships between public accounts are public.

Do I need to page the follower list? Not for a yes/no. ★Page the list only when you need to discover identities.★

How do I find mutuals? Both directions true. For a whole set, intersect the two lists instead of checking pairwise.

Is the relationship symmetric? No — that is the whole point. ★A following B says nothing about B following A.★

Why does the direction matter? Because ★"are they connected" collapses four distinct states into one★, and three of them are not what the caller meant.

How do I check many pairs? One call each. ★For a fixed set of pairs this is cheaper than paging any large list.★

When is a follower list better? When you need who, not whether. ★You cannot enumerate identities by checking.★

Can I see if someone blocked me? Not through this. ★Blocks are not third-party visible★ — the actual method.

Can I see if two accounts blocked each other? No. That is not exposed to anyone for accounts you do not own.

Can I see if someone muted someone? No. ★Muting is invisible by design★, in every direction.

Does this work for protected accounts? Public relationships only. ★Protected accounts do not expose theirs.★

How current is the answer? Live at call time. ★A follow that happened a minute ago is reflected.★

Can I track when a follow changes? Only by checking repeatedly and storing results. ★There is no follow-change notification★ — how tracking works.

Can I tell when the follow happened? No. ★Follow relationships carry no timestamp★ — only snapshots you took yourself can date it.

What if a username changed? The check fails or resolves to the wrong account. ★Use IDs for anything stored★ — why.

What if an account is suspended? The relationship cannot resolve. ★Handle the error rather than treating it as "does not follow".★

Is "following" the same as "friends"? No. ★X has no mutual-consent friending★ — following is unilateral.

Does this count as one request? Yes, one small one — which is why it beats paging for targeted checks.

Can I check whether someone follows me? Yes, with your handle as target. ★Though for your own account the follower list gives you everyone at once.★

How do I verify an API respects the source parameter? ★Run an asymmetric pair both ways.★ If the two calls do not mirror, the source parameter is being ignored — a bug worth catching early.

Why would an API ignore the source? Because the underlying platform call is often session-relative. ★A provider that does not handle this returns their relationship, not yours to inspect.★

Can I build a follow graph with this? For a known set of accounts, yes — check every pair. ★For discovery you still need lists.★

How many pairs is too many? Once you are checking most pairs in a large set, paging the lists and intersecting locally becomes cheaper.

Does a repost imply a follow? No. ★Anyone can repost anyone★ — the two are unrelated signals.

Can I see follow relationships historically? Only what you recorded. ★No history is served.★

Is this the same as the followers count? No — the count is an aggregate, this is a specific pair.

Can I detect a soft block? Only by its effect: ★a follow that silently disappears★ — what a soft block is.

Does following affect what I see? Yes, though the timeline mixes in recommendations — how distribution works.

Can I check relationships in bulk in one call? Not in one call — but ★each is small enough that a loop is practical★ for hundreds of pairs.


The short version

★Checking whether A follows B is one small request, and it works for two accounts that have nothing to do with you.★ Paging a follower list to answer the same question is the expensive path most code takes by default.

Model it as two booleans, not one. ★Four states exist, and "mutual" is only one of them.★

Our API returns both directions in a single call, flattened to plain booleans. Read-only, flat price per call — and ★we verified the direction is genuinely third-party-to-third-party by mirror-testing asymmetric pairs★, which is a check worth running against any provider.

What it will not tell you: blocks and mutes between accounts you don't own. ★Those are not gaps — they are the boundary that keeps the platform usable.★

Related reading: reading a full following list · tracking follower changes over time · checking whether someone blocked you · why the numeric ID is the stable key.