Retrieves the API key used for OpenAlex requests. The value is taken from
the environment variable openalexR.apikey if set; otherwise it falls back
to the R option openalexR.apikey. If neither is defined, NULL is
returned.
Details
This helper mirrors the behavior of openalexR::oa_apikey() to make it easy
to configure credentials without a hard dependency. Prefer setting the
environment variable for non-interactive usage.
Examples
# Set via environment (preferred in non-interactive contexts)
Sys.setenv(openalexR.apikey = "<api-key>")
oap_apikey()
#> [1] "<api-key>"
# Or via options
options(openalexR.apikey = "<api-key>")
oap_apikey()
#> [1] "<api-key>"