This quick start guide will help you make your first request to the List Posts lookup endpoint using Postman.
Please visit our X API v2 sample code GitHub repository if you want to see sample code in different languages.
To complete this guide, you will need to have a set of keys and tokens to authenticate your request. You can generate these keys and tokens by following these steps:
There are several different tools, code examples, and libraries that you can use to make a request to this endpoint, but we will use the Postman tool here to simplify the process.
To load the X API v2 Postman collection into your environment, please click on the following button:
Once you have the X API v2 collection loaded in Postman, navigate to the “List” folder, select another folder “List Posts”, and then choose “List Posts lookup”.
To properly make a request to the X API, you need to verify that you have permission. To do this with this endpoint, you must authenticate your request with either App only, OAuth 2.0 Authorization Code with PKCE, or OAuth 1.0a User Context authentication methods.
For simplicity’s sake, we are going to utilize App only with this request, but if you’d like to request private metrics or Posts, you will need to use one of the other authentication methods.
To utilize App only, you must add your keys and tokens (specifically theApp only Access Token, also known as the App only Bearer Token) to Postman by selecting the environment named “X API v2” (in the top-right corner of Postman), and adding your keys and tokens to the “initial value” and “current value” fields (by clicking the eye icon next to the environment dropdown).
If you’ve done this correctly, these variables will automatically be pulled into the request’s authorization tab.
You must specify a List that you would like to receive within the request. You can find the List ID by navigating to x.com and clicking on a List and then looking in the URL. For example, the following URL’s List ID is 84839422.
https://x.com/i/lists/84839422
The target ID can be any valid List ID. In Postman, navigate to the “Params” tab, and enter your ID into the “Value” column of the id path variable. Be sure not to include any spaces before or after any ID.
Key | Value |
id | 84839422 (The List ID) |
If you click the “Send” button after step three, you will receive the default Post object fields in your response: idand text.
If you would like to receive additional fields, you will have to specify those fields in your request with tweet.fields and/or expansion parameters.
For this exercise, we will request three additional sets of fields from different objects:
The additional created_at field in the primary Lists object.
The full user object using the expansion parameter
The additional user.created_at field in the associated user object.
In Postman, navigate to the “Params” tab and add the following key:value pair to the “Query Params” table:
Key | Value | Returned fields |
tweet.fields | created_at | created_at |
expansions | author_id | includes.users.id, includes.users.name, includes.users.username |
user.fields | created_at | includes.users.created_at |
You should now see a similar URL next to the “Send” button:
https://api.x.com/2/lists/84839422/tweets?expansions=author_id&user.fields=created_at&max_results=1
Once you have everything set up, hit the “Send” button, and you will receive a similar response to the following example response:
Please note: The response of this endpoint will support querying the latest 800 Posts for a given List
This quick start guide will help you make your first request to the List Posts lookup endpoint using Postman.
Please visit our X API v2 sample code GitHub repository if you want to see sample code in different languages.
To complete this guide, you will need to have a set of keys and tokens to authenticate your request. You can generate these keys and tokens by following these steps:
There are several different tools, code examples, and libraries that you can use to make a request to this endpoint, but we will use the Postman tool here to simplify the process.
To load the X API v2 Postman collection into your environment, please click on the following button:
Once you have the X API v2 collection loaded in Postman, navigate to the “List” folder, select another folder “List Posts”, and then choose “List Posts lookup”.
To properly make a request to the X API, you need to verify that you have permission. To do this with this endpoint, you must authenticate your request with either App only, OAuth 2.0 Authorization Code with PKCE, or OAuth 1.0a User Context authentication methods.
For simplicity’s sake, we are going to utilize App only with this request, but if you’d like to request private metrics or Posts, you will need to use one of the other authentication methods.
To utilize App only, you must add your keys and tokens (specifically theApp only Access Token, also known as the App only Bearer Token) to Postman by selecting the environment named “X API v2” (in the top-right corner of Postman), and adding your keys and tokens to the “initial value” and “current value” fields (by clicking the eye icon next to the environment dropdown).
If you’ve done this correctly, these variables will automatically be pulled into the request’s authorization tab.
You must specify a List that you would like to receive within the request. You can find the List ID by navigating to x.com and clicking on a List and then looking in the URL. For example, the following URL’s List ID is 84839422.
https://x.com/i/lists/84839422
The target ID can be any valid List ID. In Postman, navigate to the “Params” tab, and enter your ID into the “Value” column of the id path variable. Be sure not to include any spaces before or after any ID.
Key | Value |
id | 84839422 (The List ID) |
If you click the “Send” button after step three, you will receive the default Post object fields in your response: idand text.
If you would like to receive additional fields, you will have to specify those fields in your request with tweet.fields and/or expansion parameters.
For this exercise, we will request three additional sets of fields from different objects:
The additional created_at field in the primary Lists object.
The full user object using the expansion parameter
The additional user.created_at field in the associated user object.
In Postman, navigate to the “Params” tab and add the following key:value pair to the “Query Params” table:
Key | Value | Returned fields |
tweet.fields | created_at | created_at |
expansions | author_id | includes.users.id, includes.users.name, includes.users.username |
user.fields | created_at | includes.users.created_at |
You should now see a similar URL next to the “Send” button:
https://api.x.com/2/lists/84839422/tweets?expansions=author_id&user.fields=created_at&max_results=1
Once you have everything set up, hit the “Send” button, and you will receive a similar response to the following example response:
Please note: The response of this endpoint will support querying the latest 800 Posts for a given List