> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vantage.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Create cost report

> Create a CostReport.



## OpenAPI

````yaml https://api.vantage.sh/v2/oas_v3.json post /cost_reports
openapi: 3.0.1
info:
  title: Vantage
  description: Vantage API
  termsOfService: https://www.vantage.sh/terms-of-use
  contact:
    name: Vantage Support
    url: https://www.vantage.sh
    email: support@vantage.sh
  version: 2.0.0
servers:
  - url: https://api.vantage.sh/v2
security:
  - oauth2:
      - read
tags:
  - name: AccessGrants
    description: Operations about AccessGrants
  - name: AnomalyAlerts
    description: Operations about AnomalyAlerts
  - name: AnomalyNotifications
    description: Operations about AnomalyNotifications
  - name: AuditLogs
    description: Operations about AuditLogs
  - name: BillingProfiles
    description: Operations about BillingProfiles
  - name: BillingRules
    description: Operations about BillingRules
  - name: BudgetAlerts
    description: Operations about BudgetAlerts
  - name: Budgets
    description: Operations about Budgets
  - name: BusinessMetrics
    description: Operations about BusinessMetrics
  - name: Canvases
    description: Operations about Canvases
  - name: CostAlertEvents
    description: Operations about CostAlertEvents
  - name: CostAlerts
    description: Operations about CostAlerts
  - name: CostProvider
    description: Operations about CostProviders
  - name: CostProviderAccounts
    description: Operations about CostProviderAccounts
  - name: Costs
    description: Operations about Costs
  - name: CostService
    description: Operations about CostServices
  - name: Dashboards
    description: Operations about Dashboards
  - name: DataExports
    description: Operations about DataExports
  - name: ExchangeRates
    description: Operations about ExchangeRates
  - name: FinancialCommitmentReports
    description: Operations about FinancialCommitmentReports
  - name: FinancialCommitments
    description: Operations about FinancialCommitments
  - name: Folders
    description: Operations about Folders
  - name: Integrations
    description: Operations about Integrations
  - name: Invoices
    description: Operations about Invoices
  - name: KubernetesEfficiencyReports
    description: Operations about KubernetesEfficiencyReports
  - name: ManagedAccounts
    description: Operations about ManagedAccounts
  - name: Me
    description: Operations about Mes
  - name: NetworkFlowReports
    description: Operations about NetworkFlowReports
  - name: OpenAPISpecification
    description: Operations about OpenAPISpecifications
  - name: Ping
    description: Operations about Pings
  - name: Prices
    description: Operations about Prices
  - name: Recommendations
    description: Operations about Recommendations
  - name: RecommendationViews
    description: Operations about RecommendationViews
  - name: ReportNotifications
    description: Operations about ReportNotifications
  - name: ResourceReports
    description: Operations about ResourceReports
  - name: Resources
    description: Operations about Resources
  - name: SavedFilters
    description: Operations about SavedFilters
  - name: Segments
    description: Operations about Segments
  - name: Tags
    description: Operations about Tags
  - name: Teams
    description: Operations about Teams
  - name: UnitCosts
    description: Operations about UnitCosts
  - name: UserFeedback
    description: Operations about UserFeedbacks
  - name: Users
    description: Operations about Users
  - name: VirtualTags
    description: Operations about VirtualTags
  - name: Workspaces
    description: Operations about Workspaces
paths:
  /cost_reports:
    post:
      tags:
        - Costs
      summary: Create cost report
      description: Create a CostReport.
      operationId: createCostReport
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createCostReport'
        required: true
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CostReport'
              example:
                token: rprt_299359872859a568
                title: New Cost Report
                folder_token: fldr_736175272c30b820
                saved_filter_tokens:
                  - svd_fltr_3cf17b5bd79e849c
                business_metric_tokens_with_metadata:
                  - business_metric_token: bsnss_mtrc_b90d5fe5fbff292d
                    unit_scale: per_thousand
                    label_filter:
                      - CBGB
                      - Roxy
                      - Studio 54
                      - ''
                default_forecast:
                  kind: baseline
                filter: >-
                  costs.provider = 'aws' AND costs.service = 'Amazon Simple
                  Storage Service'
                groupings: service,provider
                settings:
                  include_credits: false
                  include_refunds: false
                  include_discounts: true
                  include_tax: true
                  amortize: true
                  unallocated: false
                  aggregate_by: cost
                  show_previous_period: true
                  complete_period: false
                created_at: '2024-07-03T00:00:00Z'
                workspace_token: wrkspc_9e2675148d6275f8
                previous_period_start_date: null
                previous_period_end_date: null
                start_date: '2024-07-01'
                end_date: '2024-07-31'
                date_interval: this_month
                chart_type: bar
                date_bin: day
                chart_settings:
                  y_axis_dimension: cost
                  x_axis_dimension:
                    - date
        '400':
          description: BadRequest
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '422':
          description: UnprocessableEntity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      security:
        - oauth2:
            - write
components:
  schemas:
    createCostReport:
      required:
        - end_date
        - previous_period_end_date
        - title
      type: object
      properties:
        title:
          type: string
          description: The title of the CostReport.
        workspace_token:
          type: string
          description: >-
            The token of the Workspace to add the Cost Report to. Ignored if
            'folder_token' is set. Required if the API token is associated with
            multiple Workspaces.
        groupings:
          type: string
          description: >-
            Grouping values for aggregating costs on the report. Valid
            groupings: account_id, billing_account_id, charge_type,
            cost_category, cost_subcategory, provider, region, resource_id,
            service, tagged, tag:<tag_value>. If providing multiple groupings,
            join as comma separated values: groupings=provider,service,region
        filter:
          type: string
          description: >-
            The filter query language to apply to the CostReport. Additional
            documentation available at https://docs.vantage.sh/vql.
        saved_filter_tokens:
          type: array
          description: The tokens of the SavedFilters to apply to the CostReport.
          items:
            type: string
        business_metric_tokens_with_metadata:
          type: array
          description: >-
            The tokens for any BusinessMetrics to attach to the CostReport, and
            the unit scale.
          items:
            required:
              - business_metric_token
            type: object
            properties:
              business_metric_token:
                type: string
                description: The token of the BusinessMetric to attach to the CostReport.
              unit_scale:
                type: string
                description: >-
                  Determines the scale of the BusinessMetric's values within the
                  CostReport.
                default: per_unit
                enum:
                  - per_unit
                  - per_hundred
                  - per_thousand
                  - per_million
                  - per_billion
              label_filter:
                type: array
                description: Include only values with these labels in the CostReport.
                items:
                  type: string
        folder_token:
          type: string
          description: >-
            The token of the Folder to add the CostReport to. Determines the
            Workspace the report is assigned to.
        settings:
          type: object
          properties:
            include_credits:
              type: boolean
              description: Report will include credits.
              default: false
            include_refunds:
              type: boolean
              description: Report will include refunds.
              default: false
            include_discounts:
              type: boolean
              description: Report will include discounts.
              default: true
            include_tax:
              type: boolean
              description: Report will include tax.
              default: true
            amortize:
              type: boolean
              description: Report will amortize.
              default: true
            unallocated:
              type: boolean
              description: Report will show unallocated costs.
              default: false
            aggregate_by:
              type: string
              description: Report will aggregate by cost or usage.
              default: cost
            show_previous_period:
              type: boolean
              description: Report will show previous period costs or usage comparison.
              default: true
            complete_period:
              type: boolean
              description: Report will restrict date ranges to completed periods only.
              default: false
          description: Report settings.
        previous_period_start_date:
          type: string
          description: >-
            The previous period start date of the CostReport. ISO 8601
            Formatted.
        previous_period_end_date:
          type: string
          description: >-
            The previous period end date of the CostReport. ISO 8601 Formatted.
            Required when previous_period_start_date is provided.
        start_date:
          type: string
          description: >-
            The start date of the CostReport. ISO 8601 Formatted. Incompatible
            with 'date_interval' parameter.
        end_date:
          type: string
          description: >-
            The end date of the CostReport. ISO 8601 Formatted. Required when
            start_date is provided. Incompatible with 'date_interval' parameter.
        date_interval:
          type: string
          description: >-
            The date interval of the CostReport. Incompatible with 'start_date'
            and 'end_date' parameters. Defaults to 'this_month' if start_date
            and end_date are not provided.
          enum:
            - this_month
            - last_7_days
            - last_30_days
            - last_month
            - last_3_months
            - last_6_months
            - custom
            - last_12_months
            - last_24_months
            - last_36_months
            - next_month
            - next_3_months
            - next_6_months
            - next_12_months
            - year_to_date
            - last_3_days
            - last_14_days
        chart_type:
          type: string
          description: The chart type of the CostReport.
          default: line
          enum:
            - area
            - line
            - pie
            - bar
            - multi_bar
        date_bin:
          type: string
          description: The date bin of the CostReport.
          default: cumulative
          enum:
            - cumulative
            - day
            - week
            - month
            - quarter
            - hour
        chart_settings:
          type: object
          properties:
            x_axis_dimension:
              type: array
              description: >-
                The dimension used to group or label data along the x-axis
                (e.g., by date, region, or service). NOTE: Only one value is
                allowed at this time. Defaults to ['date'].
              items:
                type: string
            y_axis_dimension:
              type: string
              description: >-
                The metric or measure displayed on the chart’s y-axis. Possible
                values: 'cost', 'usage'. Defaults to 'cost'.
          description: Report chart settings.
      description: Create a CostReport.
    CostReport:
      required:
        - business_metric_tokens_with_metadata
        - chart_settings
        - chart_type
        - created_at
        - date_bin
        - date_interval
        - default_forecast
        - filter
        - title
        - token
        - workspace_token
      type: object
      properties:
        token:
          type: string
          nullable: false
        title:
          type: string
          description: The title of the CostReport.
          nullable: false
          example: Production Environment
        folder_token:
          type: string
          description: The token for the Folder the CostReport is a part of.
          nullable: true
        saved_filter_tokens:
          type: array
          description: The tokens for the SavedFilters assigned to the CostReport.
          nullable: true
          items:
            type: string
        business_metric_tokens_with_metadata:
          type: array
          description: >-
            The tokens for the BusinessMetrics assigned to the CostReport, the
            unit scale, and label filter.
          items:
            $ref: '#/components/schemas/AttachedBusinessMetricForCostReport'
        default_forecast:
          type: object
          properties: {}
          description: The default forecast selection for the CostReport.
          nullable: false
          example:
            kind: baseline
        filter:
          type: string
          description: >-
            The filter applied to the CostReport. Additional documentation
            available at https://docs.vantage.sh/vql.
          nullable: true
        groupings:
          type: string
          description: The grouping aggregations applied to the filtered data.
          nullable: true
          example: provider, service
        settings:
          type: object
          properties:
            include_credits:
              type: boolean
              description: Report will include credits.
              nullable: true
              default: false
            include_refunds:
              type: boolean
              description: Report will include refunds.
              nullable: true
              default: false
            include_discounts:
              type: boolean
              description: Report will include discounts.
              nullable: true
              default: true
            include_tax:
              type: boolean
              description: Report will include tax.
              nullable: true
              default: true
            amortize:
              type: boolean
              description: Report will amortize.
              nullable: true
              default: true
            unallocated:
              type: boolean
              description: Report will show unallocated costs.
              nullable: true
              default: false
            aggregate_by:
              type: string
              description: Report will aggregate by cost or usage.
              nullable: true
              default: cost
            show_previous_period:
              type: boolean
              description: Report will show previous period costs or usage comparison.
              nullable: true
              default: true
            complete_period:
              type: boolean
              description: Report will restrict date ranges to completed periods only.
              nullable: true
              default: false
          description: Report settings.
        created_at:
          type: string
          description: >-
            The date and time, in UTC, the report was created. ISO 8601
            Formatted.
          nullable: false
          example: '2021-07-09T00:00:00Z'
        workspace_token:
          type: string
          description: The token for the Workspace the CostReport is a part of.
          nullable: false
        previous_period_start_date:
          type: string
          description: >-
            The previous period start date of the CostReport. ISO 8601
            Formatted.
          nullable: true
          example: '2024-06-01'
        previous_period_end_date:
          type: string
          description: The previous period end date of the CostReport. ISO 8601 Formatted.
          nullable: true
          example: '2024-06-15'
        start_date:
          type: string
          description: >-
            The start date of the CostReports. ISO 8601 Formatted. Overwrites
            'date_interval' if set.
          nullable: true
          example: '2024-07-01'
        end_date:
          type: string
          description: >-
            The end date of the CostReports. ISO 8601 Formatted. Overwrites
            'date_interval' if set.
          nullable: true
          example: '2024-07-15'
        date_interval:
          type: string
          description: The date interval of the CostReport.
          nullable: false
        chart_type:
          type: string
          description: The chart type of the CostReport.
          nullable: false
        date_bin:
          type: string
          description: The date bin of the CostReport.
          nullable: false
        chart_settings:
          $ref: '#/components/schemas/ChartSettings'
      description: CostReport model
    Errors:
      required:
        - errors
      type: object
      properties:
        links:
          $ref: '#/components/schemas/Links'
        errors:
          type: array
          nullable: false
          items:
            type: string
      description: Errors model
    AttachedBusinessMetricForCostReport:
      required:
        - business_metric_token
        - calculation_type
        - unit_scale
      type: object
      properties:
        business_metric_token:
          type: string
          description: The token of the BusinessMetric that's attached to the CostReport.
          nullable: false
          example: bsnss_mtrc_1234
        unit_scale:
          type: string
          description: >-
            Determines the scale of the BusinessMetric's values within a
            particular CostReport.
          nullable: false
          example: per_hundred
          enum:
            - per_unit
            - per_hundred
            - per_thousand
            - per_million
            - per_billion
        calculation_type:
          type: string
          description: >-
            The calculation type applied when this BusinessMetric is used in the
            CostReport.
          nullable: false
          example: unit_cost
          enum:
            - unit_cost
            - gross_margin
            - usage_unit_cost
            - raw_business_metric
        label_filter:
          type: array
          description: >-
            The labels that the BusinessMetric is filtered by within a
            particular CostReport.
          nullable: true
          items:
            type: string
            example: ''
          x-omitempty: true
    ChartSettings:
      required:
        - x_axis_dimension
        - y_axis_dimension
      type: object
      properties:
        y_axis_dimension:
          type: string
          description: >-
            The metric or measure displayed on the chart’s y-axis. Possible
            values: 'cost', 'usage'. Defaults to 'cost'.
          nullable: false
        x_axis_dimension:
          type: array
          description: >-
            The dimension used to group or label data along the x-axis (e.g., by
            date, region, or service). NOTE: Only one value is allowed at this
            time. Defaults to ['date'].
          nullable: false
          items:
            type: string
    Links:
      type: object
      properties:
        self:
          type: string
          description: The URL of the current page of results.
          nullable: true
        first:
          type: string
          description: The URL of the first page of results.
          nullable: true
        next:
          type: string
          description: The URL of the next page of results, if one exists.
          nullable: true
        last:
          type: string
          description: The URL of the last page of results, if one exists.
          nullable: true
        prev:
          type: string
          description: The URL of the previous page of results, if one exists.
          nullable: true
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://console.vantage.sh/account/profile
          scopes:
            read: Grants read access
            write: Grants write access

````