openapi: 3.0.3 info: title: Infracost Cloud Pricing 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: [] 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 /diff: post: summary: Generate Cost Diff description: >- Generates a git-style diff that shows cost changes between current and planned infrastructure states for a Terraform plan JSON file. operationId: generateDiff 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 show-skipped: type: boolean no-color: type: boolean responses: '200': description: Cost diff generated content: text/plain: schema: type: string application/json: schema: $ref: '#/components/schemas/Diff' '400': description: Invalid request '401': description: Missing or invalid API key components: securitySchemes: ApiKeyAuth: type: apiKey in: header name: x-api-key description: Infracost API key schemas: 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 Diff: type: object properties: version: type: string currency: type: string projects: type: array items: $ref: '#/components/schemas/Project' diffTotalHourlyCost: type: string diffTotalMonthlyCost: 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' ResourceBreakdown: type: object properties: resources: type: array items: $ref: '#/components/schemas/Resource' totalHourlyCost: type: string totalMonthlyCost: type: string 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' 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