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

# Démarrage rapide

> Créer, mettre à jour et supprimer des Listes

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

Ce guide vous explique comment créer, mettre à jour et supprimer des listes.

<Note>
  **Prérequis**

  Avant de commencer, vous aurez besoin :

  * d'un [compte développeur](https://developer.x.com/en/portal/petition/essential/basic-info) avec une App approuvée
  * d'un jeton d'accès utilisateur (User Access Token) (OAuth 1.0a ou OAuth 2.0 PKCE)
</Note>

***

<div id="create-a-list">
  ## Créer une Liste
</div>

<Steps>
  <Step title="Préparer votre requête">
    Définissez le nom de la Liste (obligatoire), ainsi qu’éventuellement une description et des paramètres de confidentialité :

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

  <Step title="Envoyer la requête">
    <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)

      # Créer une nouvelle Liste
      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 });

      // Créer une nouvelle Liste
      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="Examiner la réponse">
    ```json theme={null}
    {
      "data": {
        "id": "1441162269824405510",
        "name": "Tech News"
      }
    }
    ```

    Enregistrez l’`id` afin de pouvoir mettre à jour ou supprimer la Liste ultérieurement.
  </Step>
</Steps>

***

<div id="update-a-list">
  ## Mettre à jour une liste
</div>

Modifiez le nom, la description ou les paramètres de confidentialité d’une liste :

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

  # Mettre à jour une liste
  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 });

  // Mettre à jour une liste
  const response = await client.lists.update("1441162269824405510", {
    name: "Tech News & Insights",
    description: "Updated description",
  });

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

**Réponse :**

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

***

<div id="delete-a-list">
  ## Supprimer une Liste
</div>

<Steps>
  <Step title="Récupérer l'identifiant de la Liste">
    Vous avez besoin de l'identifiant de la Liste que vous souhaitez supprimer.
  </Step>

  <Step title="Envoyer la requête de suppression">
    <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)

      # Supprimer une Liste
      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 });

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

  <Step title="Confirmer la suppression">
    ```json theme={null}
    {
      "data": {
        "deleted": true
      }
    }
    ```
  </Step>
</Steps>

<Warning>
  Vous ne pouvez supprimer que les Listes que vous possédez.
</Warning>

***

<div id="next-steps">
  ## Étapes suivantes
</div>

<CardGroup cols={2}>
  <Card title="Membres de liste" icon="users" href="/fr/x-api/lists/list-members/introduction">
    Ajouter et supprimer des membres de liste
  </Card>

  <Card title="Recherche de liste" icon="magnifying-glass" href="/fr/x-api/lists/list-lookup/quickstart">
    Récupérer les détails de la liste
  </Card>

  <Card title="Guide d’intégration" icon="book" href="/fr/x-api/lists/manage-lists/integrate">
    Concepts clés et bonnes pratiques
  </Card>

  <Card title="Référence de l’API" icon="code" href="/fr/x-api/lists/create-list">
    Documentation complète de l’endpoint
  </Card>
</CardGroup>
