Search works

The best way to search for works is to use the search query parameter, which searches across titles, abstracts, and fulltext. Example:

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.

Search a specific field

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:

The following fields can be searched within works:

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:

  1. 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.

  2. 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.

Autocomplete works

You can autocomplete works to create a very fast type-ahead style search function:

This returns a list of works titles with the author of each work set as the hint:

{ 
  "results": [
    {
      "id": "https://openalex.org/W2125098916",
      "display_name": "Crouching tigers, hidden prey: Sumatran tiger and prey populations in a tropical forest landscape",
      "hint": "Timothy G. O'Brien, Margaret F. Kinnaird, Hariyo T. Wibisono",
      "cited_by_count": 620,
      "works_count": null,
      "entity_type": "work",
      "external_id": "https://doi.org/10.1017/s1367943003003172"
    },
    ...
  ]
}

Read more about autocomplete.

Last updated