Sunlight Foundation data from R


You need API keys for Sunlight Foundation APIs. Please get your own API keys if you plant to use these functions for Sunlight Labs ( We set up the functions so that you can use either env vars, or R options. For env vars, put an entry in your .Renviron file with the name SUNLIGHT_LABS_KEY, so the full thing would be SUNLIGHT_LABS_KEY=<key>. For R options, put the key in your .Rprofile file like options(SunlightLabsKey = "key"). Both are called on R startup, and then you don't have to enter your API key for each run of a function.


Currently we have functions to interface with the following Sunlight Foundation APIs, where functions for each API are prefixed with a two letter code indicating the service.

  • Congress API ('cg')

  • Open States API ('os')

  • Capitol Words API ('cw')

Note that Puerto Rico is not included in Sunlight Foundation data.


Scott Chamberlain

Thomas J. Leeper

Want to suggest features or report bugs for Use the GitHub issue tracker. Vote for new features on Trello.

comments powered by Disqus