curl --request POST \
--url https://api.x.com/2/tweets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"card_uri": "<string>",
"community_id": "1146654567674912769",
"direct_message_deep_link": "<string>",
"for_super_followers_only": false,
"geo": {
"place_id": "<string>"
},
"nullcast": false,
"quote_tweet_id": "1346889436626259968",
"share_with_followers": false,
"text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
}
'import requests
url = "https://api.x.com/2/tweets"
payload = {
"card_uri": "<string>",
"community_id": "1146654567674912769",
"direct_message_deep_link": "<string>",
"for_super_followers_only": False,
"geo": { "place_id": "<string>" },
"nullcast": False,
"quote_tweet_id": "1346889436626259968",
"share_with_followers": False,
"text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\u2026 https:\/\/t.co\/56a0vZUx7i"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
card_uri: '<string>',
community_id: '1146654567674912769',
direct_message_deep_link: '<string>',
for_super_followers_only: false,
geo: {place_id: '<string>'},
nullcast: false,
quote_tweet_id: '1346889436626259968',
share_with_followers: false,
text: 'Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\u2026 https:\/\/t.co\/56a0vZUx7i'
})
};
fetch('https://api.x.com/2/tweets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/tweets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'card_uri' => '<string>',
'community_id' => '1146654567674912769',
'direct_message_deep_link' => '<string>',
'for_super_followers_only' => false,
'geo' => [
'place_id' => '<string>'
],
'nullcast' => false,
'quote_tweet_id' => '1346889436626259968',
'share_with_followers' => false,
'text' => 'Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/tweets"
payload := strings.NewReader("{\n \"card_uri\": \"<string>\",\n \"community_id\": \"1146654567674912769\",\n \"direct_message_deep_link\": \"<string>\",\n \"for_super_followers_only\": false,\n \"geo\": {\n \"place_id\": \"<string>\"\n },\n \"nullcast\": false,\n \"quote_tweet_id\": \"1346889436626259968\",\n \"share_with_followers\": false,\n \"text\": \"Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\\\u2026 https:\\\\/\\\\/t.co\\\\/56a0vZUx7i\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.x.com/2/tweets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"card_uri\": \"<string>\",\n \"community_id\": \"1146654567674912769\",\n \"direct_message_deep_link\": \"<string>\",\n \"for_super_followers_only\": false,\n \"geo\": {\n \"place_id\": \"<string>\"\n },\n \"nullcast\": false,\n \"quote_tweet_id\": \"1346889436626259968\",\n \"share_with_followers\": false,\n \"text\": \"Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\\\u2026 https:\\\\/\\\\/t.co\\\\/56a0vZUx7i\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"card_uri\": \"<string>\",\n \"community_id\": \"1146654567674912769\",\n \"direct_message_deep_link\": \"<string>\",\n \"for_super_followers_only\": false,\n \"geo\": {\n \"place_id\": \"<string>\"\n },\n \"nullcast\": false,\n \"quote_tweet_id\": \"1346889436626259968\",\n \"share_with_followers\": false,\n \"text\": \"Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\\\u2026 https:\\\\/\\\\/t.co\\\\/56a0vZUx7i\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "1346889436626259968",
"text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
},
"errors": [
{
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"status": 123
}
]
}{
"code": 123,
"message": "<string>"
}Crear o editar una Publicación
Crea una nueva Publicación para el usuario autenticado o edita una Publicación existente cuando se proporcionan edit_options.
curl --request POST \
--url https://api.x.com/2/tweets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"card_uri": "<string>",
"community_id": "1146654567674912769",
"direct_message_deep_link": "<string>",
"for_super_followers_only": false,
"geo": {
"place_id": "<string>"
},
"nullcast": false,
"quote_tweet_id": "1346889436626259968",
"share_with_followers": false,
"text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
}
'import requests
url = "https://api.x.com/2/tweets"
payload = {
"card_uri": "<string>",
"community_id": "1146654567674912769",
"direct_message_deep_link": "<string>",
"for_super_followers_only": False,
"geo": { "place_id": "<string>" },
"nullcast": False,
"quote_tweet_id": "1346889436626259968",
"share_with_followers": False,
"text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\u2026 https:\/\/t.co\/56a0vZUx7i"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
card_uri: '<string>',
community_id: '1146654567674912769',
direct_message_deep_link: '<string>',
for_super_followers_only: false,
geo: {place_id: '<string>'},
nullcast: false,
quote_tweet_id: '1346889436626259968',
share_with_followers: false,
text: 'Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\u2026 https:\/\/t.co\/56a0vZUx7i'
})
};
fetch('https://api.x.com/2/tweets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.x.com/2/tweets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'card_uri' => '<string>',
'community_id' => '1146654567674912769',
'direct_message_deep_link' => '<string>',
'for_super_followers_only' => false,
'geo' => [
'place_id' => '<string>'
],
'nullcast' => false,
'quote_tweet_id' => '1346889436626259968',
'share_with_followers' => false,
'text' => 'Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.x.com/2/tweets"
payload := strings.NewReader("{\n \"card_uri\": \"<string>\",\n \"community_id\": \"1146654567674912769\",\n \"direct_message_deep_link\": \"<string>\",\n \"for_super_followers_only\": false,\n \"geo\": {\n \"place_id\": \"<string>\"\n },\n \"nullcast\": false,\n \"quote_tweet_id\": \"1346889436626259968\",\n \"share_with_followers\": false,\n \"text\": \"Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\\\u2026 https:\\\\/\\\\/t.co\\\\/56a0vZUx7i\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.x.com/2/tweets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"card_uri\": \"<string>\",\n \"community_id\": \"1146654567674912769\",\n \"direct_message_deep_link\": \"<string>\",\n \"for_super_followers_only\": false,\n \"geo\": {\n \"place_id\": \"<string>\"\n },\n \"nullcast\": false,\n \"quote_tweet_id\": \"1346889436626259968\",\n \"share_with_followers\": false,\n \"text\": \"Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\\\u2026 https:\\\\/\\\\/t.co\\\\/56a0vZUx7i\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/tweets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"card_uri\": \"<string>\",\n \"community_id\": \"1146654567674912769\",\n \"direct_message_deep_link\": \"<string>\",\n \"for_super_followers_only\": false,\n \"geo\": {\n \"place_id\": \"<string>\"\n },\n \"nullcast\": false,\n \"quote_tweet_id\": \"1346889436626259968\",\n \"share_with_followers\": false,\n \"text\": \"Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\\\u2026 https:\\\\/\\\\/t.co\\\\/56a0vZUx7i\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "1346889436626259968",
"text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
},
"errors": [
{
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"status": 123
}
]
}{
"code": 123,
"message": "<string>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Body
Parámetro Card URI. Es mutuamente excluyente con Quote Tweet id, Poll, Media y el deep link de Mensaje Directo.
El identificador único de esta Comunidad.
^[0-9]{1,19}$"1146654567674912769"
Enlace para llevar una conversación de la cronología pública a un Mensaje Directo privado.
Opciones para editar una Publicación existente. Si se proporcionan, esta solicitud editará la Publicación especificada en lugar de crear una nueva.
Show child attributes
Show child attributes
Tweet exclusivo para superseguidores.
ID de lugar que se adjunta al Tweet para la geolocalización.
Show child attributes
Show child attributes
Información de medios que se adjunta al Tweet creado. Es mutuamente excluyente con el ID de Quote Tweet, la encuesta (Poll) y el URI de la tarjeta (Card URI).
Show child attributes
Show child attributes
Las Publicaciones nullcast (solo promocionales) no aparecen en la cronología pública y no se muestran a los seguidores.
Opciones de un Tweet con encuesta. Esto es mutuamente excluyente con Media, Quote Tweet id y Card URI.
Show child attributes
Show child attributes
Identificador único de este Tweet. Se devuelve como cadena para evitar complicaciones con lenguajes y herramientas que no pueden manejar enteros de gran tamaño.
^[0-9]{1,19}$"1346889436626259968"
Información del Tweet al que se está respondiendo.
Show child attributes
Show child attributes
Configuración para indicar quién puede responder al Tweet.
following, mentionedUsers, subscribers, verified Compartir también la publicación de la comunidad con tus seguidores.
Texto del Tweet.
"Learn how to use the user Tweet timeline and user mention timeline endpoints in the X API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
Response
La solicitud se completó correctamente.
Show child attributes
Show child attributes
1Un objeto HTTP Problem Details, tal como se define en el IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
Show child attributes
Show child attributes