Cost Analysis API Reference
Detailed API specifications for querying cloud and infrastructure cost data and AI optimization suggestions aggregated on the GIIP platform.
๐ Overview
The Cost Analysis API provides integrated cost data for multiple clouds (Azure, AWS, etc.) and on-premise resources. It can be utilized for integration with financial systems or automatic report generation.
โ ๏ธ Implementation status (read first) The generic
/cost/*endpoints below (/cost/summary,/cost/breakdown,/cost/recommendations) onhttps://api.giip.io/v3with thex-giip-akheader are planned / not yet implemented โ do not call them yet. For Azure cost, use the live, deployed API:azureCost/azureCostServersonhttps://giipfaw.azurewebsites.net/api, authenticated with thex-api-keyheader. See the copy-runnable quick start in the Azure Cost guide (section "๐ค AI/API Quick Start").
โ Implemented: Azure Cost API (x-api-key)
| API | Method | URL |
|---|---|---|
| Server list | GET | https://giipfaw.azurewebsites.net/api/azureCostServers?csn={csn} |
| Cost detail | GET | https://giipfaw.azurewebsites.net/api/azureCost?csn={csn}&lssn={lssn} |
Authenticate only with the x-api-key header (never put the key in the URL or body). Full request/response contract, error table, and cURL/PowerShell/Python examples are in the Azure Cost guide.
๐ Key Endpoints (๐ง Planned / Not Implemented)
The three endpoints below are a planned generic cost API and are not implemented yet. They are documented as a design reference only; use the Azure Cost API above for working queries.
1. Daily/Monthly Cost Summary โ ๐ง Planned / Not Implemented
Fetches the total cost incurred over a specific period.
- URL:
GET /cost/summary - Key Parameters:
date_from,date_to: Set query periodprj_isn(Integer): Filter by specific Project
- Response Data: Total amount, Currency, Change rate compared to the previous day, etc.
2. Cost Breakdown by Asset โ ๐ง Planned / Not Implemented
Analyzes which servers or databases are incurring the most costs.
- URL:
GET /cost/breakdown - Response Data: List of costs by asset type (VM, DB, Network, etc.)
3. Query AI Cost Optimization Suggestions โ ๐ง Planned / Not Implemented
Retrieves estimated cost savings through AI-analyzed resource resizing.
- URL:
GET /cost/recommendations - Response Data: Target asset, Current specs, Recommended specs, Estimated savings
๐ ๏ธ Usage Example (cURL) โ Azure Cost API (implemented)
# Use environment variables only; never put the key in the URL/body
export GIIP_CSN=47
export GIIP_API_KEY=***your_key***
# Server list + default server
curl -s "https://giipfaw.azurewebsites.net/api/azureCostServers?csn=${GIIP_CSN}" \
-H "x-api-key: ${GIIP_API_KEY}"
# Single-server cost detail
curl -s "https://giipfaw.azurewebsites.net/api/azureCost?csn=${GIIP_CSN}&lssn=71197" \
-H "x-api-key: ${GIIP_API_KEY}"
๐ก๏ธ Using Sk3 (High-fidelity Logging)
For situations requiring data integrity verification of cost data collection and detailed audit logs, we recommend using the giipApiSk3 endpoint.
- Endpoint:
https://giipfaw.azurewebsites.net/api/giipApiSk3 - Unique Advantages: Automatic error logging, caller metadata (IP, etc.) tracking, and optimization of complex query conditions through
jsondatasubstitution. - Usage Tip: When analyzing large-scale infrastructure costs, you can combine the
textcommand withjsondatato ensure query integrity while making calls.
Troubleshooting
| Symptom | Cause | Solution |
|---|---|---|
| A 401 authentication error occurs or an empty response is returned | The x-api-key header is missing or contains a wrong key | Verify that a valid key is set in the x-api-key request header (the Azure Cost API uses x-api-key, not x-giip-ak) |
The RstVal in the response returns a non-200 code | Invalid parameters or query conditions | Refer to the API Result Codes Guide to identify the cause code and correct the parameters |
The Sk3 text command call fails | The text command signature is incorrect | Verify that the combination format of the text command and jsondata is correct |
A JSON parse error occurs when passing jsondata | Quotes inside jsondata are not escaped correctly | Escape the quotes in the jsondata value correctly and resend |
Version: 1.1
Last Updated: 2026-04-10
Source: giipv3/public/help/api-cost.en.md
Related Documents: