# Twitter User Lookup

Blocks for looking up Twitter/X user profiles and information.

## Twitter Get User

### What it is

This block retrieves information about a specified Twitter user.

### How it works

This block queries the Twitter API v2 to retrieve detailed information about a single user. You can look up users either by their unique Twitter ID or by their username (handle). The block uses Tweepy with OAuth 2.0 authentication.

Optional expansions allow you to include additional data such as the user's pinned tweet. The response includes profile information like display name, bio, follower count, and profile image URL based on the user\_fields selected.

### Inputs

| Input         | Description                                                                                                                                 | Type                  | Required |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | -------- |
| expansions    | Choose what extra information you want to get with user data. Currently only 'pinned\_tweet\_id' is available to see a user's pinned tweet. | UserExpansionsFilter  | No       |
| tweet\_fields | Select what tweet information you want to see in pinned tweets. This only works if you select 'pinned\_tweet\_id' in expansions above.      | TweetFieldsFilter     | No       |
| user\_fields  | Select what user information you want to see, like username, bio, profile picture, etc.                                                     | TweetUserFieldsFilter | No       |
| identifier    | Choose whether to identify the user by their unique Twitter ID or by their username                                                         | Identifier            | Yes      |

### Outputs

| Output     | Description                              | Type            |
| ---------- | ---------------------------------------- | --------------- |
| error      | Error message if the operation failed    | str             |
| id         | User ID                                  | str             |
| username\_ | User username                            | str             |
| name\_     | User name                                | str             |
| data       | Complete user data                       | Dict\[str, Any] |
| included   | Additional data requested via expansions | Dict\[str, Any] |

### Possible use case

**Profile Verification**: Look up a user's profile to verify their identity or check their account details before engaging.

**User Research**: Gather information about a specific account for competitive analysis or influencer research.

**Account Validation**: Verify that a username or user ID exists and is active before performing other operations.

***

## Twitter Get Users

### What it is

This block retrieves information about multiple Twitter users.

### How it works

This block queries the Twitter API v2 to retrieve detailed information about multiple users in a single request. You can look up users by their Twitter IDs or usernames (handles), making it efficient for batch operations.

The block uses Tweepy with OAuth 2.0 authentication and supports expansions for additional data like pinned tweets. Returns arrays of user IDs, usernames, display names, and complete user data objects.

### Inputs

| Input         | Description                                                                                                                                 | Type                  | Required |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | -------- |
| expansions    | Choose what extra information you want to get with user data. Currently only 'pinned\_tweet\_id' is available to see a user's pinned tweet. | UserExpansionsFilter  | No       |
| tweet\_fields | Select what tweet information you want to see in pinned tweets. This only works if you select 'pinned\_tweet\_id' in expansions above.      | TweetFieldsFilter     | No       |
| user\_fields  | Select what user information you want to see, like username, bio, profile picture, etc.                                                     | TweetUserFieldsFilter | No       |
| identifier    | Choose whether to identify users by their unique Twitter IDs or by their usernames                                                          | Identifier            | Yes      |

### Outputs

| Output      | Description                              | Type                   |
| ----------- | ---------------------------------------- | ---------------------- |
| error       | Error message if the operation failed    | str                    |
| ids         | User IDs                                 | List\[str]             |
| usernames\_ | User usernames                           | List\[str]             |
| names\_     | User names                               | List\[str]             |
| data        | Complete users data                      | List\[Dict\[str, Any]] |
| included    | Additional data requested via expansions | Dict\[str, Any]        |

### Possible use case

**Batch Profile Lookup**: Retrieve profile information for a list of users at once, such as all participants in a conversation.

**Influencer Analysis**: Gather profile data for multiple influencers in a specific niche for comparison.

**Follow List Enrichment**: Get detailed information about accounts in your following or followers list.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://agpt.co/docs/integrations/block-integrations/user_lookup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
