03/17/2023, 12:15 AM
Hi! Does the Cloud Pricing API have an OpenAPI specification?
03/17/2023, 12:21 AM
👋 Hi Sam! The Cloud Pricing API uses GraphQL and as far as I know, OpenAPI is for REST APIs. I’m curious what you’re use-case if you’d like to share
03/17/2023, 12:28 AM
Ah ok! I'm just trying to generate a golang client library to make calls. I need to programmatically get gcp vm instance pricing.
And from what I've seen, there's very little by way of making programatic calls to get pricing data with gcp, other than SKUs which require lots of processing
Do you have a graphql schema that I could use?
03/17/2023, 12:59 AM
very cool! You can download the latest live schema from the
- install the
browser extension so you can set the custom HTTP header
to your Infracost API key so you can open the playground. Here’s an example query for google:
The CLI code has examples of the filters you need to pass-in, e.g. for google compute instances
here’s an example
03/17/2023, 3:27 AM
Thanks! Is there a way I can get storage/disk pricing too via your api?
03/17/2023, 7:00 AM
Yep, all ~4M prices from AWS, Azure and Google are available and updated automatically in this API 🙂 Checkout
for the other resource prices, e.g. compute_disk.go shows the function that’s calculating the disk costs, you can follow that function to see what graphql filters it uses
03/17/2023, 6:55 PM
Thanks! Would you be able to give me an example request I could make to get GCP disk prices?
03/17/2023, 7:15 PM
try these filters: