DEV Community

Cover image for Getting Started with XCROP API in 5 Minutes
XCROP
XCROP

Posted on Originally published at xcrop.io

Getting Started with XCROP API in 5 Minutes

Why XCROP?

XCROP is an X (formerly Twitter) data API built for crypto traders, researchers, and builders. It covers 58 endpoints, interaction verification, and credit-based pricing that's up to 50% cheaper than comparable third-party X APIs, so you get crypto social intelligence without the usual API tax

In this guide, you'll go from zero to your first API call in under 5 minutes

Step 1: Create Your Account

Head to the signup page and create your account. You'll get 5,000 free credits on the Starter plan, plenty to explore the API and test your integration

What You Get on Starter

  • 5,000 monthly credits
  • 60 requests per minute
  • Up to 1,000 results per call
  • Access to all endpoints

Step 2: Generate an API Key

After logging in, open the API Keys tab in the Dashboard and click Create New Key. Your API key will look like this:

xc_live_a1b2c3d4e5f6g7h8i9j0...
Enter fullscreen mode Exit fullscreen mode

Store this key securely, treat it like a password. Never commit it to version control or expose it in client-side code

Environment Variables

# .env
XCROP_API_KEY=xc_live_your_api_key_here
Enter fullscreen mode Exit fullscreen mode

Step 3: Make Your First Request

Let's fetch an X user's profile. Here's how in cURL, JavaScript, and Python:

cURL

curl -X GET "https://xcrop.io/api/v2/users/elonmusk" \
  -H "Authorization: Bearer xc_live_your_key"
Enter fullscreen mode Exit fullscreen mode

JavaScript

const response = await fetch("https://xcrop.io/api/v2/users/elonmusk", {
  headers: {
    "Authorization": "Bearer " + process.env.XCROP_API_KEY
  }
});

const result = await response.json();
console.log(result.data.name);      // "Elon Musk"
console.log(result.data.followers);  // 200000000+
Enter fullscreen mode Exit fullscreen mode

Python

import requests
import os

response = requests.get(
    "https://xcrop.io/api/v2/users/elonmusk",
    headers={"Authorization": "Bearer " + os.environ["XCROP_API_KEY"]}
)

user = response.json()["data"]
print(user["name"])       # Elon Musk
print(user["followers"])  # 200000000+
Enter fullscreen mode Exit fullscreen mode

Step 4: Understanding Response Structure

Every XCROP response follows a consistent format:

{
  "data": { ... },
  "meta": {
    "total": 20,
    "next_cursor": "abc123...",
    "has_next_page": true,
    "latency_ms": 245
  }
}
Enter fullscreen mode Exit fullscreen mode
  • data: the actual payload (object or array depending on endpoint)
  • meta.total: number of results returned
  • meta.next_cursor: pagination cursor for fetching the next page
  • meta.has_next_page: whether more results are available

Pagination

For list endpoints (tweets, followers, etc.), use the next_cursor to page through results:

import requests
import os

url = "https://xcrop.io/api/v2/users/elonmusk/tweets"
headers = {"Authorization": "Bearer " + os.environ["XCROP_API_KEY"]}
all_tweets = []
cursor = None

for page in range(3):  # Fetch 3 pages
    params = {"count": 20}
    if cursor:
        params["cursor"] = cursor

    response = requests.get(url, headers=headers, params=params)
    result = response.json()

    all_tweets.extend(result["data"])
    cursor = result["meta"].get("next_cursor")

    if not cursor:
        break

print("Total tweets fetched: " + str(len(all_tweets)))
Enter fullscreen mode Exit fullscreen mode

Step 5: Monitor Your Usage

Check your credit consumption in the Dashboard (Usage tab). Each response also carries headers you can use for pacing:

  • X-RateLimit-Remaining: requests left in the current minute window
  • X-Response-Time: how long the request took
  • X-MaxResults-Allowed: the most results one request can return (1,000 on every plan)

Credit Costs at a Glance

Endpoint Credits
User profile 18 per profile
Batch user lookup (POST /users/batch) 1 per user returned (10 per call minimum)
Tweet / search result 15 per result
Follower / following 1 per result
Trending topics 100 per call (flat)
Write operations 100 per operation (flat)
Minimum per call 10 credits

Tips for Success

  1. Use environment variables: never hardcode API keys in source code
  2. Handle rate limits: check for 429 status and implement exponential backoff
  3. Cache responses: don't re-fetch data that hasn't changed
  4. Use batch endpoints: look up 100 users or tweets in a single call
  5. Try the Endpoints: test any endpoint interactively before writing code

What's Next?

Now that you're set up, explore these topics:

  • KOL Tracking: monitor crypto influencers in real-time
  • Trending Topics: spot emerging narratives before they peak
  • Search: find any tweet or user with powerful filters
  • Write API: automate posting to X via your connected account

Originally published on the XCROP blog.

Top comments (0)