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

# Administrar Posts en la X API v2

> Crea y elimina Posts en nombre de usuarios autenticados con los endpoints del nivel estándar de X API v2 para administrar Posts, incluidos los detalles de solicitud y respuesta.

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

Los endpoints de Manage Posts te permiten crear y eliminar Posts en nombre de usuarios autenticados. Crea aplicaciones que publiquen contenido, creen hilos o administren los Posts de los usuarios.

## Descripción general

<CardGroup cols={2}>
  <Card title="Crear Post" icon="pen">
    Publica un nuevo Post
  </Card>

  <Card title="Eliminar Post" icon="trash">
    Elimina un Post existente
  </Card>

  <Card title="Responder" icon="reply">
    Responde a otro Post
  </Card>

  <Card title="Citar" icon="quote-right">
    Cita otro Post
  </Card>
</CardGroup>

***

## Endpoints

| Method | Endpoint                                    | Description        |
| :----- | :------------------------------------------ | :----------------- |
| POST   | [`/2/tweets`](/x-api/posts/create-post)     | Crea un nuevo Post |
| DELETE | [`/2/tweets/:id`](/x-api/posts/delete-post) | Elimina un Post    |

***

## Crear 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:** Los Posts creados a través de la API están limitados a un máximo de 1 cashtag por post.
</Note>

### Responder a un 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:** Las respuestas solo se permiten si el autor del Post original ha invocado explícitamente a la cuenta que responde @mencionándola o citando uno de sus posts.
</Note>

### Citar un 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 con media

```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>
  Sube el media primero usando el [endpoint de Media Upload](/x-api/media/quickstart/media-upload-chunked), luego haz referencia al `media_id` en tu Post.
</Note>

### Post con encuesta

```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 con paid partnership

Usa el campo `paid_partnership` al crear un Post para indicar que se trata de una asociación pagada (es decir, el autor está declarando que el Post contiene una promoción pagada). Cuando se establece en `true`, el Post será etiquetado como una promoción pagada.

```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 obtener el valor en Posts existentes (incluidos los tuyos), solicítalo mediante el 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"
```

***

## Eliminar Posts

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

<Warning>
  Solo puedes eliminar Posts creados por el usuario autenticado.
</Warning>

***

## Cómo empezar

<Note>
  **Requisitos previos**

  * Una [cuenta de desarrollador](https://developer.x.com/en/portal/petition/essential/basic-info) aprobada
  * Un [Project y App](/resources/fundamentals/developer-apps) en la Developer Console
  * User Access Tokens mediante [OAuth 2.0 PKCE](/resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2) o [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">
    Crea tu primer Post
  </Card>

  <Card title="Guía de integración" 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">
    Conceptos clave y mejores prácticas
  </Card>

  <Card title="Subida de media" 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">
    Sube media para Posts
  </Card>

  <Card title="Referencia de la 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">
    Documentación completa del endpoint
  </Card>
</CardGroup>
