kvk_export_usage {kvkapiR} | R Documentation |
Export session usage data to CSV file
Description
Export your KvK API usage data from the current session to a CSV file for external analysis, reporting, or record keeping. Choose between summary data or detailed call-by-call data.
Usage
kvk_export_usage(file_path, format = "summary")
Arguments
file_path |
Character string specifying the path where the CSV file should be saved. Can include relative or absolute paths. The file will be created if it doesn't exist, or overwritten if it does. |
format |
Character string specifying the export format:
|
Details
The exported data only includes production API calls from the current R session. Test environment calls are not included in the export. All data is session-based and will be lost when you restart R.
Summary format includes these columns:
-
Search
,Basisprofiel
,Vestiging
,Naamgeving
: Call counts by type -
Total Calls
: Total number of API calls in this session -
Costs (EUR)
: Session costs (EUR 0.02 per paid call)
Detailed format includes these columns:
-
timestamp
: Exact time of the API call -
date
: Date of the API call -
year
,month
: Extracted date components -
call_type
: Type of API call (search, basisprofiel, etc.) -
test_environment
: Always FALSE for production calls
Value
Invisibly returns NULL. The function is called for its side effect of creating a CSV file.
See Also
kvk_usage_report
for viewing usage in R,
kvk_usage_alert
for setting usage limits,
kvk_reset_usage
for clearing usage history
Examples
# Export session summary (default)
kvk_export_usage("session_summary.csv")
# Export detailed call data for analysis
kvk_export_usage("detailed_calls.csv", format = "detailed")
# Export to specific directory
kvk_export_usage("reports/session_data.csv", format = "summary")