Get User By Username
twitter.get_user_by_username
ActionChat & messagingconnection required
Calls the X (Twitter) API with the connection's credentials.
Look one user up by @handle, which is how you turn a handle into an id.
Connection
- Required
- Yes — the node will not save without one
- Auth type
- Bearer token
- Providers
- X (Twitter)
- Secret shape
- the X OAuth2 user-context access token, or {"access_token": "…"}
- Resolved by
- config.connection_id, else node.connection_id
Configuration
4 fields, 1 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.
| Field | Type | Required | Default | Constraints | Example |
|---|---|---|---|---|---|
username The @handle, with or without the leading @. | string | Yes | — | — | XDevelopers |
user_fields Comma-separated User fields to include, e.g. created_at,description,public_metrics. Without this X returns only id, name and username. | string | No | — | — | — |
expansions Comma-separated expansions to resolve into 'includes', e.g. author_id,attachments.media_keys. | string | No | — | — | — |
post_fields Comma-separated Post fields to include, e.g. created_at,public_metrics,author_id. Without this X returns only id and text. | string | No | — | — | — |
Example configuration
Every value below is the contract’s own example or default — nothing invented.
{
"username": "XDevelopers"
}Output
One shape.
result
| Field | Type | Example |
|---|---|---|
id The user's numeric id. | string | — |
name The user's display name. | string | — |
username The @handle, without the @. | string | — |
user The full User object X returned, with every requested field. | object | — |
includes Objects pulled in by 'expansions' — users, media, polls, places. Empty when none asked for. | object | — |
{
"id": "",
"includes": {},
"name": "",
"user": {},
"username": ""
}Notes
- X API access is tiered and metered: most read endpoints need a paid plan, and since 6 February 2026 new developers get pay-per-use credits rather than a free tier. A 403 here usually means the plan, not the code.
- The connection's access token must already carry the scopes this node needs; X does not grant them per call, so a missing scope is a 401 on every run.
- Needs the OAuth2 scopes users.read, tweet.read.
See Get User By Username run in a workflow.
In a technical demo we add the X (Twitter) connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.