Users
Update Avatar
Update a Twitter user's profile picture programmatically via API. $0.001 per call. GetXAPI update avatar endpoint with image URL or base64 upload.
POST
/twitter/user/update_avatarThis endpoint costs $0.001 per API call.
Updates the profile picture for the user owning auth_token. Provide the image as a public URL or as base64 — exactly one of the two.
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
auth_token | string | Yes | User's auth_token cookie |
ct0 | string | No | Optional current CSRF token cookie. When provided with twid, skips server-side credential resolution. |
twid | string | No | Optional current user ID cookie, for example u=1234567890. Must be provided with ct0. |
image_url | string | Conditional | Public URL to fetch the image from. Required if image_base64 is not provided. |
image_base64 | string | Conditional | Raw base64 (with or without data:image/...;base64, prefix). Required if image_url is not provided. |
proxy | string | No | Proxy URL (http://, https://, socks5://, or socks4://) |
Notes
- If you already have current
ct0andtwid, send both to skip the extra server-side credential bootstrap fromauth_token. If either one is omitted, the server resolves them fromauth_tokenas before. Stale or invalid supplied values are not validated upfront and may fail on the actual Twitter action instead of returning an early401. - Recommended size: 400×400. Supported formats: JPG, PNG.
- Provide exactly one of
image_urlorimage_base64. - The mutation is performed using the user's own session.
Response (200)
{
"status": "success",
"msg": "Avatar updated successfully",
"data": {
"id": "1740174562631856128",
"screen_name": "example_user",
"profile_image_url": "https://pbs.twimg.com/profile_images/.../abc_normal.jpg"
}
}Error Responses
400 - Missing fields
{
"error": "Provide either image_url or image_base64"
}401 - Invalid auth_token
{
"error": "Invalid auth_token - could not extract userId"
}Example
# Via image URL
curl --request POST \
--header "Authorization: Bearer API_KEY" \
--header "Content-Type: application/json" \
--url "https://api.getxapi.com/twitter/user/update_avatar" \
--data '{ "auth_token": "<auth_token>", "image_url": "https://example.com/avatar.png" }'
# Via base64
curl --request POST \
--header "Authorization: Bearer API_KEY" \
--header "Content-Type: application/json" \
--url "https://api.getxapi.com/twitter/user/update_avatar" \
--data '{ "auth_token": "<auth_token>", "image_base64": "<base64-encoded-bytes>" }'User Affiliates
Get affiliated accounts of a verified Twitter/X organization via API. $0.001 per call, ~20 users per call. GetXAPI affiliates endpoint with pagination.
Update BannerNew
Update a Twitter user's profile banner programmatically via API. $0.001 per call. GetXAPI update banner endpoint with image URL or base64 upload.