Relationship between two accounts
Whether one account follows another, and the other way round.
/user/friendships/showParameters
source_screen_namequery · string · requiredFirst handle, with or without @.
target_screen_namequery · string · requiredSecond handle, with or without @.
Example request
curl 'https://api.twittrapi.com/user/friendships/show?source_screen_name=jack&target_screen_name=XDevelopers' \
--header 'X-API-KEY: YOUR_API_KEY'import httpx
# No SDK method for this endpoint yet, so this is a plain HTTP call.
resp = httpx.get(
"https://api.twittrapi.com/user/friendships/show",
headers={"X-API-KEY": "YOUR_API_KEY"},
params={
"source_screen_name": "jack",
"target_screen_name": "XDevelopers",
},
timeout=60,
)
data = resp.json()import { TwittrAPI } from "twittrapi";
const client = new TwittrAPI({ apiKey: process.env.TWITTRAPI_API_KEY });
// No wrapper method for this endpoint yet; client.get() sends the same authenticated GET.
const data = await client.get({
path: "/user/friendships/show",
query: {
source_screen_name: "jack",
target_screen_name: "XDevelopers",
},
});curl 'https://twitter-aio.p.rapidapi.com/user/friendships/show?source_screen_name=jack&target_screen_name=XDevelopers' \
--header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY' \
--header 'x-rapidapi-host: twitter-aio.p.rapidapi.com'Base URL https://api.twittrapi.com, key in the X-API-KEY header. Python and Node.js use the official SDKs.
Response
Raw JSON of X's v1.1 friendships/show endpoint: relationship.source and relationship.target with following and followed_by.
Simple format (?format=simple or X-Response-Format: simple): {data: {source: {id, username}, target: {id, username}, following, followedBy, canDm, blocking, blockedBy, muting}}. following: source follows target. Schema.
{
"relationship": {
"source": {
"id": 2244994945,
"id_str": "2244994945",
"screen_name": "XDevelopers",
"following": true,
"followed_by": false,
"live_following": false,
"following_received": null,
"following_requested": null,
"notifications_enabled": null,
"can_dm": true,
"can_media_tag": null,
"blocking": null,
"blocked_by": null,
"muting": null,
"want_retweets": null,
"all_replies": null,
"marked_spam": null
},
"target": {
"id": 12,
"id_str": "12",
"screen_name": "jack",
"following": false,
"followed_by": true,
"following_received": null,
"following_requested": null
}
}
}{
"data": {
"source": {
"id": "2244994945",
"username": "XDevelopers"
},
"target": {
"id": "12",
"username": "jack"
},
"following": true,
"followedBy": false,
"canDm": true,
"blocking": null,
"blockedBy": null,
"muting": null
}
}In the raw format, field names and nesting come from X and can change without notice. See Response format; the simple format keeps a fixed schema.
Errors
- 400One of the two handles is missing.
- 422One of the two handles is not 2 to 15 letters, digits or underscores.
Errors every endpoint can return (401, 402, 403, 404, 408, 409, 429, 5xx), and which of them are charged, are on the Errors page. Calls that fail with 400, 408, 409 or a 5xx error are refunded.