Passer au contenu principal
Les endpoints Manage Posts vous permettent de créer et de supprimer des Publications au nom d’utilisateurs authentifiés. Créez des applications qui publient du contenu, créent des fils de discussion ou gèrent les Publications des utilisateurs.

Vue d’ensemble

Créer une Publication

Publier une nouvelle Publication

Supprimer une Publication

Supprimer une Publication existante

Répondre

Répondre à une autre Publication

Citer

Citer une autre Publication

Points de terminaison

MéthodePoint de terminaisonDescription
POST/2/tweetsCréer une nouvelle Publication
DELETE/2/tweets/:idSupprimer une Publication

Création de publications

Publication simple

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!"}'

Répondre à une Publication

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"
    }
  }'

Citer une Publication

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"
  }'

Publication avec média

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"]
    }
  }'
Chargez d’abord le média à l’aide du Media Upload endpoint, puis faites référence au media_id dans votre Publication.

Publication contenant un sondage

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

Supprimer des publications

curl -X DELETE "https://api.x.com/2/tweets/1234567890" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"
Vous ne pouvez supprimer que les Publications créées par l’utilisateur authentifié.

Pour commencer

Prérequis

Démarrage rapide

Créez votre première Publication

Guide d’intégration

Concepts clés et bonnes pratiques

Téléversement de médias

Téléversez des médias pour vos Publications

Référence de l’API

Documentation complète de l’endpoint