# Recipes

**Query Credit Data using R**

Using the Bloom R SDK, authenticate, create consumers and order credit data in R.

## In this Recipe

1. Install the devtools library
2. Load the Bloom R library
3. Load credentials

1. Fetch an Auth Token
2. Create a new consumer
3. Order Credit Data
4. Fetch Credit Data
5. Congratulations!

💳Open Recipe

## R

```r
xxxxxxxxxx
```

1

```r
install.packages("devtools")
```

2

```r
library(devtools)
```

3

```

```

4

```r
install_github("bloomcredit/BloomR")
```

5

```r
library(bloomR)
```

6

```

```

7

```r
client_id <- "<client_id>"
```

8

```r
client_secret <- "<client_secret>"
```

9

```

```

10

```

```

11

```r
auth_token <- fetch_auth_token(
```

12

```r
  client_id = client_id,
```

13

```r
  client_secret = client_secret
```

14

```r
)
```

15

```

```

16

```r
consumer_info <- list(
```

17

```r
  ssn = "123456789",
```

18

```r
  city = "Scranton",
```

19

```r
  line1 = "1725 Slough Avenue",
```

20

```r
  state_code = "PA",
```

21

```r
  zipcode = "18503",
```

22

```r
  date_of_birth = "1964-03-15",
```

23

```r
  first_name = "Michael",
```

24

```r
  last_name = "Scott",
```

25

```r
  address_primary = TRUE
```

26

```r
)
```

27

```

```

28

```r
consumer_id <- register_consumer(
```

29

```r
  consumer_info = consumer_info,
```

30

```r
  auth_token = auth_token
```

31

```r
)
```

32

```

```

33

```r
credit_order <- order_credit_data(
```

34

```r
  consumer_id = consumer_id,
```

35

```r
  portfolio_id = "<portfolio_id>",
```

36

```r
  sku = "<sku>",
```

37

```r
  auth_token = auth_token
```

38

```r
)
```

39

```

```

40

```r
credit_data <- get_credit_data(
```

41

```r
  order_id = credit_order$data$id,
```

42

```r
  auth_token = auth_token
```

43

```r
)
```

44

```

```

- 💳

## Query Credit Data using R

Using the Bloom R SDK, authenticate, create consumers and order credit data in R.
