# Relationship between two accounts

`GET https://api.twittrapi.com/user/friendships/show`

Whether one account follows another, and the other way round.

HTML page: https://www.twittrapi.com/docs/reference/user-friendships-show

## Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `source_screen_name` | query | string | yes |  | First handle, with or without @. |
| `target_screen_name` | query | string | yes |  | Second handle, with or without @. |

Every read endpoint also accepts `format=simple` (or the header `X-Response-Format: simple`) for compact, flat JSON with a fixed schema. Same price.

## Response

Raw JSON of X's v1.1 friendships/show endpoint: relationship.source and relationship.target with following and followed_by.

With `format=simple`: {data: {source: {id, username}, target: {id, username}, following, followedBy, canDm, blocking, blockedBy, muting}}. following: source follows target.

## Errors

| Status | When |
| --- | --- |
| 400 | One of the two handles is missing. |
| 422 | One of the two handles is not 2 to 15 letters, digits or underscores. |

Shared errors (401 missing key, 402 no balance, 429 rate limit, 5xx) are listed on https://www.twittrapi.com/docs/helpful-infos/error-handling. Calls that fail with 400, 408, 409 or a 5xx error are refunded.

## Example request

curl:

```bash
curl 'https://api.twittrapi.com/user/friendships/show?source_screen_name=jack&target_screen_name=XDevelopers' \
  --header 'X-API-KEY: YOUR_API_KEY'
```

Python:

```python
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()
```

Node.js:

```js
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",
  },
});
```

RapidAPI:

```bash
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'
```

## Example response

Shortened: arrays keep their first items and long strings are cut.

Raw (default):

```json
{
  "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
    }
  }
}
```

Simple (`format=simple`):

```json
{
  "data": {
    "source": {
      "id": "2244994945",
      "username": "XDevelopers"
    },
    "target": {
      "id": "12",
      "username": "jack"
    },
    "following": true,
    "followedBy": false,
    "canDm": true,
    "blocking": null,
    "blockedBy": null,
    "muting": null
  }
}
```
