GetXAPI
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_avatar

This 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

ParameterTypeRequiredDescription
auth_tokenstringYesUser's auth_token cookie
image_urlstringConditionalPublic URL to fetch the image from. Required if image_base64 is not provided.
image_base64stringConditionalRaw base64 (with or without data:image/...;base64, prefix). Required if image_url is not provided.

Notes

  • Recommended size: 400×400. Supported formats: JPG, PNG.
  • Provide exactly one of image_url or image_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>" }'

On this page