Twitter API Endpoints
The Twitter API endpoints allow you to access Twitter user data for integration into your applications. Here you'll find all available endpoints, request parameters, and response formats.
Base URL
All Twitter API endpoints use the following base URL:
Available Endpoints
Get User Details
Retrieve detailed information about a Twitter user.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | Twitter username without @ symbol |
Code Example
// JavaScript example
const getUserDetails = async (username) => {
try {
const response = await fetch(`https://dev-api.scraper.lol/api/twitter/${username}/details`, {
headers: {
'X-API-Key': 'your_api_key'
}
});
return response.json();
} catch (error) {
console.error('Error fetching Twitter user details:', error);
}
};
Response
{
"username": "elonmusk",
"displayName": "Elon Musk",
"followers_count": 158900000,
"following_count": 1500,
"tweet_count": 25000,
"profile_image_url": "https://pbs.twimg.com/profile_images/123456789/elon_400x400.jpg",
"description": "Technoking of Tesla, CEO of SpaceX",
"created_at": "2009-06-02T20:12:29.000Z",
"verified": true
}
Get User Tweets
Retrieve the latest tweets for a Twitter user with optional filtering and pagination.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | Twitter username without @ symbol |
| days | number | No | Number of days to filter tweets (1-14, default: 3) |
| page | number | No | Page number for pagination (0-based, default: 0) |
| limit | number | No | Number of tweets per page (1-100, default: 50) |
Code Example
// JavaScript example with pagination
const getUserTweets = async (username, days = 3, page = 0, limit = 50) => {
try {
const params = new URLSearchParams({
days: days.toString(),
page: page.toString(),
limit: limit.toString()
});
const response = await fetch(`https://dev-api.scraper.lol/api/twitter/${username}/tweets?${params}`, {
headers: {
'X-API-Key': 'your_api_key'
}
});
return response.json();
} catch (error) {
console.error('Error fetching tweets:', error);
}
};
Response
{
"username": "elonmusk",
"tweets": {
"1449099963531608064": {
"created_at": "2021-10-15T19:48:48.000Z",
"metrics": [
{
"likes": 78,
"replies": 6,
"retweets": 10,
"timestamp": "2025-04-23T17:01:08.390353",
"views": 0
}
],
"text": "@aeger08 @BabyApesNFT WAWAWA!! \nmissed mint, sniped perfect two! https://t.co/jD3FaToVzz",
"timestamp": "2021-10-15T19:48:48.000Z",
"url": "https://x.com/chanchaneeNFT/status/1449099963531608064"
}
},
"filter_days": 3,
"pagination": {
"page": 0,
"limit": 50,
"total": 125,
"page_count": 3,
"has_more": true
}
}
Get User Followers
Retrieve the follower count and follower growth metrics for a Twitter user with optional filtering and pagination.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | Twitter username without @ symbol |
| days | number | No | Number of days to filter metrics (1-14, default: 3) |
| page | number | No | Page number for pagination (0-based, default: 0) |
| limit | number | No | Number of metrics per page (1-100, default: 50) |
Code Example
// JavaScript example with filtering and pagination
const getUserFollowers = async (username, days = 7, page = 0, limit = 20) => {
try {
const params = new URLSearchParams({
days: days.toString(),
page: page.toString(),
limit: limit.toString()
});
const response = await fetch(`https://dev-api.scraper.lol/api/twitter/${username}/followers?${params}`, {
headers: {
'X-API-Key': 'your_api_key'
}
});
return response.json();
} catch (error) {
console.error('Error fetching followers:', error);
}
};
Response
{
"username": "elonmusk",
"followers": {
"USER": {
"metrics": [
{
"followers": 158900000,
"change": 100000,
"timestamp": "2024-03-01T12:00:00.000Z"
},
{
"followers": 158800000,
"change": 50000,
"timestamp": "2024-02-29T12:00:00.000Z"
}
]
}
},
"filter_days": 7,
"pagination": {
"page": 0,
"limit": 20,
"total": 45,
"page_count": 3,
"has_more": true
}
}
Get Tweet Details
Retrieve detailed metrics for a specific tweet.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | Twitter username without @ symbol |
| tweet_id | string | Yes | Unique identifier of the tweet |
Code Example
// JavaScript example
const getTweetDetails = async (username, tweetId) => {
try {
const response = await fetch(`https://dev-api.scraper.lol/api/twitter/${username}/tweet/${tweetId}`, {
headers: {
'X-API-Key': 'your_api_key'
}
});
return response.json();
} catch (error) {
console.error('Error fetching tweet details:', error);
}
};
Response
{
"username": "elonmusk",
"tweet_id": "1234567890",
"tweet": {
"id": "1234567890",
"text": "To the moon! 🚀",
"created_at": "2024-03-01T12:00:00.000Z",
"metrics": {
"impressions": 1500000,
"likes": 50000,
"retweets": 10000,
"replies": 5000,
"quotes": 2000
},
"history": [
{
"timestamp": "2024-03-01T13:00:00.000Z",
"impressions": 1000000,
"likes": 30000,
"retweets": 8000
}
]
}
}
Creator Management
Add Creator
Add a new creator to the monitoring list.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| creator | string | Yes | Twitter username without @ symbol |
| platform | string | Yes | Platform type (currently only 'twitter') |
Code Example
// JavaScript example
const addCreator = async (username) => {
try {
const response = await fetch('https://dev-api.scraper.lol/api/creators', {
method: 'PATCH',
headers: {
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
creator: username,
platform: 'twitter'
})
});
return response.json();
} catch (error) {
console.error('Error adding creator:', error);
}
};
Success Response (201)
{
"message": "Creator 'elonmusk' added successfully",
"creator": "elonmusk",
"platform": "twitter",
"total_creators": 25
}
Remove Creator
Remove a creator from the monitoring list.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| creator | string | Yes | Twitter username without @ symbol |
| platform | string | Yes | Platform type (currently only 'twitter') |
Code Example
// JavaScript example
const removeCreator = async (username) => {
try {
const response = await fetch('https://dev-api.scraper.lol/api/creators', {
method: 'DELETE',
headers: {
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
creator: username,
platform: 'twitter'
})
});
return response.json();
} catch (error) {
console.error('Error removing creator:', error);
}
};
Success Response (200)
{
"message": "Creator 'elonmusk' removed successfully",
"creator": "elonmusk",
"platform": "twitter",
"total_creators": 24
}
Error Handling
User Not Found Error
Tweet Not Found Error
Creator Already Exists Error
Creator Not Found Error
Invalid Pagination Parameters
Page Out of Range Error
Credits & Rate Limiting
Each Twitter API request costs 1 credit. Ensure your account has sufficient credits before making requests.