Python guide
Use any HTTP client with a Bearer API key. Examples below use requests. Base URL: https://www.xfluxapi.com/api/v1.
Setup
- Register and copy your
xflux_key pip install requests- Export
XFLUX_API_KEY(never commit secrets)
export XFLUX_API_KEY=xflux_YOUR_KEYAuthentication
import os
import requests
BASE = "https://www.xfluxapi.com/api/v1"
headers = {"Authorization": f"Bearer {os.environ['XFLUX_API_KEY']}"}
# or: headers = {"X-API-Key": os.environ["XFLUX_API_KEY"]}Get a user profile
r = requests.get(f"{BASE}/users/elonmusk", headers=headers, timeout=30)
r.raise_for_status()
user = r.json()["data"]
print(user["username"], user.get("followers_count"))User timeline
r = requests.get(
f"{BASE}/users/OpenAI/tweets",
headers=headers,
params={"limit": 10},
timeout=30,
)
r.raise_for_status()
for tweet in r.json()["data"]:
print(tweet["id"], (tweet.get("text") or "")[:100])Search
Operators like from: and lang: work as documented in Search operators.
r = requests.get(
f"{BASE}/search",
headers=headers,
params={"q": "fed rate", "limit": 20},
timeout=30,
)
r.raise_for_status()
print(len(r.json()["data"]), "hits")Tweet by ID
tweet_id = "1234567890"
r = requests.get(f"{BASE}/tweets/{tweet_id}", headers=headers, timeout=30)
r.raise_for_status()
print(r.json()["data"])Monitors & webhooks
Always-on account watches are configured in the Dashboard. Polling does not use REST quota. Live signed delivery needs Starter+. For agents, see MCP.Errors
Non-2xx responses include an error field. See Errors and Plans & Limits.