Change Username

POST/tw-v2/profile/username

Description

Change the username for the authenticated X account. The new username must contain 5-15 ASCII letters, numbers, or underscores. Do not include @.

A successful response consumes one customer request. This endpoint has no idempotency guarantee. A 502 response can be transient, but if the outcome is unclear, check the account's current username before you retry.

Warning: After a successful change, the old username becomes immediately available for another account to claim.

Request Body

ParameterTypeRequiredDescription
authTokenstringrequiredAccount authentication token (auth_token cookie value)
passwordstringrequiredPassword for the authenticated X account
usernamestringrequiredDesired username, using 5-15 ASCII letters, numbers, or underscores without @
proxystringoptionalOptional proxy in format 'hostname:port@username:password'

Code Examples

const body = {
  authToken: 'YOUR_AUTH_TOKEN',
  password: 'YOUR_PASSWORD',
  username: 'sample_user'
};

const response = await fetch('https://api.tweetapi.com/tw-v2/profile/username', {
  method: 'POST',
  headers: {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(body)
});

const data = await response.json();
console.log(data);

Response

Success Response (200 OK)

200
{
  "data": {
    "username": "sample_user"
  }
}

API Playground

POST/tw-v2/profile/username

Sensitive Credentials Required

Requires your Twitter authToken. Use a test account.

Press ⌘ + Enter to execute

curl -X POST "https://api.tweetapi.com/tw-v2/profile/username" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"
Response

Click "Try It!" to see the response