Skip to contents

This function retrieves the establishment profile (vestigingsprofiel) for a given establishment number (vestigingsnummer) using the KvK Vestigingsprofiel API.

Usage

kvk_get_vestigingsprofiel(
  vestigingsnummer,
  geoData = FALSE,
  test_environment = FALSE
)

Arguments

vestigingsnummer

A string representing the establishment number for which the profile is requested.

geoData

A logical value indicating whether geo-data should be included in the response. Defaults to FALSE. If TRUE, the response will include geo-data.

test_environment

A logical value indicating whether to use the test environment (TRUE) or the production environment (FALSE). Defaults to FALSE.

Value

A tibble containing the retrieved establishment profile. If geoData = TRUE, the returned tibble will also include geographical information.

Details

The function also supports the test_environment argument. When set to TRUE, the function will query the KvK test API environment, providing a set of fictitious test data.

The function retrieves data from the KvK Vestigingsprofiel API. If geoData = TRUE, geo-data (e.g., location data) will be included in the returned profile.

Important: If test_environment = TRUE, no actual API key is required. You will be using test data from the KvK test environment.

Examples

# Examples using the production API (requires API key)
# Retrieve vestigingsprofiel for a given establishment number
vestigingsprofiel <- kvk_get_vestigingsprofiel(vestigingsnummer = "000038509504")
print(vestigingsprofiel)
#> # A tibble: 1 × 15
#>   vestigingsnummer kvkNummer indNonMailing formeleRegistratiedatum
#>   <chr>            <chr>     <chr>         <chr>                  
#> 1 000038509504     70215065  Ja            20171204               
#> # ℹ 11 more variables: materieleRegistratie <tibble[,1]>,
#> #   eersteHandelsnaam <chr>, indHoofdvestiging <chr>,
#> #   indCommercieleVestiging <chr>, voltijdWerkzamePersonen <int>,
#> #   totaalWerkzamePersonen <int>, deeltijdWerkzamePersonen <int>,
#> #   handelsnamen <list>, adressen <list>, sbiActiviteiten <list>, links <list>

# Retrieve vestigingsprofiel with geo-data
vestigingsprofiel_geo <- kvk_get_vestigingsprofiel(
  vestigingsnummer = "000038509504", 
  geoData = TRUE
)

# Examples using test environment (no API key required)
vestigingsprofiel_test <- kvk_get_vestigingsprofiel(
  vestigingsnummer = "000019716893", 
  test_environment = TRUE
)
#>  You are using the KvK test environment. Test data will be returned.
#>  The product cannot be delivered for branch number '000019716893' (HTTP 404)
print(vestigingsprofiel_test)
#> NULL