DMチャット履歴取得 (XChat v3)
DMチャット履歴取得 (XChat v3).
APIリファレンスに戻る
/DM Endpoints
POST
/v3/twitter/dm-historyAPI 認証
AuthorizationBearer token · header必須TwexAPIのグローバル認証トークン (Bearer Token)。ヘッダーに含める必要があります:Authorization: Bearer <YOUR_TWEXAPI_KEY>。
リクエストボディ
必須application/jsonrecipientstring必須User id, @handle, conversationId a:b, or group g....
pinstring | anyIdentity PIN (default 1234).
default: "1234"
プロパティを表示プロパティを非表示
Any of:
string
stringany
anycountinteger | anyMax events per page (10–200, default 50).
default: 50
プロパティを表示プロパティを非表示
Any of:
integer
integerany
anyallboolean | anyFollow has_more and return every page.
default: false
プロパティを表示プロパティを非表示
Any of:
boolean
booleanany
anybeforestring | anyOldest sequenceId for paging. Pass the previous page's oldest message sequence_id.
プロパティを表示プロパティを非表示
Any of:
string
stringany
anycookiestring必須ユーザー自身が承認した Twitter セッション資格情報または auth_token(BYOC — Bring Your Own Cookie)。機密情報は保存されず、完全なステートレスプロキシとして実行されます。詳細は [認証・セキュリティガイド](/ja/authentication#write-operations--byoc-bring-your-own-cookie) および [Cookie 取得手順](https://youtube-promotion.pages.dev/how-to-get-twitter-cookie) を参照。
proxystring | anyOptional HTTP proxy. Example: http://username:password@ip:port
プロパティを表示プロパティを非表示
Any of:
string
stringany
anyレスポンス
200Conversation messages with pagination info.
codeinteger必須HTTP ステータスコード(200 は成功)
msgstring必須レスポンスメッセージ(例: 'success')
dataDmHistoryV3Data | any返却されるコアデータオブジェクトまたは配列
プロパティを表示プロパティを非表示
Any of:
DmHistoryV3Data
conversation_idstring必須Conversation id
has_moreboolean必須Whether older messages are available
messagesMessageModel[]必須List of message objects
プロパティを表示プロパティを非表示
Array of
MessageModelidstring必須Message ID
textstring必須メッセージ本文
timestring必須Message time
attachmentobject | anyMessage attachment
プロパティを表示プロパティを非表示
Any of:
object
objectany
anyattachmentsobject[] | anyXChat media attachments (v3).
プロパティを表示プロパティを非表示
Any of:
object[]
Array of
objectobjectany
anysequence_idstring | anyXChat sequence id. Use the oldest message's sequence_id as before for pagination.
プロパティを表示プロパティを非表示
Any of:
string
stringany
anysender_idstring | anySender ID
プロパティを表示プロパティを非表示
Any of:
string
stringany
anyrecipient_idstring | any送信先相手のTwitterユーザーID
プロパティを表示プロパティを非表示
Any of:
string
stringany
anyany
any422パラメータバリデーションエラー
detailValidationError[]プロパティを表示プロパティを非表示
Array of
ValidationErrorlocstring | integer[]必須プロパティを表示プロパティを非表示
Array of
string | integerAny of:
string
stringinteger
integermsgstring必須レスポンスメッセージ(例: 'success')
typestring必須inputanyctxobject⚡インタラクティブテストPOST
⚡インタラクティブテスト / Try APIPOSTLive Console
🌐対象サーバー:
https://api.twexapi.io● 本番環境レディ
✍️
書き込み操作の認証情報ガイド(TwexAPIキー + Twitter Cookie)
1. TwexAPIプラットフォームキー (Bearer Token): 下記の「API認証」に入力してください(API呼び出しと課金認証に使用)。
2. TwitterアカウントCookie: ツイート・いいね・フォロー等の書き込み操作のため、下記リクエストボディの cookie フィールドに対象TwitterアカウントのCookie(例: auth_token=...; ct0=...)を入力してください。
🔑API 認証
📝リクエストボディapplication/json
📡
暂无响应数据
请在「请求配置」中确认参数后,点击底部的「发送请求」按钮。
リクエスト例
curl -X POST "https://api.twexapi.io/v3/twitter/dm-history" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"recipient": "1928096185664843776:1989842918455291904",
"pin": "1234",
"count": 50,
"all": false,
"before": "2076684837654876160",
"cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
"proxy": "http://username:password@ip:port"
}'const response = await fetch("https://api.twexapi.io/v3/twitter/dm-history", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"recipient": "1928096185664843776:1989842918455291904",
"pin": "1234",
"count": 50,
"all": false,
"before": "2076684837654876160",
"cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
"proxy": "http://username:password@ip:port"
})
});import requests
response = requests.post(
"https://api.twexapi.io/v3/twitter/dm-history",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"recipient": "1928096185664843776:1989842918455291904",
"pin": "1234",
"count": 50,
"all": False,
"before": "2076684837654876160",
"cookie": "ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7",
"proxy": "http://username:password@ip:port"
},
)レスポンス例
{
"code": 200,
"msg": "success",
"data": {
"conversation_id": "1928096185664843776:1989842918455291904",
"has_more": true,
"messages": [
{
"id": "1234567890123456789",
"text": "Hello, how are you?",
"time": "2024-01-01T12:00:00Z",
"attachment": {
"type": "image",
"url": "https://example.com/image.jpg"
},
"attachments": [
{
"attachment_id": "cda5ccdd-af53-48a3-bdd1-5039a73aea25",
"conversation_id": "1928096185664843776:1989842918455291904",
"filename": "image.jpg",
"filesize_bytes": 421299,
"height": 1448,
"key_version": "3",
"media_hash_key": "blRIlZCVIO",
"type": "image",
"type_name": "IMAGE",
"width": 1086
}
],
"sequence_id": "2076661179334979585",
"sender_id": "1234567890123456789",
"recipient_id": "1234567890123456789"
}
]
}
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}