Skip to content

System Information

R Versions Available to RStudio Connect

This recipe compares your local R version against the R installations available on your RStudio Connect server. It uses the GET /v1/server_settings/r endpoint to obtain the R installations available to RStudio Connect.


  1. Obtain the RStudio Connect server URL and API Key from environment variables
  2. Obtain your local R version using R.version
  3. Retrieve the R installation info with the GET /v1/server_settings/r endpoint.
  4. Parse the response using httr::content.
  5. Check the response for the local R version. If it is not listed, the RStudio Connect server does not contain the local R version.

Here is an example of the workflow:


# The connectServer URL must have a trailing slash.
connectServer <- Sys.getenv("CONNECT_SERVER")
connectAPIKey <- Sys.getenv("CONNECT_API_KEY")

myRVersion <- paste(R.version$major, R.version$minor, sep = ".")
resp <- GET(
  paste0(connectServer, "__api__/v1/server_settings/r"),
  add_headers(Authorization = paste("Key", connectAPIKey))
payload <- content(resp, as="parsed")
if (myRVersion %in% unlist(payload)) {
  print("The local R version was found on the RStudio Connect server")
} else {
  print(paste("Cannot find R version", myRVersion,"on the RStudio Connect server"))