API Key
All Xshot API requests require an API key. You can pass it in three ways:Query String
Header
Bearer Token
WebSocket Authentication
For WebSocket connections, pass the API key as a query parameter:4001.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
How to authenticate with the Xshot API
curl "https://api.xshot.fun/twitter/user/info?username=elonmusk&api_key=YOUR_KEY"
curl -H "x-api-key: YOUR_KEY" "https://api.xshot.fun/twitter/user/info?username=elonmusk"
curl -H "Authorization: Bearer YOUR_KEY" "https://api.xshot.fun/twitter/user/info?username=elonmusk"
wss://api.xshot.fun/ws?api_key=YOUR_KEY
4001.
curl "https://api.xshot.fun/twitter/user/info?username=elonmusk"
{
"error": "Invalid or missing API key"
}
const API_KEY = "YOUR_KEY";
// Using query string
const res = await fetch(
`https://api.xshot.fun/twitter/user/info?username=elonmusk&api_key=${API_KEY}`
);
const user = await res.json();
console.log(user.followers_count); // 237614000
const res = await fetch(
"https://api.xshot.fun/twitter/user/info?username=elonmusk",
{ headers: { "x-api-key": "YOUR_KEY" } }
);
const user = await res.json();
import requests
# Using header
response = requests.get(
"https://api.xshot.fun/twitter/user/info",
params={"username": "elonmusk"},
headers={"x-api-key": "YOUR_KEY"}
)
user = response.json()
print(user["followers_count"]) # 237614000
import requests
response = requests.get(
"https://api.xshot.fun/twitter/user/info",
params={"username": "elonmusk", "api_key": "YOUR_KEY"}
)
user = response.json()
const ws = new WebSocket("wss://api.xshot.fun/ws?api_key=YOUR_KEY");
ws.onopen = () => {
console.log("Connected and authenticated");
};
ws.onclose = (event) => {
if (event.code === 4001) {
console.error("Authentication failed");
}
};