Users
Check Relationship
Check if one Twitter user follows another via API. $0.001 per call. GetXAPI follow relationship check endpoint documentation.
GET
/twitter/user/check_follow_relationshipThis endpoint costs $0.001 per API call.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
source_user_name | string | Yes | Source user screen name (without @) |
target_user_name | string | Yes | Target user screen name (without @) |
auth_token | string | No | auth_token of the source account. Required to read blocking/blockedBy/muting — without it they return null (see Notes). |
ct0 | string | No | Current CSRF token cookie for the source account. Send with twid to skip credential bootstrap. |
twid | string | No | Current user ID cookie for the source account, e.g. u=1234567890. Send with ct0. |
proxy | string | No | Proxy URL — http://, https://, socks5://, or socks4://. |
Notes
sourceFollowsTargetandtargetFollowsSourceare public and always accurate.blocking,blockedByandmutingare private to the source account. X only returns them when the request is authenticated as the source account. Withoutauth_tokenthe lookup runs through a shared account and these come backnull(unknown) — do not readnullas "not blocking".- To read block/mute status reliably, pass
auth_token(and ideallyct0+twid) of the account named insource_user_name.
Response
Without auth_token — private fields are null and a note explains why:
{
"status": "success",
"msg": "success",
"data": {
"sourceUserName": "example_user",
"targetUserName": "target_user",
"sourceFollowsTarget": true,
"targetFollowsSource": false,
"canDm": false,
"blocking": null,
"blockedBy": null,
"muting": null,
"note": "blocking, blocked_by and muting are private to the source account and unavailable via a shared lookup. To read them, pass auth_token of the source_user_name account."
}
}With auth_token of the source account — private fields are accurate:
{
"status": "success",
"msg": "success",
"data": {
"sourceUserName": "example_user",
"targetUserName": "target_user",
"sourceFollowsTarget": false,
"targetFollowsSource": false,
"canDm": false,
"blocking": true,
"blockedBy": false,
"muting": false
}
}Response Fields
| Field | Type | Description |
|---|---|---|
sourceUserName | string | @handle of source user |
targetUserName | string | @handle of target user |
sourceFollowsTarget | boolean | True if source follows target (public) |
targetFollowsSource | boolean | True if target follows source (public) |
canDm | boolean | True if source can DM target |
blocking | boolean | null | True if source is blocking target; null if unknown (no source auth_token) |
blockedBy | boolean | null | True if source is blocked by target; null if unknown |
muting | boolean | null | True if source is muting target; null if unknown |
note | string | Present only when the private fields are null; explains how to get them |
Example
Public relationship only:
curl -H "Authorization: Bearer API_KEY" "https://api.getxapi.com/twitter/user/check_follow_relationship?source_user_name=example_user&target_user_name=target_user"Accurate block/mute (authenticated as the source account):
curl -H "Authorization: Bearer API_KEY" "https://api.getxapi.com/twitter/user/check_follow_relationship?source_user_name=example_user&target_user_name=target_user&auth_token=SOURCE_AUTH_TOKEN"