Infracost API

The majority of users should use the Infracost CLI, which does not send the Terraform statefile to the Cloud Pricing API; instead it sends the relevant data for finding a unique cloud price point.

The API described in this page can be useful for CI/CD integrations, such as Atlantis, where it might be easier to use curl or an HTTP library instead of installing the Infracost CLI. Terraform plan JSON files can be sent to this API, which runs infracost diff and returns the results (text/plain response). Whilst this API deletes files from the server after they are processed, it is a good security practice to remove secrets from the file before sending it to the API. For example, AWS provides a grep command that can be used to do this.


To use this API, send an HTTP POST request to with the terraform-json-file parameter using the multipart/form-data request body format, as shown in the following example curl request. The x-api-key header must be set to your Infracost API key.

terraform-json-fileTerraform plan JSON fileRequired. Use '@' to upload the file with curl, e.g. -F "terraform-json-file=@plan.json"
usage-fileInfracost usage file that specifies values for usage-based resourcesNot required. Use '@' to upload the file with curl, e.g. -F "usage-file=@infracost-usage.yml"
show-skippedShow unsupported resources, some of which might be free.Not required. Defaults to false
no-colorTurn off colored output, useful for CI/CD or Windows users (color output has a bug we need to fix on Windows)Not required. Defaults to false


cd path/to/code
terraform init
terraform plan -out tfplan.binary
terraform show -json tfplan.binary > plan.json
curl -X POST -H "x-api-key: my-api-key" -F "ci-platform=atlantis" \
-F "terraform-json-file=@plan.json" \