Change Username
Change the @username (screen name) of the account identified by cookie. TwexAPI first asks X whether the new handle is available: a handle that is already taken returns 409, and one X will not accept (too short, reserved, not allowed) returns 400 with X’s reason, without changing anything. On success it returns the username X saved. To change the display name, use POST /twitter/profile instead. Requires a TwexAPI Bearer key and the account’s authorized X cookie or auth_token.
/twitter/profile/usernameAuthorizationBearer token · headerrequiredapplication/jsoncookiestringrequiredusernamestringrequiredproxystring | anyShow propertiesHide properties
stringanycodeintegerrequiredmsgstringrequireddataobjectrequiredShow propertiesHide properties
usernamestringrequiredcodeintegerrequiredmsgstringrequireddataany[] | anyrequiredShow propertiesHide properties
anyanyanycodeintegerrequiredmsgstringrequireddataany[] | anyrequiredShow propertiesHide properties
anyanyanycodeintegerrequiredmsgstringrequireddataany[] | anyrequiredShow propertiesHide properties
anyanyanycodeintegerrequiredmsgstringrequireddataany[] | anyrequiredShow propertiesHide properties
anyanyanycodeintegerrequiredmsgstringrequireddataany[] | anyrequiredShow propertiesHide properties
anyanyanycodeintegerrequiredmsgstringrequireddataany[] | anyrequiredShow propertiesHide properties
anyanyany⚡Interactive Console / Try APIPOSTLive Console
https://api.twexapi.io1. TwexAPI Platform Key (Bearer Token): Enter under "API Authorization" below for request billing & authentication.
2. Twitter Account Cookie: For write operations (tweet, like, follow, etc.), provide the target Twitter account's Cookie (e.g. auth_token=...; ct0=...) in the cookie field of Request Body below.
Configure parameters in the Request tab and click Send Request below.
curl -X POST "https://api.twexapi.io/twitter/profile/username" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"cookie": "YOUR_X_COOKIE_OR_AUTH_TOKEN",
"username": "new_handle"
}'const response = await fetch("https://api.twexapi.io/twitter/profile/username", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"cookie": "YOUR_X_COOKIE_OR_AUTH_TOKEN",
"username": "new_handle"
})
});import requests
response = requests.post(
"https://api.twexapi.io/twitter/profile/username",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"cookie": "YOUR_X_COOKIE_OR_AUTH_TOKEN",
"username": "new_handle"
},
){
"code": 200,
"msg": "success",
"data": {
"username": "new_handle"
}
}{
"code": 400,
"msg": "Your username must be longer than 4 characters.",
"data": null
}{
"code": 401,
"msg": "X could not authenticate the account. (32)",
"data": null
}{
"code": 0,
"msg": "string",
"data": [
null
]
}{
"code": 409,
"msg": "That username has been taken. Please choose another.",
"data": null
}{
"code": 0,
"msg": "string",
"data": [
null
]
}{
"code": 0,
"msg": "string",
"data": [
null
]
}