> ## Documentation Index
> Fetch the complete documentation index at: https://generaltranslation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Inicio rápido

> Crear, actualizar y eliminar listas

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <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>;
};

Esta guía te mostrará cómo crear, actualizar y eliminar Listas.

<Note>
  **Requisitos previos**

  Antes de comenzar, necesitarás:

  * Una [cuenta de desarrollador](https://developer.x.com/en/portal/petition/essential/basic-info) con una App aprobada
  * Un token de acceso de usuario (OAuth 1.0a o OAuth 2.0 PKCE)
</Note>

***

<div id="create-a-list">
  ## Crear una Lista
</div>

<Steps>
  <Step title="Prepara tu solicitud">
    Define el nombre de la Lista (obligatorio) y, de forma opcional, la descripción y la configuración de privacidad:

    ```json theme={null}
    {
      "name": "Tech News",
      "description": "Top tech journalists and publications",
      "private": false
    }
    ```
  </Step>

  <Step title="Envía la solicitud">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl -X POST "https://api.x.com/2/lists" \
        -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
          "name": "Tech News",
          "description": "Top tech journalists and publications",
          "private": false
        }'
      ```

      ```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)

      # Crear una nueva Lista
      response = client.lists.create(
          name="Tech News",
          description="Top tech journalists and publications",
          private=False
      )

      print(f"List created: {response.data.id} - {response.data.name}")
      ```

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

      // Crear una nueva Lista
      const response = await client.lists.create({
        name: "Tech News",
        description: "Top tech journalists and publications",
        private: false,
      });

      console.log(`List created: ${response.data?.id} - ${response.data?.name}`);
      ```
    </CodeGroup>
  </Step>

  <Step title="Revisa la respuesta">
    ```json theme={null}
    {
      "data": {
        "id": "1441162269824405510",
        "name": "Tech News"
      }
    }
    ```

    Guarda el `id` para poder actualizar o eliminar la Lista más adelante.
  </Step>
</Steps>

***

<div id="update-a-list">
  ## Actualizar una Lista
</div>

Actualiza el nombre, la descripción o la privacidad de una Lista:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X PUT "https://api.x.com/2/lists/1441162269824405510" \
    -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Tech News & Insights",
      "description": "Updated description"
    }'
  ```

  ```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)

  # Actualizar una Lista
  response = client.lists.update(
      "1441162269824405510",
      name="Tech News & Insights",
      description="Updated description"
  )

  print(f"Updated: {response.data.updated}")
  ```

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

  // Actualizar una Lista
  const response = await client.lists.update("1441162269824405510", {
    name: "Tech News & Insights",
    description: "Updated description",
  });

  console.log(`Updated: ${response.data?.updated}`);
  ```
</CodeGroup>

**Respuesta:**

```json theme={null}
{
  "data": {
    "updated": true
  }
}
```

***

<div id="delete-a-list">
  ## Eliminar una Lista
</div>

<Steps>
  <Step title="Obtener el ID de la Lista">
    Necesitas el ID de la Lista que quieres eliminar.
  </Step>

  <Step title="Enviar la solicitud de eliminación">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl -X DELETE "https://api.x.com/2/lists/1441162269824405510" \
        -H "Authorization: Bearer $USER_ACCESS_TOKEN"
      ```

      ```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)

      # Eliminar una Lista
      response = client.lists.delete("1441162269824405510")
      print(f"Deleted: {response.data.deleted}")
      ```

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

      // Eliminar una Lista
      const response = await client.lists.delete("1441162269824405510");
      console.log(`Deleted: ${response.data?.deleted}`);
      ```
    </CodeGroup>
  </Step>

  <Step title="Confirmar la eliminación">
    ```json theme={null}
    {
      "data": {
        "deleted": true
      }
    }
    ```
  </Step>
</Steps>

<Warning>
  Solo puedes eliminar las Listas de las que seas propietario.
</Warning>

***

<div id="next-steps">
  ## Próximos pasos
</div>

<CardGroup cols={2}>
  <Card title="Miembros de la Lista" icon="users" href="/es/x-api/lists/list-members/introduction">
    Agregar y eliminar miembros de la Lista
  </Card>

  <Card title="Consulta de Listas" icon="magnifying-glass" href="/es/x-api/lists/list-lookup/quickstart">
    Obtener detalles de la Lista
  </Card>

  <Card title="Guía de integración" icon="book" href="/es/x-api/lists/manage-lists/integrate">
    Conceptos clave y buenas prácticas
  </Card>

  <Card title="Referencia de la API" icon="code" href="/es/x-api/lists/create-list">
    Documentación completa del endpoint
  </Card>
</CardGroup>
