Documentation Index Fetch the complete documentation index at: https://generaltranslation.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Ce guide vous explique comment utiliser l’API Community Notes pour rechercher des Publications éligibles et soumettre des notes.
Prérequis Avant de commencer, vous aurez besoin de :
Actuellement, test_mode doit être défini sur true pour toutes les requêtes. Les notes de test ne sont pas visibles par le public.
Rechercher des Publications éligibles
curl "https://api.x.com/2/notes/search/posts_eligible_for_notes? \
test_mode=true& \
max_results=100" \
-H "Authorization: OAuth ..."
from requests_oauthlib import OAuth1Session
import json
oauth = OAuth1Session(
client_key = 'YOUR_API_KEY' ,
client_secret = 'YOUR_API_SECRET' ,
resource_owner_key = 'YOUR_ACCESS_TOKEN' ,
resource_owner_secret = 'YOUR_ACCESS_TOKEN_SECRET' ,
)
url = "https://api.x.com/2/notes/search/posts_eligible_for_notes"
params = { "test_mode" : True , "max_results" : 100 }
response = oauth.get(url, params = params)
print (json.dumps(response.json(), indent = 2 ))
Examiner les Publications éligibles
{
"data" : [
{
"id" : "1933207126262096118" ,
"text" : "Rejoignez-nous pour en savoir plus sur nos nouveaux endpoints d’analytique..." ,
"edit_history_tweet_ids" : [ "1933207126262096118" ]
},
{
"id" : "1930672414444372186" ,
"text" : "Nous sommes ravis d’annoncer que X API a remporté le prix 2025..." ,
"edit_history_tweet_ids" : [ "1930672414444372186" ]
}
],
"meta" : {
"newest_id" : "1933207126262096118" ,
"oldest_id" : "1930672414444372186" ,
"result_count" : 2
}
}
Utilisez l’id de la Publication renvoyé dans la réponse pour rédiger une Community Note.
Préparer votre note
Une Community Note requiert :
post_id — la Publication à laquelle vous ajoutez du contexte
text — votre note (1 à 280 caractères, doit inclure l’URL d’une source)
classification — soit misinformed_or_potentially_misleading, soit not_misleading
misleading_tags — obligatoire si la classification indique que c’est trompeur
trustworthy_sources — booléen indiquant si la source est fiable
Envoyer la note
curl -X POST "https://api.x.com/2/notes" \
-H "Authorization: OAuth ..." \
-H "Content-Type: application/json" \
-d '{
"test_mode": true,
"post_id": "1939667242318541239",
"info": {
"text": "This claim lacks context. See the full report: https://example.com/report",
"classification": "misinformed_or_potentially_misleading",
"misleading_tags": ["missing_important_context"],
"trustworthy_sources": true
}
}'
from requests_oauthlib import OAuth1Session
import json
oauth = OAuth1Session(
client_key = 'YOUR_API_KEY' ,
client_secret = 'YOUR_API_SECRET' ,
resource_owner_key = 'YOUR_ACCESS_TOKEN' ,
resource_owner_secret = 'YOUR_ACCESS_TOKEN_SECRET' ,
)
payload = {
"test_mode" : True ,
"post_id" : "1939667242318541239" ,
"info" : {
"text" : "This claim lacks context. See the full report: https://example.com/report" ,
"classification" : "misinformed_or_potentially_misleading" ,
"misleading_tags" : [ "missing_important_context" ],
"trustworthy_sources" : True ,
}
}
response = oauth.post( "https://api.x.com/2/notes" , json = payload)
print (json.dumps(response.json(), indent = 2 ))
Recevoir la confirmation
{
"data" : {
"note_id" : "1938678124100886981"
}
}
Récupérer vos notes soumises
Récupérez les notes que vous avez rédigées :
from requests_oauthlib import OAuth1Session
import json
oauth = OAuth1Session(
client_key = 'YOUR_API_KEY' ,
client_secret = 'YOUR_API_SECRET' ,
resource_owner_key = 'YOUR_ACCESS_TOKEN' ,
resource_owner_secret = 'YOUR_ACCESS_TOKEN_SECRET' ,
)
url = "https://api.x.com/2/notes/search/notes_written"
params = { "test_mode" : True , "max_results" : 100 }
response = oauth.get(url, params = params)
print (json.dumps(response.json(), indent = 2 ))
Réponse :
{
"data" : [
{
"id" : "1939827717186494817" ,
"info" : {
"text" : "Cette affirmation manque de contexte. https://example.com/report" ,
"classification" : "misinformed_or_potentially_misleading" ,
"misleading_tags" : [ "missing_important_context" ],
"post_id" : "1939719604957577716" ,
"trustworthy_sources" : true
}
}
],
"meta" : {
"result_count" : 1
}
}
Options de classification
Lorsque la classification est not_misleading, aucun tag trompeur n’est requis.
{ "title" : "Unauthorized" , "status" : 401 , "detail" : "Unauthorized" }
Résolution : Assurez-vous que vos identifiants OAuth sont corrects.
{ "message" : "User already created a note for this post." }
Résolution : Vous ne pouvez soumettre qu’une seule note par Publication.
Guide Community Notes Documentation officielle de Community Notes
Exemples de code Exemples de code prêts à l’emploi