Access data via the Application Programming Interface
Understanding the BEA API
The U.S. Bureau of Economic Analysis (BEA) API is a service that provides programmatic access to national, international, regional, and industry economic accounts data.
Key Features:
• | API Key (UserID): Access to the API is free, but requires you to register for a 36-character UserID (API Key). You can register on the BEA API signup page. |
• | Data Available: The API provides access to a vast amount of economic data, including: |
o | National Data: Gross Domestic Product (GDP), National Income and Product Accounts (NIPA), Fixed Assets. |
o | International Data: International Transactions (ITA), International Investment Position (IIP), International Services. |
o | Regional Data: GDP and personal income by state, county, and metropolitan statistical area. |
o | Industry Data: Input-Output tables, GDP by Industry. |
• | Request Method: The API uses HTTP GET requests. You build a URL with specific parameters to query the data you need. |
• | Data Format: The API can return data in either JSON (the default) or XML format. |
Making a Request:
A typical API request requires several key parameters in the URL:
• | UserID: Your 36-character API key. |
• | Method: The action you want to perform (e.g., GetData, GetParameterList). |
• | DatasetName: The specific dataset you want to query (e.g., NIPA, Regional). |
• | Additional parameters specific to the dataset, such as TableName, Frequency, and Year. |
The following code example will demonstrate how to construct a request and parse the response.//