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.
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:
"summary"
(default): Session summary with call counts by type and total costs. Ideal for quick reporting and budget tracking."detailed"
: One row per API call with detailed information including timestamp, date, call type, and other metadata. Perfect for creating custom visualizations and detailed analysis.
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 typeTotal Calls
: Total number of API calls in this sessionCosts (EUR)
: Session costs (EUR 0.02 per paid call)
Detailed format includes these columns:
timestamp
: Exact time of the API calldate
: Date of the API callyear
,month
: Extracted date componentscall_type
: Type of API call (search, basisprofiel, etc.)test_environment
: Always FALSE for production calls
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
if (FALSE) { # interactive()
# 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")
}