> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sorsa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# X記事

公開X記事の全文とメタデータを1リクエストで取得します。X記事は、カバー画像、リッチテキストの本文（最大約100,000文字）、告知ツイートとは別のエンゲージメント指標を持つ長文投稿です。

> **無料で試す：** `/article`は最初の無料100リクエストで使えます。付与は1回限り、カード不要、有効期限なしです。本文の長さにかかわらず1記事1リクエストで、文字数による追加料金はありません。最大100記事の全文を無料で取得できます。

> **注：** 長文投稿の扱い方は、ブログの[X Articles API：Xの長文投稿を取得する](https://api.sorsa.io/blog/x-articles-api)も参照してください。

***

## クイックスタート

```bash theme={null}
curl -X POST https://api.sorsa.io/v3/article \
  -H "ApiKey: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tweet_link": "https://x.com/SorsaApp/status/1234567890"}'
```

```python theme={null}
import requests

API_KEY = "YOUR_API_KEY"

def get_article(tweet_link):
    resp = requests.post(
        "https://api.sorsa.io/v3/article",
        headers={"ApiKey": API_KEY, "Content-Type": "application/json"},
        json={"tweet_link": tweet_link},
        timeout=30,
    )
    resp.raise_for_status()
    return resp.json()


article = get_article("https://x.com/SorsaApp/status/1234567890")
print(f"Author: @{article['author']['username']}")
print(f"Published: {article['published_at']}")
print(f"Views: {article['views_count']:,}")
print(f"Body length: {len(article['full_text'])} characters")
```

***

## エンドポイント

```text theme={null}
POST /v3/article
```

### リクエスト本文

| パラメーター       | 型      | 必須 | 説明                          |
| :----------- | :----- | :- | :-------------------------- |
| `tweet_link` | string | はい | 告知ツイートの完全なURL、または数値のツイートID。 |

### レスポンス

```json theme={null}
{
  "full_text": "this isn't a cosmetic rebrand. it's a response to how crypto twitter actually works in 2026...",
  "preview_text": "this isn't a cosmetic rebrand. it's a response to how crypto twitter actually works in 2026.\nthe old model was simple...",
  "cover_image_url": "https://pbs.twimg.com/media/G-t2hYTaIAAstc8.jpg",
  "published_at": "2026-01-15T16:24:02Z",
  "views_count": 36538,
  "likes_count": 315,
  "bookmark_count": 38,
  "quote_count": 37,
  "reply_count": 80,
  "retweet_count": 41,
  "author": {
    "id": "1934538036466810880",
    "username": "SorsaApp",
    "display_name": "Sorsa",
    "description": "Crypto social analytics made simple...",
    "followers_count": 6050,
    "verified": false
  }
}
```

### レスポンスのフィールド

| フィールド             | 型                 | 説明                                    |
| :---------------- | :---------------- | :------------------------------------ |
| `full_text`       | string            | 記事の全文。数万文字になる場合があります。                 |
| `preview_text`    | string            | タイムラインで「続きを読む」の前に表示される抜粋。             |
| `cover_image_url` | string \| null    | カバー画像のURL。未設定なら`null`。                |
| `published_at`    | string (ISO 8601) | 記事の公開日時。告知ツイートの`created_at`とは別です。     |
| `likes_count`     | integer           | 「いいね」の数。                              |
| `retweet_count`   | integer           | リツイート数。                               |
| `reply_count`     | integer           | 返信数。                                  |
| `quote_count`     | integer           | 引用ツイート数。                              |
| `bookmark_count`  | integer           | ブックマーク数。                              |
| `views_count`     | integer           | 表示回数の合計。                              |
| `author`          | object            | 投稿者の完全なプロフィール。標準Userオブジェクトと同じフィールドです。 |

> **フィールド名。** `likes_count`、`retweet_count`、`reply_count`、`quote_count`、`bookmark_count`は標準Tweetと同じですが、表示回数は記事では`views_count`、ツイートでは単数形の`view_count`です。同じパイプラインで処理する場合、取り込み時にこのキーを統一してください。比較の詳細は[レスポンス形式](https://docs.sorsa.io/ja/response-format)を参照してください。

***

## 記事と通常のツイートを判別する

種類が分かっている場合は、対応するエンドポイントを直接呼んでください。混在する入力には、以下のヘルパーが`/article`を試し、`404`または空の本文の場合に通常のツイート取得へ切り替えます。`404`はリソースが利用できない場合もあり、切り替え先も失敗することがあります。認証、割り当て量、レート制限、サーバーのエラーは、通常のツイートと見なさず呼び出し元へ伝えます。

```python theme={null}
def get_content(tweet_link):
    """Fetch a tweet or article, returning the appropriate object."""
    try:
        article = get_article(tweet_link)
        if article.get("full_text"):
            return {"type": "article", "data": article}
    except requests.HTTPError as error:
        if error.response is None or error.response.status_code != 404:
            raise

    resp = requests.post(
        "https://api.sorsa.io/v3/tweet-info",
        headers={"ApiKey": API_KEY, "Content-Type": "application/json"},
        json={"tweet_link": tweet_link},
        timeout=30,
    )
    resp.raise_for_status()
    return {"type": "tweet", "data": resp.json()}
```

***

## 次のステップ

* [ツイート検索](https://docs.sorsa.io/ja/search-tweets)：キーワードで記事を探す。
* [ツイートのエンゲージメント](https://docs.sorsa.io/ja/tweet-engagement)：記事のツイートへのコメント、引用、リツイートを取得する。
* [過去のデータ](https://docs.sorsa.io/ja/historical-data)：数か月・数年前の記事を取得する。
* [APIリファレンス](https://docs.sorsa.io/ja/api-reference-guide)：`/article`を含む全エンドポイントの仕様。
