This quickstart guide will walk you through building a complete cost management workflow using the Vantage API. You’ll learn to create folders, generate Cost Reports, and analyze spending data programmatically.
Prerequisites
- A Vantage account with at least one provider integration
- A Vantage API access token with Read and Write scopes enabled
Base URL
All Vantage API
v2 requests use the following base URL:1
Discover Workspaces
First, we’ll retrieve all workspaces your API token has access to.
2
Create Organization
Set up a folder structure to organize your Cost Reports.
3
Generate Cost Report
Create a VQL-powered Cost Report with specific filters.
4
Analyze Data
Retrieve and analyze cost and usage data from your report.
This quickstart focuses on API-native resource creation and data retrieval. If you need a point-in-time CSV (including a CSV export in the FOCUS schema) or PDF that mirrors a Cost Report in the UI, use the Cost Report export flow instead.
Step 1: Discover Your Workspaces
- Request
- Response
GET /workspaces
Retrieve all workspaces your API token has access to. This endpoint returns workspace tokens and metadata that you’ll use in subsequent API calls.
Step 2: Create an Organized Folder Structure
- Request
- Response
POST /folders
Create a folder to organize your Cost Reports. This helps maintain a clean structure for your cost management workflows.
Use the workspace token from Step 1. You can also specify a
parent_folder_token to create nested folder structures.Step 3: Create an Intelligent Cost Report
VQL
This step demonstrates the power of Vantage Query Language (VQL), a flexible query system that lets you filter costs by provider, tags, services, and more. Learn more about VQL syntax.
- Request
- Response
POST /cost_reports
Create a VQL-powered Cost Report that automatically filters AWS production costs.
VQL Filter Breakdown
VQL Filter Breakdown
The VQL filter
costs.provider = 'aws' AND tags.name = 'environment' AND tags.value = 'production' does the following:costs.provider = 'aws'- Only includes AWS coststags.name = 'environment'- Filters for resources with anenvironmenttagtags.value = 'production'- Only includes resources tagged asproduction
Step 4: Analyze Your Cost Data
- Request
- Response
GET /costs
Retrieve detailed cost data from your report with flexible filtering and grouping options. This demonstrates how to extract actionable insights from your cost data.
Query Parameters Explained
Query Parameters Explained
cost_report_token- Uses the report token from Step 3start_date&end_date- ISO 8601 date range for filteringgroupings=service- Groups costs by AWS service (EC2, RDS, etc.)order=desc- Sorts by date in descending order (newest first)
Bonus: Retrieve Usage Analytics
Usage Data Insights
Beyond cost data, the Vantage API provides detailed usage analytics. This is perfect for understanding resource utilization patterns and optimizing your infrastructure.
- Request
- Response
GET /costs with Usage Data
Retrieve both cost and usage data by setting
aggregate_by=usage. This provides comprehensive resource utilization insights.The key parameter here is
settings[aggregate_by]=usage which switches from cost aggregation to usage aggregation.What You've Accomplished
You’ve successfully built a complete cost management workflow using the Vantage API:
- Discovered workspaces and retrieved access tokens
- Created organized folders for Cost Report management
- Generated intelligent Cost Reports using VQL filtering
- Analyzed cost data with flexible grouping and filtering
- Retrieved usage analytics for resource optimization