Retrieve data from the U.S. Department of Commerce's Bureau of Economic Analysis (BEA).
The R package bea.R is available on CRAN and GitHub.
You need to sign up for a personal API key at https://apps.bea.gov/API/signup/.
For technical details consult the API documentation.
For inspiration see the BEA's Interacitve Data Application (iTables).
Note that a Python package is also available on GitHub.