Introduction
The Search Posts endpoints in the v2 world enable you to receive Posts related to topics of interest, based on a search query that you produce. We have two different endpoints available with v2 Search Posts: recent search, which is available to all developers with an approved account and can search for Posts up to seven days old, and full-archive search, which is only available to researchers approved for the Academic Research product track, and can search through the entire archive of Posts dating back to March 2006. You can see our full search offering on our search overview page. These Search Posts endpoints address one of the most common use cases for academic researchers, who might use this for longitudinal studies, or analyzing a past topic or event. This tutorial provides a step-by-step guide for researchers who wish to use the full-archive search endpoint to search the complete history of public X data. It will also demonstrate the different ways to build a dataset, such as by retrieving geo-tagged Posts, and how to page through the available Posts for a query.Prerequisites
Currently, this endpoint is only available as part of the Academic Research product track. In order to use this endpoint, you must apply for access. Learn more about the application and requirements for this track.Connect an app to the academic project
Once you are approved to use the Academic Research product track, you will see your Academic Project in the developer portal. From the “Projects and Apps” section, click on “Add App” to connect your X App to the Project.



Connecting to the full-archive search endpoint
The cURL command below shows how you can get historical Posts from @XDevelopers handle. Replace the $BEARER_TOKEN with your own Bearer Token, paste the full request in your terminal, and press “return”.Building queries As you can see in the example calls above, using the query parameter, you can specify the data that you want to search for. As an example, if you wanted to get all Posts that contain the word covid or the word coronavirus, you can use the OR operator within brackets, and your query can be
(covid OR coronavirus)
and thus your API call will look like the following: