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

# Gerenciar Posts na X API v2

> Crie e exclua Posts em nome de usuários autenticados com os endpoints de gerenciamento de Posts do tier standard da X API v2, incluindo detalhes de requisição e resposta.

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

Os endpoints de Gerenciar Posts permitem criar e excluir Posts em nome de usuários autenticados. Crie aplicações que publicam conteúdo, criam threads ou gerenciam Posts do usuário.

## Visão geral

<CardGroup cols={2}>
  <Card title="Criar Post" icon="pen">
    Publique um novo Post
  </Card>

  <Card title="Excluir Post" icon="trash">
    Exclua um Post existente
  </Card>

  <Card title="Reply" icon="reply">
    Responda a outro Post
  </Card>

  <Card title="Quote" icon="quote-right">
    Cite outro Post
  </Card>
</CardGroup>

***

## Endpoints

| Método | Endpoint                                    | Descrição          |
| :----- | :------------------------------------------ | :----------------- |
| POST   | [`/2/tweets`](/x-api/posts/create-post)     | Criar um novo Post |
| DELETE | [`/2/tweets/:id`](/x-api/posts/delete-post) | Excluir um Post    |

***

## Criando Posts

### Post básico

```bash theme={null}
curl -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello from the API!"}'
```

<Note>
  **Clientes self-serve:** Posts criados via API são limitados a no máximo 1 cashtag por post.
</Note>

### Responder a um Post

```bash theme={null}
curl -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "This is a reply!",
    "reply": {
      "in_reply_to_tweet_id": "1234567890"
    }
  }'
```

<Note>
  **Clientes self-serve:** Replies só são permitidas se o autor do post original tiver explicitamente convocado a conta que responde ao fazer @menção ou ao citar um dos posts dela.
</Note>

### Citar um Post

```bash theme={null}
curl -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Check this out!",
    "quote_tweet_id": "1234567890"
  }'
```

### Post com mídia

```bash theme={null}
curl -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Photo of the day",
    "media": {
      "media_ids": ["1234567890123456789"]
    }
  }'
```

<Note>
  Primeiro faça upload da mídia usando o [endpoint de Media Upload](/x-api/media/quickstart/media-upload-chunked) e, em seguida, referencie o `media_id` no seu Post.
</Note>

### Post com poll

```bash theme={null}
curl -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "What is your favorite color?",
    "poll": {
      "options": ["Red", "Blue", "Green", "Yellow"],
      "duration_minutes": 1440
    }
  }'
```

### Post com paid partnership

Use o field `paid_partnership` ao criar um Post para indicar que se trata de uma parceria paga (ou seja, o autor está divulgando que o Post contém promoção paga). Quando definido como `true`, o Post será rotulado como uma promoção paga.

```bash theme={null}
curl -X POST "https://api.x.com/2/tweets" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Excited to partner with Acme on their latest launch!",
    "paid_partnership": true
  }'
```

Para recuperar o valor em Posts existentes (incluindo os seus), solicite-o através do parâmetro `tweet.fields`:

```bash theme={null}
curl "https://api.x.com/2/tweets/1234567890?tweet.fields=paid_partnership,created_at" \
  -H "Authorization: Bearer $TOKEN"
```

***

## Excluindo Posts

```bash theme={null}
curl -X DELETE "https://api.x.com/2/tweets/1234567890" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"
```

<Warning>
  Você só pode excluir Posts criados pelo usuário autenticado.
</Warning>

***

## Introdução

<Note>
  **Pré-requisitos**

  * Uma [conta de desenvolvedor](https://developer.x.com/en/portal/petition/essential/basic-info) aprovada
  * Um [Project e App](/resources/fundamentals/developer-apps) no Developer Console
  * User Access Tokens via [OAuth 2.0 PKCE](/resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2) ou [3-legged OAuth](/resources/fundamentals/authentication#obtaining-access-tokens-using-3-legged-oauth-flow)
</Note>

<CardGroup cols={2}>
  <Card title="Quickstart" 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/posts/manage-tweets/quickstart" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    Crie seu primeiro Post
  </Card>

  <Card title="Guia de integração" 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/posts/manage-tweets/integrate" width="24" height="24" data-path="icons/xds/icon-book.svg">
    Conceitos-chave e melhores práticas
  </Card>

  <Card title="Upload de mídia" icon="https://mintcdn.com/x-preview/oR-aRNyj1BKPJtxM/icons/xds/icon-photo.svg?fit=max&auto=format&n=oR-aRNyj1BKPJtxM&q=85&s=d0986097dcff55478c32801b20440ecc" href="/x-api/media/quickstart/media-upload-chunked" width="24" height="24" data-path="icons/xds/icon-photo.svg">
    Faça upload de mídia para Posts
  </Card>

  <Card title="Referência da 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/posts/creation-of-a-post" width="24" height="24" data-path="icons/xds/icon-code.svg">
    Documentação completa do endpoint
  </Card>
</CardGroup>
