Getting Started with rPublic

Generating your token file

  1. To get started please visit \donttest{Public} and request api access. Public -> Settings -> Security -> API

  2. All requests in this package must be authenticated. You will need to save you token files as "rp_tokens.rds" in your working directory. Here is an example of how to run it and save them.

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)

# step 1 - Paste your secret key into line 25. Afterwards, run the block to save them as 'rp_tokens.rds'. 
rp = new.env()
assign('secret_key','PASTE_YOUR_SECRET_KEY_HERE', envir = rp)
assign('access_token', NULL, envir = rp)
assign('expiresAt', Sys.time(), envir = rp)
saveRDS(rp, "rp_tokens.rds")

Exchange secret key for an access token.

You can manually change the expiration in minutes here but the default will be 120 minutes.

# step 2 - use the secret key to exchange for an access token
rp_getAccToken(exp_in_mins = 120)

Test Access/Bearer Token

Request Account info from the API to make sure your tokens work

# step 3: making your first request
my_acc = rp_getAccts()


Try the rPublic package in your browser

Any scripts or data that you put into this service are public.

rPublic documentation built on Aug. 23, 2025, 1:12 a.m.