programmatically retrieve frozen urls for CRAN from

Is there a way via script to retrieve the frozen URL of CRAN repo when given a date? Interactively in rspm's setup page this works but I need to do that via script given a date and maybe more for binary package url.

If you want to retrieve packages by date, as opposed to by version number, you can use the MRAN time machine:


Fill in yyyy-mm-dd with the date you're after.

Good point Hong,
microsoft's MRAN offers this feature. Still I am wondering whether RSPM also can somehow do it.

Take a look at RStudio Package Manager - there you can select any snapshot available there by clicking on any date in the calendar which will lead to an URL like Please also make note of the "Lock Package Data" feature.

Well Michael,
I need without human action the latest CRAN snapshot identified. Is there any chance to replace clicking on a date by some call to an API or so?

You may be aware of the Swagger API but this is currently in 0.0.1-alpha version and by far not able to meet your requirements.

I wonder what is the background for this request, especially why you cannot use /cran/latest ? We definitely can look into getting the necessary API calls exposed to RSPM once we understand the intent etc...

Happy to follow-up offline as well.

Hi I would also be interested in getting the url programmatically. I'm creating utils-kind of package in my company and I want to give user flexibility to choose either MRAN or RSPM snapshots as it take ages to compile packages on linux machines... It makes a significant difference in CI/CD pipelines.

Hi Michal,

you can programmatically get the link via the RSPM API, e.g.

curl -X 'POST'   ''   -H 'accept: application/json'   -H 'Content-Type: application/json'   -d '{
  "locked": false,
  "repo": "cran",
  "snapshot": "2019-05-06T00:00:00.000Z"
}' | jq

The above will retrieve the snapshot URL for 2019-05-06 in the resulting json file under "example".


  • The above approach makes use of an unpublished part of the RSPM API (RStudio Package Manager). As a consequence there is no guarantee that this approach will still work in the future and hence is unsupported at the moment.
  • The obtained URL's however will be reproducible as per their respective setting.