Infracost Breakdown API

The Breakdown API from Infracost — 1 operation(s) for breakdown.

OpenAPI Specification

infracost-breakdown-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Infracost Cloud Pricing Breakdown API
  description: The Infracost Cloud Pricing API provides programmatic access to cloud cost estimation for Terraform plans. The Plan JSON API exposes breakdown and diff endpoints used by the Infracost CLI and CI/CD integrations to surface cost breakdowns and changes directly inside pull requests.
  version: 1.0.0
  contact:
    name: Infracost
    url: https://www.infracost.io/
  license:
    name: Apache 2.0
    url: https://github.com/infracost/infracost/blob/master/LICENSE
servers:
- url: https://pricing.api.infracost.io
  description: Infracost Cloud Pricing API
security:
- ApiKeyAuth: []
tags:
- name: Breakdown
paths:
  /breakdown:
    post:
      summary: Generate Cost Breakdown
      description: Generates a detailed cost breakdown for a Terraform plan JSON file, returning resource-level monthly and hourly costs. Output formats include table, JSON, and HTML.
      operationId: generateBreakdown
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - path
              properties:
                path:
                  type: string
                  format: binary
                  description: Terraform plan JSON file
                usage-file:
                  type: string
                  format: binary
                  description: Optional usage file for usage-based resources
                format:
                  type: string
                  enum:
                  - table
                  - json
                  - html
                  default: table
                fields:
                  type: string
                  description: Comma-separated list of fields to include
                show-skipped:
                  type: boolean
                  description: Show unsupported and free resources
                no-color:
                  type: boolean
                  description: Disable colored output for CI/CD environments
      responses:
        '200':
          description: Cost breakdown generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Breakdown'
            text/plain:
              schema:
                type: string
            text/html:
              schema:
                type: string
        '400':
          description: Invalid request
        '401':
          description: Missing or invalid API key
      tags:
      - Breakdown
components:
  schemas:
    ResourceBreakdown:
      type: object
      properties:
        resources:
          type: array
          items:
            $ref: '#/components/schemas/Resource'
        totalHourlyCost:
          type: string
        totalMonthlyCost:
          type: string
    Breakdown:
      type: object
      properties:
        version:
          type: string
        currency:
          type: string
        projects:
          type: array
          items:
            $ref: '#/components/schemas/Project'
        totalHourlyCost:
          type: string
        totalMonthlyCost:
          type: string
        pastTotalHourlyCost:
          type: string
        pastTotalMonthlyCost:
          type: string
        diffTotalHourlyCost:
          type: string
        diffTotalMonthlyCost:
          type: string
    CostComponent:
      type: object
      properties:
        name:
          type: string
        unit:
          type: string
        hourlyQuantity:
          type: string
        monthlyQuantity:
          type: string
        price:
          type: string
        hourlyCost:
          type: string
        monthlyCost:
          type: string
    Project:
      type: object
      properties:
        name:
          type: string
        metadata:
          type: object
        pastBreakdown:
          $ref: '#/components/schemas/ResourceBreakdown'
        breakdown:
          $ref: '#/components/schemas/ResourceBreakdown'
        diff:
          $ref: '#/components/schemas/ResourceBreakdown'
    Resource:
      type: object
      properties:
        name:
          type: string
        resourceType:
          type: string
        tags:
          type: object
          additionalProperties:
            type: string
        metadata:
          type: object
        hourlyCost:
          type: string
        monthlyCost:
          type: string
        costComponents:
          type: array
          items:
            $ref: '#/components/schemas/CostComponent'
        subresources:
          type: array
          items:
            $ref: '#/components/schemas/Resource'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Infracost API key