Bureau of Labor Statistics’ API

Data - BLS


Code
source("../../code/R-markdown/init_insee.R")
# library(devtools)
# install_github('mikeasilva/blsAPI')
library(blsAPI)

Info

source dataset .html .RData

insee

api

2024-06-17 NA

List of APIs

source dataset .html .RData

bdf

api

2024-06-17 NA

bea

api

2024-06-17 NA

bis

api

2024-04-19 NA

bls

api

2024-02-11 NA

ecb

api

2024-06-17 NA

eurostat

api

2024-06-08 NA

imf

api

2024-06-17 NA

insee

api

2024-06-17 NA

oecd

api

2024-05-07 2024-04-16

rdb

api

NA NA

wdi

api

2024-04-14 NA

Documentation on CRAN: Link.

BLS API

One needs first to create an account to get access to the Application Programming Interface (API): https://data.bls.gov/registrationEngine/

Retrieve new series

Code
data <- blsAPI('LAUCN040010000000005', 2, TRUE)

data %>%
  print_table_conditional()
year period periodName value seriesID
2024 M04 April 16723 LAUCN040010000000005
2024 M03 March 16894 LAUCN040010000000005
2024 M02 February 16704 LAUCN040010000000005
2024 M01 January 16682 LAUCN040010000000005
2023 M12 December 16571 LAUCN040010000000005
2023 M11 November 16757 LAUCN040010000000005
2023 M10 October 16808 LAUCN040010000000005
2023 M09 September 16983 LAUCN040010000000005
2023 M08 August 17374 LAUCN040010000000005
2023 M07 July 16492 LAUCN040010000000005
2023 M06 June 16717 LAUCN040010000000005
2023 M05 May 16871 LAUCN040010000000005
2023 M04 April 16732 LAUCN040010000000005
2023 M03 March 17000 LAUCN040010000000005
2023 M02 February 16836 LAUCN040010000000005
2023 M01 January 16961 LAUCN040010000000005
2022 M12 December 16945 LAUCN040010000000005
2022 M11 November 16939 LAUCN040010000000005
2022 M10 October 17000 LAUCN040010000000005
2022 M09 September 17173 LAUCN040010000000005
2022 M08 August 17252 LAUCN040010000000005
2022 M07 July 16219 LAUCN040010000000005
2022 M06 June 16734 LAUCN040010000000005
2022 M05 May 16978 LAUCN040010000000005
2022 M04 April 16821 LAUCN040010000000005
2022 M03 March 17082 LAUCN040010000000005
2022 M02 February 17004 LAUCN040010000000005
2022 M01 January 17103 LAUCN040010000000005

California Unemployment rate

One (very) annoying limitation of the BLS API is that you can only retrieve up to 20 years of data.

Code
data <- list(seriesid = c("LASST050000000000003", "LASST060000000000003"),
             startyear = 1970,
             endyear = 2018
             ) %>%
  blsAPI(., 2, TRUE)

data %>%
  head(10) %>%
  print_table_conditional()
year period periodName value seriesID
1979 M12 December 6.1 LASST050000000000003
1979 M11 November 6.2 LASST050000000000003
1979 M10 October 6.2 LASST050000000000003
1979 M09 September 6.3 LASST050000000000003
1979 M08 August 6.3 LASST050000000000003
1979 M07 July 6.3 LASST050000000000003
1979 M06 June 6.3 LASST050000000000003
1979 M05 May 6.3 LASST050000000000003
1979 M04 April 6.3 LASST050000000000003
1979 M03 March 6.3 LASST050000000000003

BLS QCEW

Code
# Example: Request Construction data for the first quarter of 2017
Construction <- blsQCEW('Industry', year='2017', quarter='1', industry='1012')

Construction %>%
  head(10) %>%
  print_table_conditional()
area_fips own_code industry_code agglvl_code size_code year qtr disclosure_code qtrly_estabs month1_emplvl month2_emplvl month3_emplvl total_qtrly_wages taxable_qtrly_wages qtrly_contributions avg_wkly_wage lq_disclosure_code lq_qtrly_estabs lq_month1_emplvl lq_month2_emplvl lq_month3_emplvl lq_total_qtrly_wages lq_taxable_qtrly_wages lq_qtrly_contributions lq_avg_wkly_wage oty_disclosure_code oty_qtrly_estabs_chg oty_qtrly_estabs_pct_chg oty_month1_emplvl_chg oty_month1_emplvl_pct_chg oty_month2_emplvl_chg oty_month2_emplvl_pct_chg oty_month3_emplvl_chg oty_month3_emplvl_pct_chg oty_total_qtrly_wages_chg oty_total_qtrly_wages_pct_chg oty_taxable_qtrly_wages_chg oty_taxable_qtrly_wages_pct_chg oty_qtrly_contributions_chg oty_qtrly_contributions_pct_chg oty_avg_wkly_wage_chg oty_avg_wkly_wage_pct_chg
01000 3 1012 53 0 2017 1 N 3 0 0 0 0 0 0 0 N 0.05 0.00 0.00 0.00 0.00 0.00 0.00 0.00 N 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
01000 5 1012 53 0 2017 1 9418 83172 83992 85415 1090022541 623745976 15390351 996 0.96 0.96 0.96 0.95 1.05 0.96 1.00 1.10 210 2.3 353 0.4 1208 1.5 834 1.0 87644260 8.7 22362749 3.7 -2418247 -13.6 71 7.7
01001 5 1012 73 0 2017 1 79 443 434 424 4508287 2900721 51398 800 1.16 0.91 0.88 0.85 0.93 0.96 0.68 1.06 -2 -2.5 7 1.6 -6 -1.4 -15 -3.4 121174 2.8 15737 0.5 -14955 -22.5 30 3.9
01003 5 1012 73 0 2017 1 572 3621 3623 3645 41852796 26384742 386967 887 1.21 1.17 1.15 1.10 1.49 1.16 0.83 1.31 30 5.5 217 6.4 206 6.0 60 1.7 6352836 17.9 2666038 11.2 -38263 -9.0 100 12.7
01005 5 1012 73 0 2017 1 30 144 151 152 2248580 963074 11157 1161 0.68 0.40 0.41 0.41 0.68 0.36 0.20 1.66 -2 -6.2 -9 -5.9 4 2.7 2 1.3 386568 20.8 20912 2.2 -5875 -34.5 206 21.6
01007 5 1012 73 0 2017 1 31 628 615 706 10215205 5174429 139467 1210 1.09 3.39 3.29 3.65 5.42 4.26 4.21 1.57 2 6.9 -126 -16.7 -123 -16.7 -104 -12.8 -1001795 -8.9 -952161 -15.5 -28136 -16.8 86 7.7
01009 5 1012 73 0 2017 1 89 483 496 491 4524333 3173331 56491 710 1.47 1.30 1.32 1.28 1.40 1.31 1.28 1.07 10 12.7 62 14.7 64 14.8 55 12.6 773109 20.6 500248 18.7 10787 23.6 38 5.7
01011 5 1012 73 0 2017 1 N 4 0 0 0 0 0 0 0 N 0.35 0.00 0.00 0.00 0.00 0.00 0.00 0.00 N -1 -20.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
01013 5 1012 73 0 2017 1 26 198 197 191 2275535 1408889 30673 896 0.68 0.65 0.64 0.61 0.89 0.61 0.54 1.41 -1 -3.7 -40 -16.8 -40 -16.9 -37 -16.2 -271954 -10.7 -181999 -11.4 -13977 -31.3 60 7.2
01015 5 1012 73 0 2017 1 157 853 857 851 9055626 5689071 133766 816 0.79 0.43 0.43 0.41 0.45 0.45 0.42 1.07 6 4.0 67 8.5 58 7.3 44 5.5 983511 12.2 406766 7.7 -14851 -10.0 37 4.7