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

# Manage Retweets

> If you have been working with the standard v1.1 POST statuses/retweet/:id, and POST. Reference for the Enterprise X API tier covering migrate.

### Manage Retweets: Standard v1.1 compared to X API v2

If you have been working with the standard v1.1 [POST statuses/retweet/:id](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-retweet-id), and [POST statuses/unretweet/:id](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id)  endpoints, the goal of this guide is to help you understand the similarities and differences between the standard and X API v2 Retweets endpoints.

* **Similarities**
  * Authentication
* **Differences**
  * Endpoint URLs and HTTP methods
  * Request limitations
  * App and Project requirements
  * Request parameters

#### Similarities

**Authentication**

Both the standard v1.1 and X API v2 manage Retweets ([POST statuses/retweet/:id](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-retweet-id), and [POST statuses/unretweet/:id](https://developer.x.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id)) endpoints use [OAuth 1.0a User Context](https://developer.x.com/content/developer-twitter/resources/fundamentals/authentication). Therefore, if you were previously using one of the standard v1.1 Retweets lookup endpoints, you can continue using the same authentication method if you migrate to the X API v2 version. 

#### Differences

**Endpoint URLs and HTTP methods**

* Standard v1.1 endpoints:
  * [https://api.x.com/1.1/statuses/retweet/:id.json](https://api.x.com/1.1/statuses/retweet/:id.json)
    (Retweets a Post. Returns the original Post with Retweet details embedded)
  * [https://api.x.com/1.1/statuses/unretweet/:id.json](https://api.x.com/1.1/statuses/unretweet/:id.json)
    (Undo a Retweet. Returns the original Post with Retweet details embedded)
* X API v2 endpoint:
  * [https://api.x.com/2/tweets/:id/retweets](https://api.x.com/2/tweets/:id/retweets)
    (Retweets a given Post)
  * [https://api.x.com/2/users/:id/retweets/:source\\\_tweet\\\_id](https://api.x.com/2/users/:id/retweets/:source\\_tweet\\_id)
    (Undo a Retweet of a given Post) 

**App and Project requirements**

The X API v2 endpoints require that you use credentials from a [developer App](/resources/fundamentals/developer-apps) that is associated to a [Project](/resources/fundamentals/developer-apps) when authenticating your requests. All X API v1.1 endpoints can use credentials from Apps or Apps associated with an App.

**Request parameters**

The following standard v1.1 request parameters accepted two request query parameters (user\_id or screen\_name). The X API v2 only accepts the numerical user ID, and it must be passed as part of the endpoint path.

| Standard v1.1          | X API v2      |
| :--------------------- | :------------ |
| **id**                 | **id**        |
| **includes\_entities** | No equivalent |

Please note that the Standard v1.1 parameters are passed as query parameters, whereas the X API v2 parameters are passed as body parameters for the POST endpoint or path parameters for the DELETE endpoint.

Also, an id of the user Retweeting a Post is not required when using the standard v1.1 endpoints since the [Access Tokens](/resources/fundamentals/authentication#obtaining-access-tokens-using-3-legged-oauth-flow) passed with [OAuth 1.0a User Context](/resources/fundamentals/authentication) infer which user is initiating the Retweet/undoing a Retweet.

***

## Code examples

### Retweet a Post (v2)

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X POST "https://api.x.com/2/users/123456789/retweets" \
    -H "Authorization: OAuth ..." \
    -H "Content-Type: application/json" \
    -d '{"tweet_id": "1234567890"}'
  ```

  ```python Python theme={null}
  # Requires OAuth 1.0a User Context authentication
  import requests
  from requests_oauthlib import OAuth1

  auth = OAuth1(
      "API_KEY", "API_SECRET",
      "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET"
  )

  url = "https://api.x.com/2/users/123456789/retweets"
  response = requests.post(url, auth=auth, json={"tweet_id": "1234567890"})
  print(response.json())
  ```

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

  oauth1 = OAuth1(
      api_key="YOUR_API_KEY",
      api_secret="YOUR_API_SECRET",
      access_token="YOUR_ACCESS_TOKEN",
      access_token_secret="YOUR_ACCESS_TOKEN_SECRET"
  )

  client = Client(auth=oauth1)

  # Retweet a Post
  response = client.posts.retweet(user_id="123456789", tweet_id="1234567890")
  print(f"Retweeted: {response.data.retweeted}")
  ```

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

  const oauth1 = new OAuth1({
    apiKey: "YOUR_API_KEY",
    apiSecret: "YOUR_API_SECRET",
    accessToken: "YOUR_ACCESS_TOKEN",
    accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET",
  });

  const client = new Client({ oauth1 });

  // Retweet a Post
  const response = await client.posts.retweet("123456789", { tweetId: "1234567890" });
  console.log(`Retweeted: ${response.data?.retweeted}`);
  ```
</CodeGroup>

### Undo a Retweet (v2)

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.x.com/2/users/123456789/retweets/1234567890" \
    -H "Authorization: OAuth ..."
  ```

  ```python Python theme={null}
  # Requires OAuth 1.0a User Context authentication
  import requests
  from requests_oauthlib import OAuth1

  auth = OAuth1(
      "API_KEY", "API_SECRET",
      "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET"
  )

  url = "https://api.x.com/2/users/123456789/retweets/1234567890"
  response = requests.delete(url, auth=auth)
  print(response.json())
  ```

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

  oauth1 = OAuth1(
      api_key="YOUR_API_KEY",
      api_secret="YOUR_API_SECRET",
      access_token="YOUR_ACCESS_TOKEN",
      access_token_secret="YOUR_ACCESS_TOKEN_SECRET"
  )

  client = Client(auth=oauth1)

  # Undo a Retweet
  response = client.posts.unretweet(user_id="123456789", tweet_id="1234567890")
  print(f"Retweeted: {response.data.retweeted}")
  ```

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

  const oauth1 = new OAuth1({
    apiKey: "YOUR_API_KEY",
    apiSecret: "YOUR_API_SECRET",
    accessToken: "YOUR_ACCESS_TOKEN",
    accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET",
  });

  const client = new Client({ oauth1 });

  // Undo a Retweet
  const response = await client.posts.unretweet("123456789", "1234567890");
  console.log(`Retweeted: ${response.data?.retweeted}`);
  ```
</CodeGroup>
