Getting started with the Quote Tweets lookup endpoint
This quick start guide will help you make your first request to the Quote Tweets lookup endpoints with a set of specified fields using Postman. If you would like to see sample code in different languages, please visit our X API v2 sample code GitHub repository.Prerequisites
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:- Sign up for a developer account and receive approval.
- Create a Project and an associated developer App in the developer portal.
- Navigate to your App’s “Keys and tokens” page to generate the required credentials. Make sure to save all credentials in a secure location.
Step four: Identify and specify which fields you would like to retrieve
If you click the “Send” button after step three, you will receive the default Post object fields in your response: id, text, and edit_history_tweet_ids.
If you would like to receive additional fields, you will have to specify those fields in your request with the field and/or expansion parameters.
For this exercise, we will request three additional different sets of fields from different objects:
- The additional tweet.created_at field in the primary user objects.
- The associated authors’ user object’s default fields for the returned Posts: id, name, and username
- The additional user.created_at field in the associated user objects.
You should now see the following URL next to the “Send” button:
https://api.x.com/2/tweets/:id/quote_tweets?expansions=author_id&tweet.fields=created_at&user.fields=created_at
Please note:
In Postman, the path parameter :id in the URL field will not automatically update to the value that you enter into the id params field, which is why the above URL includes :id and not 1409931481552543749.
Step five: Make your request and review your response
Once you have everything set up, hit the “Send” button and you will receive the following response:
Step six: Paginate through your results
In the previous response, you will find a meta data object at the bottom that includes the following fields:- results_count
- next_token
Once this is all set up, you can click “Send” again and you should receive the next page of results.
We have put together a guide on pagination to further explain this concept.