> ## 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.

# ダイレクトメッセージのルックアップ

> Direct Messages lookup エンドポイントを使用すると、認証済みユーザーの DM イベントを取得できます。lookup をカバーする X API v2 standard tier のリファレンスです。

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>;
};

Direct Messages lookup エンドポイントを使用すると、認証済みユーザーの DM イベント（1 対 1 およびグループの両方の会話のメッセージを含む）を取得できます。

## 概要

<CardGroup cols={2}>
  <Card title="すべての DM イベント" icon="messages">
    ユーザーのすべての DM イベントを取得
  </Card>

  <Card title="1 対 1" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-chat.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=9fde7d51b4f18c96d3a38a81d519761f" width="24" height="24" data-path="icons/xds/icon-chat.svg">
    特定の会話からイベントを取得
  </Card>

  <Card title="会話 ID で取得" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-chat-unread.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=ce6313d8c0b7b4e5363f2ce80b89f7e4" width="24" height="24" data-path="icons/xds/icon-chat-unread.svg">
    会話 ID からイベントを取得
  </Card>

  <Card title="イベントタイプ" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-bell.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=5e0b3dcfbb39ba3d4619931d7cd927d1" width="24" height="24" data-path="icons/xds/icon-bell.svg">
    メッセージ、参加、退出
  </Card>
</CardGroup>

***

## エンドポイント

| Method | Endpoint                                                                                                            | Description          |
| :----- | :------------------------------------------------------------------------------------------------------------------ | :------------------- |
| GET    | [`/2/dm_events`](/x-api/direct-messages/get-dm-events)                                                              | ユーザーのすべての DM イベントを取得 |
| GET    | [`/2/dm_conversations/with/:participant_id/dm_events`](/x-api/direct-messages/get-dm-events-for-a-dm-conversation)  | 1 対 1 の会話からイベントを取得   |
| GET    | [`/2/dm_conversations/:dm_conversation_id/dm_events`](/x-api/direct-messages/get-dm-events-for-a-dm-conversation-1) | 会話 ID でイベントを取得       |

***

## イベントタイプ

| Event               | Description    |
| :------------------ | :------------- |
| `MessageCreate`     | 会話でメッセージが送信された |
| `ParticipantsJoin`  | ユーザーが会話に参加した   |
| `ParticipantsLeave` | ユーザーが会話から退出した  |

***

## データ保持期間

<Note>
  これらのエンドポイントでは、**過去 30 日** までのイベントを取得できます。
</Note>

***

## はじめに

<Note>
  **前提条件**

  * 承認済みの [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * Developer Console 内の [Project と App](/resources/fundamentals/developer-apps)
  * [3-legged OAuth](/resources/fundamentals/authentication#obtaining-access-tokens-using-3-legged-oauth-flow) で取得した User Access Token
</Note>

<CardGroup cols={2}>
  <Card title="クイックスタート" icon="https://mintcdn.com/x-preview/oR-aRNyj1BKPJtxM/icons/xds/icon-rocket.svg?fit=max&auto=format&n=oR-aRNyj1BKPJtxM&q=85&s=b978d7a9225de31709efbbed5b84e92d" href="/x-api/direct-messages/lookup/quickstart" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    最初の DM lookup リクエストを実行
  </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/direct-messages/lookup/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/direct-messages/get-dm-events" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの完全なドキュメント
  </Card>

  <Card title="サンプルコード" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    動作するコード例
  </Card>
</CardGroup>
