Search works
Last updated
Last updated
The best way to search for works is to use the search
query parameter, which searches across titles, abstracts, and fulltext. Example:
Get works with search term "dna" in the title, abstract, or fulltext:
https://api.openalex.org/works?search=dna
Fulltext search is available for a subset of works, see Work.has_fulltext
for more details.
You can read more about search here. It will show you how relevance score is calculated, how words are stemmed to improve search results, and how to do complex boolean searches.
You can use search as a filter, allowing you to fine-tune the fields you're searching over. To do this, you append .search
to the end of the property you are filtering for:
Get works with "cubist" in the title:
https://api.openalex.org/works?filter=title.search:cubist
The following fields can be searched within works:
Search filter | Field that is searched |
---|---|
You can also use the filter default.search
, which works the same as using the search
parameter.
These searches make use of stemming and stop-word removal. You can disable this for searches on titles and abstracts. Learn how to do this here.
Rather than searching for the names of entities related to works—such as authors, institutions, and sources—you need to search by a more unique identifier for that entity, like the OpenAlex ID. This means that there is a 2 step process:
Find the ID of the related entity. For example, if you're interested in works associated with NYU, you could search the /institutions
endpoint for that name: https://api.openalex.org/institutions?search=nyu
. Looking at the first result, you'll see that the OpenAlex ID for NYU is I57206974
.
Use a filter with the /works
endpoint to get all of the works: https://api.openalex.org/works?filter=institutions.id:I57206974
.
Why can't you do this in just one step? Well, if you use the search term, "NYU," you might end up missing the ones that use the full name "New York University," rather than the initials. Sure, you could try to think of all possible variants and search for all of them, but you might miss some, and you risk putting in search terms that let in works that you're not interested in. Figuring out which works are actually associated with the "NYU" you're interested shouldn't be your responsibility—that's our job! We've done that work for you, so all the relevant works should be associated with one unique ID.
You can autocomplete works to create a very fast type-ahead style search function:
Autocomplete works with "tigers" in the title:
https://api.openalex.org/autocomplete/works?q=tigers
This returns a list of works titles with the author of each work set as the hint:
Read more about autocomplete.
fulltext via n-grams