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

# Showback by tag

> Spend per value of one tag or virtual-tag key with shared costs split by the key's split rules: direct spend, the shared spend each value receives (negative on a shared pool, whose spend moves to its targets), their total, the previous period's total and the change. Each day uses the newest rule that has started by that day; the previous period is split under the rules in force on the last day of the selected period, so the change reflects spend rather than a rule change. Spend with no value for the key is reported as unallocated. Amounts are gross (credits and refunds left out), in the reporting currency, rounded to the cent so values add up exactly to the totals. Spend in a currency with no exchange rate is left out and listed under unconverted. Showback figures are recomputed on every read, so a closed month can still change when its bill is restated. With format=csv or format=xlsx the response is a file with one row per value, the unallocated row and a total row.



## OpenAPI

````yaml /api-reference/costgraph/openapi.json get /api/v1/tenant/cost/showback
openapi: 3.0.0
info:
  description: Read and manage your CostGraph organization, spend, alerts, and settings.
  title: CostGraph API
  contact: {}
  version: '1.0'
servers:
  - url: https://api.costgraph.ai
security: []
tags:
  - name: ai
    x-group: AI
  - name: ai-serving
    x-group: AI serving
  - name: anomalies
    x-group: Anomalies
  - name: auth
    x-group: Auth
  - name: billing
    x-group: Billing
  - name: billing-export
    x-group: Billing export
  - name: budgets
    x-group: Budgets
  - name: ci
    x-group: CI
  - name: compute-recommendations
    x-group: Compute recommendations
  - name: config
    x-group: Config
  - name: context-graph
    x-group: Context graph
  - name: cost
    x-group: Cost
  - name: gpus
    x-group: GPUs
  - name: graphai
    x-group: Graph AI
  - name: integrations
    x-group: Integrations
  - name: invitations
    x-group: Invitations
  - name: kubernetes-clusters
    x-group: Kubernetes clusters
  - name: marketplace
    x-group: Marketplace
  - name: network-requests
    x-group: Network requests
  - name: notifications
    x-group: Notifications
  - name: oauth
    x-group: OAuth
  - name: oauth-clients
    x-group: OAuth clients
  - name: opencost
    x-group: OpenCost
  - name: organization
    x-group: Audit log
  - name: organizations
    x-group: Organizations
  - name: placement-alternatives
    x-group: Placement alternatives
  - name: reports
    x-group: Reports
  - name: service-map
    x-group: Service map
  - name: settings
    x-group: Settings
  - name: sso
    x-group: Single sign-on
  - name: tenants
    x-group: Tenants
  - name: ticketing
    x-group: Ticketing
  - name: user
    x-group: Users
  - name: virtual-machines
    x-group: Virtual machines
  - name: virtual-tags
    x-group: Virtual tags
  - name: workflows
    x-group: Workflows
paths:
  /api/v1/tenant/cost/showback:
    get:
      tags:
        - cost
      summary: Showback by tag
      description: >-
        Spend per value of one tag or virtual-tag key with shared costs split by
        the key's split rules: direct spend, the shared spend each value
        receives (negative on a shared pool, whose spend moves to its targets),
        their total, the previous period's total and the change. Each day uses
        the newest rule that has started by that day; the previous period is
        split under the rules in force on the last day of the selected period,
        so the change reflects spend rather than a rule change. Spend with no
        value for the key is reported as unallocated. Amounts are gross (credits
        and refunds left out), in the reporting currency, rounded to the cent so
        values add up exactly to the totals. Spend in a currency with no
        exchange rate is left out and listed under unconverted. Showback figures
        are recomputed on every read, so a closed month can still change when
        its bill is restated. With format=csv or format=xlsx the response is a
        file with one row per value, the unallocated row and a total row.
      parameters:
        - description: Tenant ID
          name: X-CostGraph-Tenant-ID
          in: header
          required: true
          schema:
            type: string
        - description: Tag or virtual-tag key to show back by
          name: tag_key
          in: query
          required: true
          schema:
            type: string
        - description: >-
            Cost layer; defaults to billed. allocation splits Kubernetes
            clusters into namespaces and workloads; the two are never mixed
          name: layer
          in: query
          schema:
            type: string
            enum:
              - billed
              - allocation
        - description: Cost period; defaults to month_to_date
          name: period
          in: query
          schema:
            type: string
            enum:
              - month_to_date
              - last_7d
              - last_30d
              - calendar_month
              - custom
        - description: >-
            Closed calendar month in YYYY-MM format; required when
            period=calendar_month
          name: month
          in: query
          schema:
            type: string
        - description: Window start in RFC3339 format; required when period=custom
          name: start
          in: query
          schema:
            type: string
        - description: Window end in RFC3339 format; required when period=custom
          name: end
          in: query
          schema:
            type: string
        - description: >-
            ISO 4217 code to express every amount in; defaults to the currency
            most of the period's spend was billed in
          name: reporting_currency
          in: query
          schema:
            type: string
        - description: >-
            Repeated key:value dimension filter, the same vocabulary as the cost
            query filter
          name: filter
          in: query
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
        - description: Response format; defaults to json
          name: format
          in: query
          schema:
            type: string
            enum:
              - json
              - csv
              - xlsx
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/responses.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/cost.Showback'
            text/csv:
              schema:
                allOf:
                  - $ref: '#/components/schemas/responses.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/cost.Showback'
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                allOf:
                  - $ref: '#/components/schemas/responses.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/cost.Showback'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
            text/csv:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
            text/csv:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    responses.SuccessResponse:
      type: object
      required:
        - message
        - status
      properties:
        data: {}
        message:
          type: string
          example: some message
        status:
          type: string
          example: success
    cost.Showback:
      type: object
      properties:
        basis:
          type: string
        byCurrency:
          type: array
          items:
            $ref: '#/components/schemas/cost.CurrencyTotal'
        layer:
          type: string
        previousComparable:
          type: boolean
        reportingCurrency:
          type: string
        tagKey:
          type: string
        totals:
          $ref: '#/components/schemas/cost.ShowbackAmounts'
        unallocated:
          $ref: '#/components/schemas/cost.ShowbackAmounts'
        unconverted:
          type: array
          items:
            $ref: '#/components/schemas/cost.UnconvertedTotal'
        values:
          type: array
          items:
            $ref: '#/components/schemas/cost.ShowbackValue'
    responses.ErrorResponse:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          example: some message
        status:
          type: string
          example: error
    cost.CurrencyTotal:
      type: object
      properties:
        convertedTotal:
          description: >-
            The part of NativeTotal that could be converted, in the reporting
            currency.
          type: number
          x-semantic: costAmount
        currency:
          description: ISO 4217 code the spend was billed in.
          type: string
        effectiveRate:
          description: >-
            Reporting-currency units per unit of Currency, blended over the days
            converted.

            Absent when nothing in this currency could be converted.
          type: number
        latestRateDate:
          description: >-
            Date of the most recent exchange rate applied. Absent when no rate
            was needed.
          type: string
        nativeTotal:
          description: >-
            Spend in the selected period in its billed currency, before
            conversion.
          type: number
          x-semantic: costAmount
        nearestRateUsed:
          description: >-
            Set when some of this spend predates the oldest exchange rate on
            record and was

            converted at the nearest later rate instead.
          type: boolean
    cost.ShowbackAmounts:
      type: object
      properties:
        changeAmount:
          type: number
          x-semantic: costAmount
        changePct:
          type: number
          x-semantic: percentage
        direct:
          type: number
          x-semantic: costAmount
        previous:
          type: number
          x-semantic: costAmount
        share:
          type: number
          x-semantic: percentage
        shared:
          type: number
          x-semantic: costAmount
        total:
          type: number
          x-semantic: costAmount
    cost.UnconvertedTotal:
      type: object
      properties:
        currency:
          description: ISO 4217 code of spend that has no exchange rate on record.
          type: string
        nativeTotal:
          description: >-
            Spend in the selected period left out of every converted total, in
            Currency.
          type: number
          x-semantic: costAmount
    cost.ShowbackValue:
      type: object
      properties:
        changeAmount:
          type: number
          x-semantic: costAmount
        changePct:
          type: number
          x-semantic: percentage
        direct:
          type: number
          x-semantic: costAmount
        previous:
          type: number
          x-semantic: costAmount
        share:
          type: number
          x-semantic: percentage
        shared:
          type: number
          x-semantic: costAmount
        total:
          type: number
          x-semantic: costAmount
        value:
          type: string
  securitySchemes:
    BearerAuth:
      description: Enter "Bearer {token}"
      type: apiKey
      name: Authorization
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.