DM settings
Who can message you, read receipts, the message quality filter and audio/video call settings. No passcode needed.
/client/dm/settingsYour account, your proxy, your risk.
Account actions run with the session cookie of your own X account and go out through your own proxy. Use only accounts you control and follow X's rules. Automated posting, following or liking can get the account limited or suspended; that is between you and X. Treat the cookie like a password: it gives full access to the account. Trial keys cannot call these endpoints.
Parameters
cookiebody · string · requiredCookie header of your own logged-in X session. Must contain auth_token, ct0 and twid (your account ID, set by x.com at login); guest_id is used when present.
proxybody · string · requiredYour proxy, format http://user:pass@host:port. The requests to X go out through it. Used only for this request.
Body parameters are sent as a JSON object with Content-Type: application/json.
Example request
curl -X POST 'https://api.twittrapi.com/client/dm/settings' \
--header 'X-API-KEY: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"cookie":"auth_token=...; ct0=...; twid=u%3D...","proxy":"http://user:pass@host:port"}'import httpx
resp = httpx.post(
"https://api.twittrapi.com/client/dm/settings",
headers={"X-API-KEY": "YOUR_API_KEY"},
json={
"cookie": "auth_token=...; ct0=...; twid=u%3D...",
"proxy": "http://user:pass@host:port",
},
timeout=60,
)
print(resp.status_code, resp.json())const resp = await fetch("https://api.twittrapi.com/client/dm/settings", {
method: "POST",
headers: { "X-API-KEY": process.env.TWITTRAPI_API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
cookie: "auth_token=...; ct0=...; twid=u%3D...",
proxy: "http://user:pass@host:port",
}),
});
console.log(resp.status, await resp.json());Base URL https://api.twittrapi.com, key in the X-API-KEY header. The SDKs do not wrap account actions, so the examples are plain HTTP calls.
Response
{allow_dms_from, dm_receipt_settings, dm_quality_filter, av_settings: {has_av_calls_enabled, av_call_permissions: {accept_calls_from_everyone, accept_calls_from_following, accept_calls_from_verified, accept_calls_from_addressbook}}}. Values as X sends them; dm_receipt_settings and dm_quality_filter are left out when X does not send them.
Simple format (?format=simple or X-Response-Format: simple): {data: {allowDmsFrom, readReceipts, qualityFilter, calls: {enabled, fromEveryone, fromFollowing, fromVerified, fromAddressBook}}}. Schema.
In the raw format, field names and nesting come from X and can change without notice. See Response format; the simple format keeps a fixed schema.
Errors
- 400The body is not valid JSON.
- 422cookie or proxy is missing, the cookie has no twid or ct0, or the passcode is neither a string nor a whole number or longer than 64 characters. Also: the account is suspended, or X rejected the session ("Twitter temporarily rejected this session; refresh the login and try again").
- 407The proxy is unreachable or timed out.
- 502X returned no DM settings. Refunded.
- 429X's rate limit for this account: "X rate limit reached for this account, try again later".
- X'sX refused the request: answered with X's status and {"error": "X refused the request: <X's reason>"}. When X answers 200 with an error, the status is 422.
Errors every endpoint can return (401, 402, 403, 404, 408, 409, 429, 5xx), and which of them are charged, are on the Errors page. Calls that fail with 400, 408, 409 or a 5xx error are refunded.