X user profile
POST /api/x-userLook up one X (Twitter) account by username: id, display name, bio, account creation date, verification status and type, location, link, protected flag, and public metrics (followers, following, tweet count, listed count). Send POST /api/x-user with the required field username and pay $0.015 per call over x402 or MPP (there is no free tier). It returns a JSON object with source, fetchedAt and user.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
username | string | yes | X username, with or without the leading @ (1-15 chars). |
Example request
curl -i -X POST https://agent402.tools/api/x-user \
-H "Content-Type: application/json" \
-d '{"username":"coinbase"}'
Without payment this returns HTTP 402 Payment Required with the exact price for x-user; any x402 v2 or MPP client pays it and retries.
Example response
{
"source": "x-api-v2",
"fetchedAt": "2026-08-20T14:10:00.000Z",
"user": {
"id": "574032254",
"username": "coinbase",
"name": "Coinbase",
"description": "The future of money is here.",
"createdAt": "2012-05-07T23:46:41.000Z",
"verified": true,
"verifiedType": "business",
"location": "Global",
"url": "https://coinbase.com",
"protected": false,
"profileImageUrl": "https://pbs.twimg.com/profile_images/.../normal.jpg",
"metrics": {
"followers": 6400000,
"following": 250,
"tweets": 19000,
"listed": 9000
},
"profileUrl": "https://x.com/coinbase"
}
}
| Field | Type | Always present | In the example |
|---|---|---|---|
source | string | yes | x-api-v2 |
fetchedAt | string | yes | 2026-08-20T14:10:00.000Z |
user | object | yes | 13 fields: id, username, name, description, createdAt, verified |
From an MCP client
catalog.call {
"slug": "x-user",
"params": {
"username": "coinbase"
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for x-user; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
usernameis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement is cancelled when the tool fails. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
GETorHEADto /api/x-user returns the same 402 quote, so the price can be read without a body. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/x-user", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"username": "coinbase"
}),
});
Related tools
X recent tweet search
POST /api/x-search-recentSearch public tweets from the last 7 days on X (Twitter) by query, using X API v2 search operators (keywords, from:, #ha…
X tweet lookup
POST /api/x-tweetFetch one public tweet on X (Twitter) by id: text, created time, language, conversation id, engagement metrics (likes, r…
X user timeline
POST /api/x-user-tweetsFetch an X (Twitter) account's most recent tweets by user id or username (username is resolved first). Options to exclud…
X bulk user lookup
POST /api/x-users-lookupLook up up to 10 X (Twitter) accounts by username in one call. Returns each found profile with public metrics (followers…
Farcaster user search
POST /api/fc-user-searchSearch Farcaster users by name or username fragment. Returns up to 10 compact profiles: fid, username, display name, bio…
Farcaster user casts
POST /api/fc-user-castsA Farcaster user's recent casts by fid or username, newest first, optionally including replies or limited to one channel…