Skip to content
Docs

Rebrand An X Account

Turn an X account into another brand with the API alone: clear its posts, replies and reposts, then change its pictures, name, bio and handle.

Early access. Tell us what you're building and we'll set you up. Contact us

Every step below is one of the X API's own routes, so a rebrand needs nothing else. The example turns @janedemo into LAUNCH WIRE (@launchwire).

A verified account loses its checkmark. On a verified (blue check) account, a new name, avatar or handle removes the checkmark until X reviews the account again. X asks to confirm that at Save, and Lempile confirms it: the edit is what you asked for. Expect the check to be gone right after the edit, and to come back only once X has reviewed the account.

1. Read The Profile First#

Keep what it was, in case you want it back:

Shell
curl -sS "https://api.lempile.com/users/me?account_id=janedemo" -H "X-API-KEY: $LEMPILE_API_KEY"

The answer has name, username, bio, location, website, profile_picture_url, cover_picture_url and can_change_username (Read The Profile). If can_change_username is false, X won't take a new handle yet (see the notes at the end): change the rest now and the handle later.

2. List What It Posted#

GET /users/me/posts?account_id=&kind=&limit=&cursor= (accounts.read) lists the account's own posts, replies or reposts from its profile's tabs, newest first (The Account's Own Posts):

Shell
curl -sS "https://api.lempile.com/users/me/posts?account_id=janedemo&kind=posts&limit=100" -H "X-API-KEY: $LEMPILE_API_KEY"
JSON
{ "object": "OwnPostList", "provider": "X", "account_id": "11111111-1111-4111-8111-111111111111", "kind": "posts",
  "items": [{ "object": "OwnPost", "id": "1850000000000000001", "kind": "post", "text": "Shipping today.",
    "created_at": "2026-11-06T09:12:00.000Z", "pinned": true }],
  "cursor": null }

kind is posts (the default), replies or reposts. A reply carries in_reply_to (the post it answers), a repost reposted_id (the post it reposted). cursor is null at the end; otherwise pass it back for the next page.

3. Delete Its Posts And Replies#

Delete each post (kind=posts) and each reply (kind=replies), then list again until the list comes back empty:

Shell
curl -sS -X DELETE "https://api.lempile.com/posts/1850000000000000001?account_id=janedemo" -H "X-API-KEY: $LEMPILE_API_KEY"

DELETE /posts/{post_id} deletes only the account's own posts and replies, and answers once the post is gone (PostDeleted). A post already gone answers 404 errors/post_not_found: nothing to do. Deleting the pinned post removes the pin too. Listing again from the top after each batch is simplest; a cursor whose post you deleted still works.

4. Undo Its Reposts#

List them with kind=reposts, then take each one back with POST /posts/repost and undo: true (Undo A Repost). Give it the item's reposted_id, the post the account reposted:

Shell
curl -sS "https://api.lempile.com/users/me/posts?account_id=janedemo&kind=reposts&limit=100" -H "X-API-KEY: $LEMPILE_API_KEY"
curl -sS -X POST "https://api.lempile.com/posts/repost" \
  -H "X-API-KEY: $LEMPILE_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: unrepost-janedemo-1700000000000000009" \
  -d '{ "account_id": "janedemo", "post_id": "1700000000000000009", "undo": true }'

List again until kind=reposts comes back empty. A post the account hasn't reposted answers already: true with nothing pressed, so undoing one twice does no harm.

5. Try The Edit#

The same edit with dry_run: true opens every window, reads it, and presses nothing:

Shell
curl -sS -X PATCH "https://api.lempile.com/users/me/edit" \
  -H "X-API-KEY: $LEMPILE_API_KEY" \
  -F account_id=janedemo -F dry_run=true \
  -F name="LAUNCH WIRE" -F bio="Every launch worth knowing, as it ships." -F location="" \
  -F website="https://launchwire.example" -F avatar=@avatar.png -F banner=@header.jpg \
  -F username=launchwire
JSON
{ "object": "ProfileEditDryRun", "provider": "X", "not_sent": true,
  "current": { "name": "Jane Demo", "bio": "Building in public.", "location": "Lisbon",
    "website": "https://janedemo.example", "avatar": "https://pbs.twimg.com/profile_images/1/old.jpg",
    "banner": "https://pbs.twimg.com/profile_banners/9/1690000000", "username": "janedemo" },
  "would_change": { "name": "LAUNCH WIRE", "bio": "Every launch worth knowing, as it ships.", "location": "",
    "website": "https://launchwire.example", "avatar": "new picture", "banner": "new picture", "username": "launchwire" },
  "already": [],
  "checks": { "save_button": true, "photo_inputs": { "inputs": 2, "banner": true, "avatar": true },
    "username_field": true, "password_required": false } }

Every field and picture is checked before the browser opens (400 for one X wouldn't take). In checks, username_field: false or password_required: true means the handle won't change: see the notes.

6. Make The Edit#

The same call without dry_run, with an Idempotency-Key. Pictures and a handle can take a few minutes: the request waits 140 seconds, then answers 504 errors/timeout while the browser goes on. Then read the receipt until it's done or failed:

Shell
curl -sS "https://api.lempile.com/writes/rebrand-janedemo-1" -H "X-API-KEY: $LEMPILE_API_KEY"

Done, the answer (in the request or in the receipt's response) is ProfileEdited with changed (what X keeps now), previous and already (Edit The Profile). Lempile's own record of the account takes the new handle in the same step: from then on use the account's Lempile id (or launchwire) as account_id; janedemo no longer finds it.

A failure on the handle after the rest was saved (409 errors/username_taken, say) carries done: what X keeps from the Edit profile part. Send the edit again with another handle (and another key): the fields already as asked are left alone.

7. Read It Back#

Shell
curl -sS "https://api.lempile.com/users/me?account_id=launchwire" -H "X-API-KEY: $LEMPILE_API_KEY"

The answer shows the profile as X serves it now. Then post the new brand's first post and pin it (POST /accounts/{account_id}/posts/{status_id}/pin).

Notes#

  • The checkmark. A verified account's checkmark goes as soon as the name, avatar or handle changes, until X reviews the account again (see the top of this page).
  • A handle X won't change yet. While an X Premium check is under review, X's Change username page shows no Username field: the edit answers 422 errors/username_field_not_found and GET /users/me says can_change_username: false. Change the rest now and the handle once the review is over.
  • A handle someone has. A handle is only free once the account that had it has let it go (changed it or been deleted): until then X says it's taken (409 errors/username_taken), and nothing changes for the handle.
  • A password X asks for. If X asks for the account's password to change the handle, the answer is 403 errors/password_required: Lempile never types a password there. Change the handle on X yourself, in the account's browser.
  • Pictures must be JPEG or PNG (at most 2 MB for the avatar, 5 MB for the header photo). X shows them through its own crop window, applied as is: crop them before you send them (400 × 400 for the avatar, 1500 × 500 for the header).

Was this page helpful?