giip
SES Proposal
3 min read

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) on https://api.giip.io/v3 with the x-giip-ak header are planned / not yet implemented โ€” do not call them yet. For Azure cost, use the live, deployed API: azureCost / azureCostServers on https://giipfaw.azurewebsites.net/api, authenticated with the x-api-key header. See the copy-runnable quick start in the Azure Cost guide (section "๐Ÿค– AI/API Quick Start").

โœ… Implemented: Azure Cost API (x-api-key)

APIMethodURL
Server listGEThttps://giipfaw.azurewebsites.net/api/azureCostServers?csn={csn}
Cost detailGEThttps://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 period
    • prj_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 jsondata substitution.
  • Usage Tip: When analyzing large-scale infrastructure costs, you can combine the text command with jsondata to ensure query integrity while making calls.

Troubleshooting

SymptomCauseSolution
A 401 authentication error occurs or an empty response is returnedThe x-api-key header is missing or contains a wrong keyVerify 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 codeInvalid parameters or query conditionsRefer to the API Result Codes Guide to identify the cause code and correct the parameters
The Sk3 text command call failsThe text command signature is incorrectVerify that the combination format of the text command and jsondata is correct
A JSON parse error occurs when passing jsondataQuotes inside jsondata are not escaped correctlyEscape 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: