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

# Gérer les Listes épinglées

> Épingler et désépingler 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 épingler et désépingler 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 (OAuth 1.0a ou OAuth 2.0 PKCE)
</Note>

***

<div id="pin-a-list">
  ## Épingler une Liste
</div>

<Steps>
  <Step title="Récupérer l’ID de votre utilisateur et l’ID de la Liste">
    Vous avez besoin de l’ID de votre utilisateur authentifié et de l’ID de la liste que vous voulez épingler. Vous pouvez trouver les ID de liste dans l’URL lorsque vous affichez une liste.
  </Step>

  <Step title="Épingler la Liste">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl -X POST "https://api.x.com/2/users/2244994945/pinned_lists" \
        -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{"list_id": "1454155907651158017"}'
      ```

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

      # Épingler une Liste
      response = client.lists.pin(
          user_id="2244994945",
          list_id="1454155907651158017"
      )

      print(f"Pinned: {response.data.pinned}")
      ```

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

      // Épingler une Liste
      const response = await client.lists.pin("2244994945", {
        listId: "1454155907651158017",
      });

      console.log(`Pinned: ${response.data?.pinned}`);
      ```
    </CodeGroup>
  </Step>

  <Step title="Vérifier la réponse">
    ```json theme={null}
    {
      "data": {
        "pinned": true
      }
    }
    ```
  </Step>
</Steps>

***

<div id="unpin-a-list">
  ## Détacher une Liste
</div>

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X DELETE "https://api.x.com/2/users/2244994945/pinned_lists/1454155907651158017" \
    -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)

  # Détacher une Liste
  response = client.lists.unpin(
      user_id="2244994945",
      list_id="1454155907651158017"
  )

  print(f"Pinned: {response.data.pinned}")
  ```

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

  // Détacher une Liste
  const response = await client.lists.unpin("2244994945", "1454155907651158017");

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

**Réponse :**

```json theme={null}
{
  "data": {
    "pinned": false
  }
}
```

***

<div id="important-notes">
  ## Notes importantes
</div>

<Note>
  * Seules les Listes que vous suivez ou que vous possédez peuvent être épinglées
  * Les Listes épinglées apparaissent en haut de vos Listes dans l’app X
  * Il y a une limite au nombre de Listes que vous pouvez épingler
</Note>

***

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

<CardGroup cols={2}>
  <Card title="Recherche de listes épinglées" icon="thumbtack" href="/fr/x-api/lists/pinned-lists/quickstart/pinned-list-lookup">
    Obtenez vos listes épinglées
  </Card>

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

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