PATCH https://xquik.com/api/v1/x/profile/avatar
This route updates one connected account’s avatar.
A request accepts a JPEG or PNG file. It can
also use a fetchable HTTPS image URL. The maximum image size is 95 MiB.
Xquik shrinks larger images under 700 KB for X. X
recommends a 400 × 400 pixel profile picture.
Update a Twitter profile picture through the API
CallPATCH /x/profile/avatar to replace the square profile image. Use
Update Banner for the header image.
Use Update Profile for names and other
public text fields. This route never retrieves another user’s avatar.10 credits per call · All plans from $0.00012/creditA write that must sign in to your X account first adds 10 credits. Xquik refunds them if the sign-in fails. A sign-in that works keeps them, even if X then refuses the write. See the X sign-in fee.
Prepare a Twitter avatar image
Choose one direct file or one fetchable HTTPS URL. Never send both sources. Accept only JPEG or PNG images. Reject GIF, WebP, and files above 95 MiB. Review the square crop before approval. Keep faces and important marks near the center. Use only images you own or may publish. Read X’s profile image guidance before uploading.Automate a profile picture update
Create one idempotency key for the selected account and image. Reuse it only after an exact network interruption. Generate a new key after changing the image or account. A 200 response is terminal. PollstatusUrl after 202 until
terminal becomes true. Never start another avatar update before that result.Verify the updated Twitter profile image
After a terminal write, use Twitter Profile Lookup. Open itsprofilePicture URL. Compare the rendered avatar with the approved source.
Review the public square crop. Keep the action ID and verification timestamp.
X may return a profile image URL like
https://pbs.twimg.com/profile_images/example.jpg.Fix X (Twitter) profile picture API errors
Fix invalid image fields after 400. Replace authentication after 401. Add credits after 402. Reconnect after 403. Connect a missing account after 404. Keep the original action after 409. Replace rejected media after 422. HonorRetry-After after 429. Check safeToRetry after 500 or 503.Twitter profile picture API questions
How do I authenticate an avatar update?
Send anx-api-key header or OAuth bearer token. The account field selects
the connected profile. Never place credentials inside an image URL.Can I update several Twitter profile pictures in one request?
No. Each request updates one connected account. Give each request its own idempotency key. Wait for each account’s terminal result.Can I use usernames or user IDs for avatar updates?
Yes. Setaccount to a connected username or numeric user ID. The selected
user’s profile receives the new image. Verify that identity before uploading.Can I update a Twitter profile image with Python or an SDK?
Yes. Call the REST API withimport requests, as shown above. Generated SDKs
can send the same multipart file, account, API key, and idempotency key.Does this route retrieve Twitter profile pictures?
No. It changes one connected account’s avatar. Use Twitter Profile Lookup to retrieve a publicprofilePicture URL.Headers
Body
Response
- 404 Account not found
Connect the requested account, then submit a newly approved write.
Durable write recovery
- Store
id, the nestedhashinrequest,billing, andstatusUrl. - Poll after
Retry-AfterorpollAfterMswhenterminalisfalse. - Retry only when
safeToRetryistrue. - Use a new key when
nextAction.requiresNewIdempotencyKeyistrue.
200 terminal or 202 active
- After HTTP
200, store the result and settled billing. - After HTTP
202, poll the same action. Never submit another write. - After HTTP
400, fix the named field. Use a new idempotency key. - After HTTP
401, fix authentication. Do not retry unchanged. - After HTTP
402, fund the account before another write. - After HTTP
403, reconnect the account. - After HTTP
409, keep the original action. Use a new key for new input. - After HTTP
422, fix the rejected request before retrying. - After HTTP
429, wait forRetry-After. FollownextAction.
Response examples
200 example
202 example
- 400
{ "error": "missing_idempotency_key", "message": "Idempotency-Key is required. Generate one unique key for this write.", "charged": false, "chargedCredits": "0", "retryable": false, "safeToRetry": true } - 401
{ "error": "unauthenticated", "message": "Authentication required. Provide a valid API key or bearer token." } - 402
{ "error": "insufficient_credits", "message": "Insufficient credits. Top up or subscribe to continue." } - 403
{ "error": "api_key_paused", "message": "This API key is paused. Resume it at dashboard.xquik.com/api-keys to use it again." } - 404
{ "error": "account_not_found", "message": "X account not found. Connect it first at /dashboard/x-accounts." } - 409
{ "error": "idempotency_conflict", "message": "Idempotency-Key was already used with a different request.", "charged": false, "chargedCredits": "0", "retryable": false, "safeToRetry": true } - 413
{ "error": "media_too_large", "message": "This image stays over X's size limit after shrinking. Send a smaller one." } - 415
{ "error": "unsupported_media_type", "message": "Xquik couldn't read this image. Send a valid image file." } - 422
{ "error": "x_rejected", "message": "X rejected this request. Check what you sent & the account on x.com before you try again." } - 429
{ "error": "rate_limit_exceeded", "message": "Too many requests. Try again later.", "retryAfter": 60 } - 500
{ "error": "x_write_failed", "message": "Write action failed unexpectedly. Contact support if this persists." } - 503
{ "error": "write_tracking_unavailable", "message": "Write tracking unavailable. Try again.", "charged": false, "chargedCredits": "0", "retryable": true, "safeToRetry": true }