Skip to contents

This function retrieves the basis profile for a given KvK number (kvkNummer) using the KvK Basisprofiel API. Users can also request additional data, such as owner information, main establishment, and other locations by specifying the include parameter.

Usage

kvk_get_basisprofiel(
  kvkNummer,
  geoData = FALSE,
  include = NULL,
  test_environment = FALSE
)

Arguments

kvkNummer

A string representing the KvK number for which the basis 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.

include

A character vector specifying additional data to include. Possible values: "eigenaar" (owner), "hoofdvestiging" (main establishment), "vestigingen" (locations). Defaults to NULL (basic profile only).

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 basis 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 Basisprofiel API. If geoData = TRUE, geo-data (e.g., location data) will be included in the returned profile. The include parameter allows users to request additional details, such as ownership information or business locations.

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 basis profile for a given KvK number without geo-data
basis_profile <- kvk_get_basisprofiel(kvkNummer = "69599084")
print(basis_profile)
#> # A tibble: 1 × 10
#>   kvkNummer indNonMailing naam     formeleRegistratieda…¹ materieleRegistratie…²
#>   <chr>     <chr>         <chr>    <chr>                  <chr>                 
#> 1 69599084  Nee           Flexmet… 20180302               20170914              
#> # ℹ abbreviated names: ¹​formeleRegistratiedatum,
#> #   ²​materieleRegistratie$datumAanvang
#> # ℹ 6 more variables: materieleRegistratie$datumEinde <chr>,
#> #   totaalWerkzamePersonen <int>, handelsnamen <list>, sbiActiviteiten <list>,
#> #   links <list>, `_embedded` <list>

# Retrieve basis profile with geo-data
basis_profile_geo <- kvk_get_basisprofiel(kvkNummer = "69599084", geoData = TRUE)

# Retrieve basis profile including owner information
basis_profile_owner <- kvk_get_basisprofiel(kvkNummer = "69599084", include = "eigenaar")

# Examples using test environment (no API key required)
# These use the KvK test dataset with Donald Duck themed businesses
basis_profile_test <- kvk_get_basisprofiel(kvkNummer = "68727720", test_environment = TRUE)
#>  You are using the KvK test environment. Test data will be returned.
print(basis_profile_test)
#> # A tibble: 1 × 11
#>   kvkNummer indNonMailing naam     formeleRegistratieda…¹ materieleRegistratie…²
#>   <chr>     <chr>         <chr>    <chr>                  <chr>                 
#> 1 68727720  Ja            Test NV… 20170516               20160516              
#> # ℹ abbreviated names: ¹​formeleRegistratiedatum,
#> #   ²​materieleRegistratie$datumAanvang
#> # ℹ 6 more variables: totaalWerkzamePersonen <int>, statutaireNaam <chr>,
#> #   handelsnamen <list>, sbiActiviteiten <list>, links <list>,
#> #   `_embedded` <list>