# X (Twitter) API

> Returns the text, author, counters and media of a public tweet, and the latest tweets of an account.

Category: Social & Video. Region: global. 3 endpoints at `https://api.hoshime.com/v1/twitter/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/twitter
## GET /v1/twitter/tweet

Text, author, counters and media of one public tweet.

Scope: `social:read` · Units: 1 · Cached: 5 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Tweet id, or an x.com or twitter.com status URL. (e.g. 20) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatar` (string), `author.id` (string), `author.name` (string), `author.username` (string), `author.verified` (boolean), `createdAt` (string), `id` (string), `lang` (string), `likeCount` (integer (int64)), `media` (Media[]), `media[].height` (any), `media[].type` (string), `media[].url` (string), `media[].video` (string), `media[].width` (any), `possiblySensitive` (boolean), `replyCount` (integer (int64)), `text` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/twitter/tweet?id=20" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twitter/profileTimeline

The latest tweets of one account, about 20, newest first. X gives no cursor for older ones.

Scope: `social:read` · Units: 1 · Cached: 15 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `username` | string | yes | Screen name, with or without @, or profile URL. (e.g. X) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `author` (Author), `author.avatar` (string), `author.id` (string), `author.name` (string), `author.username` (string), `author.verified` (boolean), `createdAt` (string), `id` (string), `lang` (string), `likeCount` (integer (int64)), `media` (Media[]), `media[].height` (any), `media[].type` (string), `media[].url` (string), `media[].video` (string), `media[].width` (any), `possiblySensitive` (boolean), `replyCount` (integer (int64)), `text` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/twitter/profileTimeline?username=X" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/twitter/profile

One X account's profile: name, bio, location, verified status, and follower, following and post counts.

Scope: `social:read` · Units: 1 · Cached: 60 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `username` | string | yes | Screen name, with or without @, or profile URL. (e.g. NASA) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `avatarUrl` (string), `bio` (string), `createdAt` (string), `followerCount` (integer (int64)), `followingCount` (integer (int64)), `id` (string), `name` (string), `postCount` (integer (int64)), `url` (string), `username` (string), `verified` (boolean)

```bash
curl "https://api.hoshime.com/v1/twitter/profile?username=NASA" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
