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

# Bookmarks

> Bookmarks エンドポイントを使用すると、認証済みユーザーのブックマークした投稿の表示、追加、削除ができます。ブックマークを扱う X API v2 スタンダードティアのリファレンス。

export const Button = ({href, children}) => {
  return <div className="not-prose">
    <a href={href}>
      <button className="x-btn">
        <span>{children}</span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

Bookmarks エンドポイントを使用すると、認証済みユーザーのブックマークした投稿の表示、追加、削除ができます。ブックマークは非公開で、作成したユーザーにのみ表示されます。

## 概要

<CardGroup cols={2}>
  <Card title="ブックマークを表示" icon="bookmark">
    ブックマークしたすべての投稿を取得
  </Card>

  <Card title="ブックマークを追加" icon="plus">
    投稿をブックマーク
  </Card>

  <Card title="ブックマークを削除" icon="minus">
    ブックマークした投稿を削除
  </Card>

  <Card title="ブックマークフォルダ" icon="folder">
    ブックマークをフォルダに整理
  </Card>
</CardGroup>

***

## エンドポイント

| Method | Endpoint                                                                               | Description    |
| :----- | :------------------------------------------------------------------------------------- | :------------- |
| GET    | [`/2/users/:id/bookmarks`](/x-api/users/get-bookmarks)                                 | ユーザーのブックマークを取得 |
| POST   | [`/2/users/:id/bookmarks`](/x-api/users/create-bookmark)                               | 投稿をブックマーク      |
| DELETE | [`/2/users/:id/bookmarks/:tweet_id`](/x-api/users/delete-bookmark)                     | ブックマークを削除      |
| GET    | [`/2/users/:id/bookmarks/folders`](/x-api/users/get-bookmark-folders)                  | ブックマークフォルダを取得  |
| GET    | [`/2/users/:id/bookmarks/folders/:folder_id`](/x-api/users/get-bookmarks-by-folder-id) | フォルダ内の投稿を取得    |

***

## 例: ブックマークを取得

```bash theme={null}
curl "https://api.x.com/2/users/123456789/bookmarks?\
tweet.fields=created_at,author_id,public_metrics" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"
```

## 例: ブックマークを追加

```bash theme={null}
curl -X POST "https://api.x.com/2/users/123456789/bookmarks" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tweet_id": "1234567890"}'
```

***

## はじめる

<Note>
  **前提条件**

  * 承認済みの[開発者アカウント](https://developer.x.com/en/portal/petition/essential/basic-info)
  * 開発者コンソール内の [Project と App](/resources/fundamentals/developer-apps)
  * [OAuth 2.0 PKCE](/resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2) または [3-legged OAuth](/resources/fundamentals/authentication#obtaining-access-tokens-using-3-legged-oauth-flow) によるユーザーアクセストークン
</Note>

<CardGroup cols={2}>
  <Card title="ルックアップクイックスタート" icon="bookmark" href="/x-api/posts/bookmarks/quickstart/bookmarks-lookup">
    ユーザーのブックマークを取得
  </Card>

  <Card title="管理クイックスタート" icon="plus" href="/x-api/posts/bookmarks/quickstart/manage-bookmarks">
    ブックマークの追加と削除
  </Card>

  <Card title="統合ガイド" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-book.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=22ac564792481d14ae36a941546039c8" href="/x-api/posts/bookmarks/integrate" width="24" height="24" data-path="icons/xds/icon-book.svg">
    主要な概念とベストプラクティス
  </Card>

  <Card title="API リファレンス" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-code.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=488e23401b19225b89acc0136d242219" href="/x-api/users/get-bookmarks" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの完全なドキュメント
  </Card>
</CardGroup>
