| title | Migration guide | |||||
|---|---|---|---|---|---|---|
| sidebarTitle | Migration guide | |||||
| keywords |
|
|||||
| description | The v2 hide replies endpoint is replacing the Labs hide replies endpoint. Reference for the X API v2 standard tier covering hide replies. |
import { Button } from '/snippets/button.mdx';
The v2 hide replies endpoint is replacing the Labs hide replies endpoint. If you have code, apps, or tools that use the Labs version of this endpoint, and are considering migrating to the newer X API v2 endpoint, then this guide is for you.
In order to use the new X API v2 (including the hide replies endpoint), you will need to opt in to the new Developer Console, create a Project, and add an App to that Project. You can then use the credentials associated with that App to make requests to the hide replies endpoint. Adding the same App that's enrolled for the Labs v2 hide replies endpoint will keep your users authenticated.
The following table compares the differences between Labs and the newer X API v2 endpoint:
| Description | Labs v2 | X API v2 |
|---|---|---|
| Host domain | https://api.x.com | https://api.x.com |
| Endpoint path | /labs/2/tweets/:id/hidden | /2/tweets/:id/hidden |
| Authentication | OAuth 1.0a User context | OAuth 1.0a User context |
| HTTP methods supported | PUT | PUT |
| Default request rate limits | 10 requests per 15 minutes (shared across all authenticated users) | 50 requests per 15 min (for each authenticated user) |
| Can hide replies | ✔︎ | ✔︎ |
| Can unhide a previously hidden reply | ✔︎ | ✔︎ |
| Can hide or unhide replies multiple times | ✔︎ | ✔︎ |
| Requires the use of credentials from a developer App associated with a project | ✔ |
curl -X PUT "https://api.x.com/2/tweets/1234567890/hidden" \
-H "Authorization: OAuth ..." \
-H "Content-Type: application/json" \
-d '{"hidden": true}'# 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/tweets/1234567890/hidden"
response = requests.put(url, auth=auth, json={"hidden": True})
print(response.json())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)
# Hide a reply
response = client.posts.hide_reply("1234567890", hidden=True)
print(f"Hidden: {response.data.hidden}")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 });
// Hide a reply
const response = await client.posts.hideReply("1234567890", { hidden: true });
console.log(`Hidden: ${response.data?.hidden}`);Other migration resources