Resolve an account by username and select the profile fields to return.
Twitter API
Twitter API: user lookup, timelines, and pagination
Integrate RequestBeam Twitter / X endpoints with Bearer authentication, user and tweet field selection, cursor pagination, and validation-error handling.
Resolve a username to a user ID, fetch that user's timeline, and pass the returned next token to request another page. Successful calls return JSON directly; there is no Jobs polling step for these endpoints.
Built for a specific job
Implement the three supported GET operations and handle their results.
Refresh a known account by user ID without another username lookup.
Retrieve timeline pages with a page-size limit and a pagination token.
Billing unit
Know how usage is measured
USD per request.
Operational limits
- Returned fields depend on the documented query parameters and upstream response.
- max_results must be an integer from 1 to 100. A page may contain fewer results.
- Keep user IDs and tweet IDs as strings to avoid numeric precision loss.
Integration guides
Choose your next step
Current catalog coverage
Available APIs and billing units
Compare API IDs, operations, providers, protocols, and prices. Check the catalog date and each operation's billing unit before estimating usage costs.
Data API
Twitter User Data
twitter-user-data Retrieve public Twitter / X user profiles and user timelines.
- Provider
- Twitter / X Data
- Catalog protocol
- REST
- Billing unit
- request
-
GET /v1/twitter/usersGet user by username -
GET /v1/twitter/users/{id}Get user by ID -
GET /v1/twitter/users/{id}/tweetsGet user tweets
Our price
- Request
- $0.0020 /request
Get user by username
GET /v1/twitter/users Our price
- Request
- $0.0020 /request
Get user by ID
GET /v1/twitter/users/{id} Our price
- Request
- $0.0020 /request
Get user tweets
GET /v1/twitter/users/{id}/tweets Our price
- Request
- $0.0020 /request
Request example
Start from the documented operation
curl "https://api.requestbeam.com/v1/twitter/users?username=OpenAI&user.fields=description,public_metrics" \
-H "Authorization: Bearer <API_KEY>"const response = await fetch("https://api.requestbeam.com/v1/twitter/users?username=OpenAI&user.fields=description,public_metrics", {
headers: { Authorization: "Bearer <API_KEY>" }
});
const data = await response.json();
console.log(data);import requests
url = "https://api.requestbeam.com/v1/twitter/users?username=OpenAI&user.fields=description,public_metrics"
headers = {"Authorization": "Bearer <API_KEY>"}
response = requests.get(url, headers=headers, timeout=60)
response.raise_for_status()
print(response.json()) Use the API base URL from your account documentation and replace the example placeholders. Send your API key in the Authorization header; never include it in a URL or committed file.
Endpoints
Three operations for accounts and timelines
GET /v1/twitter/users?username=<USERNAME> Read the returned data.id as a string for subsequent requests.
GET /v1/twitter/users/<USER_ID> Retrieve a known account and optionally select its profile fields.
GET /v1/twitter/users/<USER_ID>/tweets Set max_results and pass pagination_token for subsequent pages.
Query parameters
Select fields and paginate a timeline
- Account lookup
usernameis required on/v1/twitter/users. Both lookup endpoints accept a comma-separateduser.fieldslist, such asdescription,public_metrics.- Page size
max_resultsaccepts integers from 1 to 100. It is an upper bound on the page size, not a guarantee of that many posts.- Timeline fields
- Use
tweet.fields=created_at,public_metricsfor timestamps and metrics. Requestexpansions=author_idwithuser.fieldswhen you need available author details. Useexclude=replies,retweetsto exclude those post types. - Next page
- Pass
meta.next_tokenfrom the response aspagination_tokenon the next request. Treat the token as opaque and URL-encode it. Stop when no next token is returned, your page budget is reached, or a token repeats.
Response handling
Read JSON results directly
User lookups return the account in data. Timeline responses contain a data array and meta.result_count, with meta.next_token when another cursor is available. Author expansions may appear in includes.users.
{
"data": [],
"meta": {
"result_count": 0
}
} Illustrative empty timeline response, not a live account result. Optional fields and cursors may be absent. An empty page is not evidence that an account has never posted.
Validation errors
Correct invalid parameters before retrying
A missing username or an out-of-range max_results returns HTTP 400 with success: false, error.code: 10001, an error.message, and a requestId. Inspect the message and correct the request rather than retrying it unchanged.
Request tracing
Keep a request ID, not a credential
Retain the X-Request-Id response header for support and request tracing. Check HTTP status before reading a success payload, and keep API keys and unnecessary profile data out of application logs.