To get fields on related objects (like the author of a post), you need two things:
An expansion to include the related object
The fields parameter for that object type
Copy
Ask AI
# Get post with author detailscurl "https://api.x.com/2/tweets/1234567890?expansions=author_id&user.fields=description,public_metrics" \ -H "Authorization: Bearer $TOKEN"
Response:
Copy
Ask AI
{ "data": { "id": "1234567890", "text": "Hello world!", "author_id": "2244994945" }, "includes": { "users": [{ "id": "2244994945", "name": "X Developers", "username": "xdevelopers", "description": "The voice of the X Developer Platform", "public_metrics": { "followers_count": 570842, "following_count": 2048 } }] }}
You cannot request subfields. When you request public_metrics, you get all metrics (likes, reposts, replies, quotes). You can’t request just public_metrics.like_count.
Field order in responses may differ from request order
Missing fields in responses mean the value is null or empty
Some fields require specific authentication (e.g., private metrics need user context)
Check each endpoint’s API reference for available fields