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

# Guia de migração

> O endpoint hide replies da v2 está substituindo o endpoint hide replies do Labs. Referência para o tier standard da X API v2 sobre hide replies.

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

## Comparando os endpoints hide replies da X API

O endpoint hide replies da v2 está substituindo o endpoint hide replies do Labs. Se você tem código, apps ou ferramentas que usam a versão Labs deste endpoint, e está considerando migrar para o endpoint mais recente da X API v2, este guia é para você.

Para usar a nova X API v2 (incluindo o endpoint hide replies), você precisará [optar pelo novo Developer Console](https://developer.x.com/en/portal/opt-in), criar um [Project](/resources/fundamentals/developer-apps) e adicionar um App a esse Project. Você poderá então usar as credenciais associadas a esse App para fazer requisições ao endpoint hide replies. Adicionar o mesmo App que está registrado para o endpoint hide replies do Labs v2 manterá seus usuários autenticados.

A tabela a seguir compara as diferenças entre o Labs e o endpoint mais recente da X API v2:

| **Descrição**                                                                                                                                                     | **Labs v2**                                                                         | **X API v2**                                              |
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------- | :-------------------------------------------------------- |
| Domínio do host                                                                                                                                                   | [https://api.x.com](https://api.x.com)                                              | [https://api.x.com](https://api.x.com)                    |
| Caminho do endpoint                                                                                                                                               | /labs/2/tweets/:id/hidden                                                           | /2/tweets/:id/hidden                                      |
| Autenticação                                                                                                                                                      | OAuth 1.0a User context                                                             | OAuth 1.0a User context                                   |
| Métodos HTTP suportados                                                                                                                                           | PUT                                                                                 | PUT                                                       |
| Rate limits padrão de requisição                                                                                                                                  | 10 requisições por 15 minutos (compartilhadas entre todos os usuários autenticados) | 50 requisições por 15 min (para cada usuário autenticado) |
| Pode ocultar replies                                                                                                                                              | ✔︎                                                                                  | ✔︎                                                        |
| Pode reexibir uma reply previamente oculta                                                                                                                        | ✔︎                                                                                  | ✔︎                                                        |
| Pode ocultar ou reexibir replies várias vezes                                                                                                                     | ✔︎                                                                                  | ✔︎                                                        |
| Requer o uso de credenciais de um [App de desenvolvedor](/resources/fundamentals/developer-apps) associado a um [project](/resources/fundamentals/developer-apps) |                                                                                     | ✔                                                         |

***

## Exemplos de código

### Ocultar uma reply (v2)

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X PUT "https://api.x.com/2/tweets/1234567890/hidden" \
    -H "Authorization: OAuth ..." \
    -H "Content-Type: application/json" \
    -d '{"hidden": true}'
  ```

  ```python title="Python" lines wrap icon="python" theme={null}
  # Requer autenticação OAuth 1.0a User Context
  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())
  ```

  ```python title="Python SDK" lines wrap icon="python" 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)

  # Ocultar uma reply
  response = client.posts.hide_reply("1234567890", hidden=True)
  print(f"Hidden: {response.data.hidden}")
  ```

  ```javascript title="JavaScript SDK" lines wrap icon="square-js" 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 });

  // Ocultar uma reply
  const response = await client.posts.hideReply("1234567890", { hidden: true });
  console.log(`Hidden: ${response.data?.hidden}`);
  ```
</CodeGroup>

**Outros recursos de migração**

[Hub de migração da X API](/x-api/migrate/overview)
