Retrieves the Direct Message (DM) availability status for a list of users. This endpoint checks if the specified accounts can receive messages based on their privacy settings, follow status, or verified permissions.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.DmStatusResponse;
import java.lang.Exception;
import java.lang.String;
import java.util.List;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
List<String> req = List.of(
"1696160451770429440");
DmStatusResponse res = sdk.dm().status()
.request(req)
.call();
if (res.dmStatusResponseV2().isPresent()) {
System.out.println(res.dmStatusResponseV2().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
List |
✔️ |
The request object to use for the request. |
DmStatusResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Send DM via XChat encrypted chat API (1:1 or existing group g...), optional image via media_urls (max 1) or video via video_url (mutually exclusive). $0.001 per call.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.SendDmV3Query;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.DmSendResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
SendDmV3Query req = SendDmV3Query.builder()
.recipient("baker_donn80196")
.text("hello from docs")
.cookie("ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7")
.mediaUrls(List.of(
"https://example.com/image.jpg"))
.videoUrl("https://video.twimg.com/amplify_video/2077160248830275584/vid/avc1/320x568/kwNDLTm")
.pin("1234")
.proxy("http://username:password@ip:port")
.build();
DmSendResponse res = sdk.dm().send()
.request(req)
.call();
if (res.sendDmResponse().isPresent()) {
System.out.println(res.sendDmResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
SendDmV3Query |
✔️ |
The request object to use for the request. |
DmSendResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Get DM history via XChat encrypted chat API. Use count for page size (10–200). Set all=true to follow has_more and return every page. Or paginate manually: when has_more is true, pass the oldest message's sequence_id as before.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetDmHistoryV3Query;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.DmHistoryResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
GetDmHistoryV3Query req = GetDmHistoryV3Query.builder()
.recipient("1928096185664843776:1989842918455291904")
.cookie("ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7")
.pin("1234")
.count(50L)
.all(false)
.before("2076684837654876160")
.proxy("http://username:password@ip:port")
.build();
DmHistoryResponse res = sdk.dm().history()
.request(req)
.call();
if (res.getDmHistoryV3Response().isPresent()) {
System.out.println(res.getDmHistoryV3Response().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
GetDmHistoryV3Query |
✔️ |
The request object to use for the request. |
DmHistoryResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Fetch one XChat media attachment and return a playable URL. Use conversation_id, media_hash_key, and optional key_version from /v3/twitter/dm-history attachments.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetDmMediaV3Query;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.DmMediaResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
GetDmMediaV3Query req = GetDmMediaV3Query.builder()
.conversationId("1928096185664843776:1989842918455291904")
.mediaHashKey("blRIlZCVIO")
.cookie("ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7")
.keyVersion("3")
.typeName("VIDEO")
.filename("clip.mp4")
.pin("1234")
.proxy("http://username:password@ip:port")
.build();
DmMediaResponse res = sdk.dm().media()
.request(req)
.call();
if (res.getDmMediaV3Response().isPresent()) {
System.out.println(res.getDmMediaV3Response().get());
}
}
}
| Parameter |
Type |
Required |
Description |
request |
GetDmMediaV3Query |
✔️ |
The request object to use for the request. |
DmMediaResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Get XChat conversation list. Use count for page size (10–200). Set all=true to follow the inbox cursor and return every conversation.
package hello.world;
import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.components.GetConversationsV3Query;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.DmConversationsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws HTTPValidationError, Exception {
XapiScraper sdk = XapiScraper.builder()
.bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
.build();
GetConversationsV3Query req = GetConversationsV3Query.builder()
.cookie("ct0=abc123... or 2c4a4e1832096aa694c739b83c83b6d96d43eba7")
.count(100L)
.all(true)
.proxy("http://username:password@ip:port")
.build();
DmConversationsResponse res = sdk.dm().conversations()
.request(req)
.call();
if (res.getConversationsV3Response().isPresent()) {
System.out.println(res.getConversationsV3Response().get());
}
}
}
DmConversationsResponse
| Error Type |
Status Code |
Content Type |
| models/errors/HTTPValidationError |
422 |
application/json |
| models/errors/APIException |
4XX, 5XX |
*/* |