You can use sample
to get a random list of up to 10,000 results.
- Get 100 random works
https://api.openalex.org/works?sample=100&per-page=100 - Get 50 random works that are open access and published in 2021
https://api.openalex.org/works?filter=open_access.is_oa:true,publication_year:2021&sample=50&per-page=50
You can add a seed
value in order to retrieve the same set of random records, in the same order, multiple times.
- Get 20 random sources with a seed value
https://api.openalex.org/sources?sample=20&seed=123
{% hint style="info" %} Depending on your query, random results with a seed value may change over time due to new records coming into OpenAlex. {% endhint %}
- The sample size is limited to 10,000 results.
- You must provide a
seed
value when paging beyond the first page of results. Without a seed value, you might get duplicate records in your results. - You must use basic paging when sampling. Cursor pagination is not supported.