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

# Quickstart

> This guide walks you through making your first Post lookup request using the X API v2. Reference for the X API v2 standard tier covering lookup.

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <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>;
};

This guide walks you through making your first Post lookup request using the X API v2.

<Note>
  **Prerequisites**

  Before you begin, you'll need:

  * A [developer account](https://developer.x.com/en/portal/petition/essential/basic-info) with an approved App
  * Your App's Bearer Token (found in the Developer Console under "Keys and tokens")
</Note>

***

<Steps>
  <Step title="Find a Post ID">
    Every Post has a unique ID. You can find it in the Post's URL:

    ```
    https://x.com/XDevelopers/status/1228393702244134912
                                    └── This is the Post ID
    ```
  </Step>

  <Step title="Make a request">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/tweets/1228393702244134912" \
        -H "Authorization: Bearer $BEARER_TOKEN"
      ```

      ```python Python SDK theme={null}
      from xdk import Client

      client = Client(bearer_token="YOUR_BEARER_TOKEN")

      # Get a single Post by ID
      response = client.posts.get("1228393702244134912")
      print(response.data)
      ```

      ```javascript JavaScript SDK theme={null}
      import { Client } from "@xdevplatform/xdk";

      const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

      const response = await client.posts.get("1228393702244134912");
      console.log(response.data);
      ```
    </CodeGroup>
  </Step>

  <Step title="Review the response">
    The default response includes the Post's `id`, `text`, and `edit_history_tweet_ids`:

    ```json theme={null}
    {
      "data": {
        "id": "1228393702244134912",
        "text": "What did the developer write in their Valentine's card?\n\nwhile(true) {\n    I = Love(You);\n}",
        "edit_history_tweet_ids": ["1228393702244134912"]
      }
    }
    ```
  </Step>

  <Step title="Request additional fields">
    Use query parameters to get more data:

    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/tweets/1228393702244134912?\
      tweet.fields=created_at,public_metrics,author_id&\
      expansions=author_id&\
      user.fields=username,verified" \
        -H "Authorization: Bearer $BEARER_TOKEN"
      ```

      ```python Python SDK theme={null}
      from xdk import Client

      client = Client(bearer_token="YOUR_BEARER_TOKEN")

      # Get a Post with additional fields and expansions
      response = client.posts.get(
          "1228393702244134912",
          tweet_fields=["created_at", "public_metrics", "author_id"],
          expansions=["author_id"],
          user_fields=["username", "verified"]
      )

      print(response.data)
      print(response.includes)  # Contains author user object
      ```

      ```javascript JavaScript SDK theme={null}
      import { Client } from "@xdevplatform/xdk";

      const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

      const response = await client.posts.get("1228393702244134912", {
        tweetFields: ["created_at", "public_metrics", "author_id"],
        expansions: ["author_id"],
        userFields: ["username", "verified"],
      });

      console.log(response.data);
      console.log(response.includes); // Contains author user object
      ```
    </CodeGroup>

    **Response:**

    ```json theme={null}
    {
      "data": {
        "id": "1228393702244134912",
        "text": "What did the developer write in their Valentine's card?...",
        "created_at": "2020-02-14T19:00:55.000Z",
        "author_id": "2244994945",
        "public_metrics": {
          "retweet_count": 156,
          "reply_count": 23,
          "like_count": 892,
          "quote_count": 12
        },
        "edit_history_tweet_ids": ["1228393702244134912"]
      },
      "includes": {
        "users": [
          {
            "id": "2244994945",
            "username": "XDevelopers",
            "verified": true
          }
        ]
      }
    }
    ```
  </Step>

  <Step title="Look up multiple Posts">
    Retrieve up to 100 Posts in a single request:

    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl "https://api.x.com/2/tweets?\
      ids=1228393702244134912,1227640996038684673,1199786642791452673&\
      tweet.fields=created_at,author_id" \
        -H "Authorization: Bearer $BEARER_TOKEN"
      ```

      ```python Python SDK theme={null}
      from xdk import Client

      client = Client(bearer_token="YOUR_BEARER_TOKEN")

      # Get multiple Posts by IDs
      response = client.posts.get_posts(
          ids=["1228393702244134912", "1227640996038684673", "1199786642791452673"],
          tweet_fields=["created_at", "author_id"]
      )

      for post in response.data:
          print(f"{post.id}: {post.text[:50]}...")
      ```

      ```javascript JavaScript SDK theme={null}
      import { Client } from "@xdevplatform/xdk";

      const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

      const response = await client.posts.getPosts({
        ids: ["1228393702244134912", "1227640996038684673", "1199786642791452673"],
        tweetFields: ["created_at", "author_id"],
      });

      response.data?.forEach((post) => {
        console.log(`${post.id}: ${post.text?.slice(0, 50)}...`);
      });
      ```
    </CodeGroup>
  </Step>
</Steps>

***

## Next steps

<CardGroup cols={2}>
  <Card title="Integration guide" icon="book" href="/x-api/posts/lookup/integrate">
    Learn authentication, rate limits, and best practices
  </Card>

  <Card title="Fields and expansions" icon="sliders" href="/x-api/fundamentals/fields">
    Master the fields and expansions system
  </Card>

  <Card title="API Reference" icon="code" href="/x-api/posts/get-post-by-id">
    See all available parameters
  </Card>

  <Card title="Sample code" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    Explore more examples
  </Card>
</CardGroup>
