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>"
}ポストを作成または編集
認証済みユーザーの新しいポストを作成します。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>"
}承認
The access token received from the authorization server in the OAuth 2.0 flow.
ボディ
Card URI パラメータ。これは Quote Tweet の id、投票、メディア、ダイレクトメッセージのディープリンクとは相互排他的です。
このコミュニティの一意の識別子。
^[0-9]{1,19}$"1146654567674912769"
パブリックタイムライン上の会話を非公開のダイレクトメッセージに移行するためのリンク。
既存のポストを編集するためのオプションです。このパラメータが指定されている場合は、新規ポストを作成せず、指定されたポストが編集されます。
Show child attributes
Show child attributes
スーパーフォロー限定のツイート。
位置情報のためにツイートに関連付けられる Place ID。
Show child attributes
Show child attributes
作成されるツイートに関連付けられるメディア情報。これは Quote Tweet ID、Poll、Card URI と相互排他的であり、同時に指定することはできません。
Show child attributes
Show child attributes
Nullcast(プロモーション専用)のポストは、公開タイムラインやフォロワーのタイムラインには表示されません。
投票付きツイートの投票オプションです。Media、Quote Tweet ID、Card URI とは相互に排他的で、同時には指定できません。
Show child attributes
Show child attributes
このツイートの一意の識別子。大きな整数を扱えない言語やツールでの問題を避けるため、文字列として返されます。
^[0-9]{1,19}$"1346889436626259968"
返信先となるツイートの情報。
Show child attributes
Show child attributes
ツイートに返信できるユーザーを指定する設定。
following, mentionedUsers, subscribers, verified コミュニティのポストをフォロワーとも共有します。
ツイートの内容。
"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"
レスポンス
リクエストは成功しました。
Show child attributes
Show child attributes
1IETF RFC 7807 (https://tools.ietf.org/html/rfc7807) で定義された HTTP Problem Details オブジェクト。
- 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