---
title: "查询账号"
canonical_url: "https://tweetstream.io/zh-cn/docs/api/lookup-user"
last_updated: 2026-11-05
---

# 查询账号

返回一个账号的资料。

Canonical URL: https://tweetstream.io/zh-cn/docs/api/lookup-user

## `GET /api/user/{id}`

`https://api.tweetstream.io/api/user/{id}`

## 授权

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `Authorization` | `string`, 必填 | 使用 TweetStream API 密钥进行 Bearer 认证：`Bearer <key>`。 |

## 路径参数

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `id` | `string`, 必填 | 数字账号 ID，或带不带 @ 均可的 handle。全部由数字组成的 handle 必须带 @。 |

## 响应字段

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `pinnedTweet` | `object \| null`, 必填 | The account's pinned post, with the same fields as tweet in a post lookup. Filled in only for accounts TweetStream has seen pin a post. Null otherwise, after the account unpins, or when the post can't be shown right now. |
| `user` | `object`, 必填 | The same fields as author in WebSocket post events. |

## 响应

| 状态 | 说明 | 请求头 |
| --- | --- | --- |
| `200` | 成功 |  |
| `400` | 账号 ID 或 handle 无效 |  |
| `401` | API key 缺失或无效 |  |
| `403` | 该 API key 所属账号没有付费或试用中的订阅。 |  |
| `404` | 找不到账号 |  |
| `429` | 已达到速率限制（每个账号每分钟 60 次查询，突发最多 10 次），或该账号已有 4 个查询正在进行 | `Retry-After` |
| `503` | 查询或认证暂时不可用 | `Retry-After` |

### 200

```json
{
  "user": {
    "id": "1189745302",
    "handle": "@marketdesk",
    "name": "Market Desk",
    "platform": "twitter",
    "verifiedType": "blue",
    "followersCount": 48210,
    "followingCount": 312,
    "joinedAt": 1358208000000,
    "profileImage": "https://pbs.twimg.com/profile_images/marketdesk_400x400.jpg"
  },
  "pinnedTweet": {
    "tweetId": "1234567890",
    "text": "Rate decision at 2pm ET.",
    "createdAt": 1744156800000,
    "kind": "post",
    "link": "https://x.com/marketdesk/status/1234567890",
    "author": {
      "id": "1189745302",
      "handle": "@marketdesk",
      "name": "Market Desk",
      "platform": "twitter",
      "verifiedType": "blue",
      "followersCount": 48210,
      "followingCount": 312,
      "joinedAt": 1358208000000,
      "profileImage": "https://pbs.twimg.com/profile_images/marketdesk_400x400.jpg"
    }
  }
}
```

### 400

```json
{
  "error": "<string>"
}
```

### 401

```json
{
  "error": "<string>"
}
```

### 403

```json
{
  "error": "<string>"
}
```

### 404

```json
{
  "error": "<string>"
}
```

### 429

```json
{
  "error": "<string>",
  "retryAfterSeconds": 0
}
```

### 503

```json
{
  "error": "<string>"
}
```

## 代码示例

### cURL

```bash
curl --request GET \
  --url https://api.tweetstream.io/api/user/@marketdesk \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY"
```

### JavaScript

```javascript
const response = await fetch("https://api.tweetstream.io/api/user/@marketdesk", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
  },
});

console.log(response.status, await response.json());
```

### Python

```python
import os
import requests

response = requests.get(
    "https://api.tweetstream.io/api/user/@marketdesk",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}"},
)

print(response.status_code, response.json())
```
