Get an X profile with Python, Node.js and cURL

Look up one X account by username: its name, follower count and the day it joined.

It is one call to GET /v1/x/users/{user}, which costs 1 credit a request, plus 2 per profile. Every snippet below ran against the live API on 27 October 2026, and the output is what the Python printed.

Set your key first. Create one at https://weirapp.io/dashboard/keys; every account gets 5,000 free credits a month.

export WEIR_API_KEY=weir_live_...

Python

import os

import requests

response = requests.get(
    "https://api.weirapp.io/v1/x/users/NASA",
    headers={"Authorization": f"Bearer {os.environ['WEIR_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
page = response.json()

user = page["data"]
print(user["name"], user["followersCount"], user["createdAt"])
print("credits charged:", response.headers["X-Credits-Charged"])

Node.js

// Node.js 18 or later, as an ES module (save as example.mjs).
const response = await fetch("https://api.weirapp.io/v1/x/users/NASA", {
  headers: { Authorization: `Bearer ${process.env.WEIR_API_KEY}` },
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const page = await response.json();

const user = page.data;
console.log(user.name, user.followersCount, user.createdAt);
console.log("credits charged:", response.headers.get("x-credits-charged"));

cURL

curl --request GET \
  --url 'https://api.weirapp.io/v1/x/users/NASA' \
  --header "Authorization: Bearer $WEIR_API_KEY"

Output

NASA 92311249 2007-12-19T20:20:32.000Z
credits charged: 3

If a call fails

Failed calls are free. A 429 means too many requests a minute: wait the seconds in Retry-After and send it again. A 402 means the account is out of credits. A 503 means the source is busy and is safe to retry. Every code is on Errors, and paging is on Pagination.

View this page as Markdown