Update Chat settings
Updates the authenticated user’s Chat privacy settings: who can message them, read receipts, the message quality filter, and audio/video call permissions. allow_dms_from, dm_receipt_settings, and dm_quality_filter accept only their listed values, matched exactly and case-sensitively; anything else is a 400. av_settings must set at least one of its settings. Whether settings omitted from a partial av_settings keep their values or are reset is not yet confirmed; send every av_settings field you want to keep.
curl --request PUT \
--url https://api.x.com/2/chat/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"always_allow_dms_from_subscribers": true,
"av_settings": {
"av_call_permissions": {
"accept_calls_from_addressbook": true,
"accept_calls_from_everyone": true,
"accept_calls_from_following": true,
"accept_calls_from_verified": true
},
"has_av_calls_enabled": true,
"has_enhanced_call_privacy_enabled": true
}
}
'import requests
url = "https://api.x.com/2/chat/settings"
payload = {
"always_allow_dms_from_subscribers": True,
"av_settings": {
"av_call_permissions": {
"accept_calls_from_addressbook": True,
"accept_calls_from_everyone": True,
"accept_calls_from_following": True,
"accept_calls_from_verified": True
},
"has_av_calls_enabled": True,
"has_enhanced_call_privacy_enabled": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
always_allow_dms_from_subscribers: true,
av_settings: {
av_call_permissions: {
accept_calls_from_addressbook: true,
accept_calls_from_everyone: true,
accept_calls_from_following: true,
accept_calls_from_verified: true
},
has_av_calls_enabled: true,
has_enhanced_call_privacy_enabled: true
}
})
};
fetch('https://api.x.com/2/chat/settings', 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/chat/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'always_allow_dms_from_subscribers' => true,
'av_settings' => [
'av_call_permissions' => [
'accept_calls_from_addressbook' => true,
'accept_calls_from_everyone' => true,
'accept_calls_from_following' => true,
'accept_calls_from_verified' => true
],
'has_av_calls_enabled' => true,
'has_enhanced_call_privacy_enabled' => true
]
]),
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/chat/settings"
payload := strings.NewReader("{\n \"always_allow_dms_from_subscribers\": true,\n \"av_settings\": {\n \"av_call_permissions\": {\n \"accept_calls_from_addressbook\": true,\n \"accept_calls_from_everyone\": true,\n \"accept_calls_from_following\": true,\n \"accept_calls_from_verified\": true\n },\n \"has_av_calls_enabled\": true,\n \"has_enhanced_call_privacy_enabled\": true\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.x.com/2/chat/settings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"always_allow_dms_from_subscribers\": true,\n \"av_settings\": {\n \"av_call_permissions\": {\n \"accept_calls_from_addressbook\": true,\n \"accept_calls_from_everyone\": true,\n \"accept_calls_from_following\": true,\n \"accept_calls_from_verified\": true\n },\n \"has_av_calls_enabled\": true,\n \"has_enhanced_call_privacy_enabled\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/chat/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"always_allow_dms_from_subscribers\": true,\n \"av_settings\": {\n \"av_call_permissions\": {\n \"accept_calls_from_addressbook\": true,\n \"accept_calls_from_everyone\": true,\n \"accept_calls_from_following\": true,\n \"accept_calls_from_verified\": true\n },\n \"has_av_calls_enabled\": true,\n \"has_enhanced_call_privacy_enabled\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"allow_dms_from": "all",
"always_allow_dms_from_subscribers": true,
"av_settings": {
"av_call_permissions": {
"accept_calls_from_addressbook": true,
"accept_calls_from_everyone": true,
"accept_calls_from_following": true,
"accept_calls_from_verified": true
},
"has_av_calls_enabled": true,
"has_enhanced_call_privacy_enabled": true
},
"dm_quality_filter": "enabled",
"dm_receipt_settings": "all_enabled"
},
"errors": [
{
"detail": "<string>",
"resource_type": "<string>",
"title": "<string>",
"type": "https://api.x.com/2/problems/resource-not-found",
"parameter": "<string>",
"resource_id": "<string>",
"status": 123,
"value": "<string>"
}
]
}{
"code": 123,
"message": "<string>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Body
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
At least one of allow_dms_from, always_allow_dms_from_subscribers, dm_quality_filter, dm_receipt_settings, av_settings is required.
Who can send the user messages: all (anyone), verified (verified accounts only), or following (accounts the user follows).
all, verified, following Whether the user's subscribers can always message them regardless of allow_dms_from.
Audio and video call settings.
Show child attributes
Show child attributes
Low-quality message request filter: enabled (low-quality requests go to a separate folder) or disabled (all requests stay in the main inbox).
enabled, disabled Read receipts: all_enabled (send and receive read receipts) or all_disabled (neither).
all_enabled, all_disabled curl --request PUT \
--url https://api.x.com/2/chat/settings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"always_allow_dms_from_subscribers": true,
"av_settings": {
"av_call_permissions": {
"accept_calls_from_addressbook": true,
"accept_calls_from_everyone": true,
"accept_calls_from_following": true,
"accept_calls_from_verified": true
},
"has_av_calls_enabled": true,
"has_enhanced_call_privacy_enabled": true
}
}
'import requests
url = "https://api.x.com/2/chat/settings"
payload = {
"always_allow_dms_from_subscribers": True,
"av_settings": {
"av_call_permissions": {
"accept_calls_from_addressbook": True,
"accept_calls_from_everyone": True,
"accept_calls_from_following": True,
"accept_calls_from_verified": True
},
"has_av_calls_enabled": True,
"has_enhanced_call_privacy_enabled": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
always_allow_dms_from_subscribers: true,
av_settings: {
av_call_permissions: {
accept_calls_from_addressbook: true,
accept_calls_from_everyone: true,
accept_calls_from_following: true,
accept_calls_from_verified: true
},
has_av_calls_enabled: true,
has_enhanced_call_privacy_enabled: true
}
})
};
fetch('https://api.x.com/2/chat/settings', 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/chat/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'always_allow_dms_from_subscribers' => true,
'av_settings' => [
'av_call_permissions' => [
'accept_calls_from_addressbook' => true,
'accept_calls_from_everyone' => true,
'accept_calls_from_following' => true,
'accept_calls_from_verified' => true
],
'has_av_calls_enabled' => true,
'has_enhanced_call_privacy_enabled' => true
]
]),
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/chat/settings"
payload := strings.NewReader("{\n \"always_allow_dms_from_subscribers\": true,\n \"av_settings\": {\n \"av_call_permissions\": {\n \"accept_calls_from_addressbook\": true,\n \"accept_calls_from_everyone\": true,\n \"accept_calls_from_following\": true,\n \"accept_calls_from_verified\": true\n },\n \"has_av_calls_enabled\": true,\n \"has_enhanced_call_privacy_enabled\": true\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.x.com/2/chat/settings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"always_allow_dms_from_subscribers\": true,\n \"av_settings\": {\n \"av_call_permissions\": {\n \"accept_calls_from_addressbook\": true,\n \"accept_calls_from_everyone\": true,\n \"accept_calls_from_following\": true,\n \"accept_calls_from_verified\": true\n },\n \"has_av_calls_enabled\": true,\n \"has_enhanced_call_privacy_enabled\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.x.com/2/chat/settings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"always_allow_dms_from_subscribers\": true,\n \"av_settings\": {\n \"av_call_permissions\": {\n \"accept_calls_from_addressbook\": true,\n \"accept_calls_from_everyone\": true,\n \"accept_calls_from_following\": true,\n \"accept_calls_from_verified\": true\n },\n \"has_av_calls_enabled\": true,\n \"has_enhanced_call_privacy_enabled\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"allow_dms_from": "all",
"always_allow_dms_from_subscribers": true,
"av_settings": {
"av_call_permissions": {
"accept_calls_from_addressbook": true,
"accept_calls_from_everyone": true,
"accept_calls_from_following": true,
"accept_calls_from_verified": true
},
"has_av_calls_enabled": true,
"has_enhanced_call_privacy_enabled": true
},
"dm_quality_filter": "enabled",
"dm_receipt_settings": "all_enabled"
},
"errors": [
{
"detail": "<string>",
"resource_type": "<string>",
"title": "<string>",
"type": "https://api.x.com/2/problems/resource-not-found",
"parameter": "<string>",
"resource_id": "<string>",
"status": 123,
"value": "<string>"
}
]
}{
"code": 123,
"message": "<string>"
}