> ## 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.

> ## Agent Instructions
> If the person you are helping needs a new Vantage account, read https://docs.vantage.sh/auth.md before you register one.

# Update a custom calculation

> Update a CustomCalculation. Read-only calculations allow attachment changes only; is_read_only cannot be changed.



## OpenAPI

````yaml https://api.vantage.sh/v2/oas_v3.json put /custom_calculations/{custom_calculation_token}
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: AccessPolicies
    description: Operations about AccessPolicies
  - name: Annotations
    description: Operations about Annotations
  - 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: CustomCalculations
    description: Operations about CustomCalculations
  - name: DashboardNotifications
    description: Operations about DashboardNotifications
  - name: Dashboards
    description: Operations about Dashboards
  - name: DataExports
    description: Operations about DataExports
  - name: EnrichmentSources
    description: Operations about EnrichmentSources
  - name: EnrichmentStatistics
    description: Operations about EnrichmentStatistics
  - 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: IngestTokens
    description: Operations about IngestTokens
  - 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: NetworkFlowLogs
    description: Operations about NetworkFlowLogs
  - 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: ReportForecasts
    description: Operations about ReportForecasts
  - 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: ScenarioModels
    description: Operations about ScenarioModels
  - 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:
  /custom_calculations/{custom_calculation_token}:
    put:
      tags:
        - CustomCalculations
      summary: Update a custom calculation
      description: >-
        Update a CustomCalculation. Read-only calculations allow attachment
        changes only; is_read_only cannot be changed.
      operationId: updateCustomCalculation
      parameters:
        - name: custom_calculation_token
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/updateCustomCalculation'
        required: true
      responses:
        '200':
          description: >-
            Update a CustomCalculation. Read-only calculations allow attachment
            changes only; is_read_only cannot be changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomCalculation'
              example:
                token: cstm_clcltn_57392aa904ac64ba
                title: Updated calculation
                description: null
                operation: average
                filter:
                  type: sum
                  filter: costs.provider = 'aws'
                  usage_unit: null
                display_as: per-n
                unit_scale: 1000
                is_read_only: false
                cost_report_tokens: []
                created_at: '2026-10-22T12:00:00Z'
                updated_at: '2026-10-22T12:00:00Z'
        '400':
          description: BadRequest
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '404':
          description: NotFound
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '422':
          description: UnprocessableEntity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
      security:
        - oauth2:
            - write
components:
  schemas:
    updateCustomCalculation:
      type: object
      properties:
        title:
          type: string
          description: The title of the Custom Calculation.
          x-omitempty: true
        filter:
          $ref: '#/components/schemas/CustomCalculationFilter'
        description:
          type: string
          description: >-
            An optional description, up to 10000 characters. Send null or an
            empty string to clear; omit on update to leave unchanged.
          nullable: true
          x-omitempty: true
        operation:
          type: string
          description: >-
            The operation applied to the filtered cost or usage data. Defaults
            to sum when creating a calculation.
          enum:
            - sum
            - average
            - division
            - min
            - max
          x-omitempty: true
        display_as:
          type: string
          description: >-
            The display format of the calculation. Defaults to ratio when
            creating a calculation.
          enum:
            - ratio
            - percent
            - per-n
          x-omitempty: true
        unit_scale:
          type: integer
          description: >-
            The integer unit scale of the calculation. Send null to reset to 1.
            Defaults to 1 on create; omit on update to leave unchanged.
          format: int32
          nullable: true
          x-omitempty: true
        cost_report_tokens:
          type: array
          description: >-
            The complete replacement set of CostReport tokens to attach. An
            empty array clears all attachments; omission or null leaves them
            unchanged. Replacement requires access to every currently attached
            CostReport.
          items:
            type: string
          x-omitempty: false
      description: >-
        Update a CustomCalculation. Read-only calculations allow attachment
        changes only; is_read_only cannot be changed.
    CustomCalculation:
      required:
        - cost_report_tokens
        - created_at
        - description
        - display_as
        - filter
        - is_read_only
        - operation
        - title
        - token
        - unit_scale
        - updated_at
      type: object
      properties:
        token:
          type: string
          description: The token of the CustomCalculation.
          nullable: false
          example: cstm_clcltn_1234
        title:
          type: string
          description: The title of the Custom Calculation.
          nullable: false
        description:
          type: string
          description: The description of the calculation, or null when blank.
          nullable: true
        operation:
          type: string
          description: The operation applied to the filtered cost or usage data.
          nullable: false
          enum:
            - sum
            - average
            - division
            - min
            - max
        filter:
          $ref: '#/components/schemas/CustomCalculationFilter'
        display_as:
          type: string
          description: The display format of the calculation.
          nullable: false
          enum:
            - ratio
            - percent
            - per-n
        unit_scale:
          type: integer
          description: The integer unit scale of the calculation.
          format: int32
          nullable: false
        is_read_only:
          type: boolean
          description: Whether the calculation is read only.
          nullable: false
        cost_report_tokens:
          type: array
          description: The tokens of the attached CostReports visible to the caller.
          nullable: false
          items:
            type: string
        created_at:
          type: string
          description: When the calculation was created, in ISO 8601 format.
          nullable: false
        updated_at:
          type: string
          description: When the calculation was last updated, in ISO 8601 format.
          nullable: false
      description: CustomCalculation model
    Errors:
      required:
        - errors
      type: object
      properties:
        links:
          $ref: '#/components/schemas/Links'
        errors:
          type: array
          nullable: false
          items:
            type: string
      description: Errors model
    CustomCalculationFilter:
      type: object
      properties:
        type:
          type: string
          description: >-
            The calculation operation. Use filter and usage_unit for aggregate
            operations, or the numerator and denominator fields for division.
          nullable: true
        filter:
          type: string
          description: The VQL filter for a sum, average, min, or max calculation.
          nullable: true
        filter_numerator:
          type: string
          description: The VQL filter for the numerator of a division calculation.
          nullable: true
        filter_denominator:
          type: string
          description: The VQL filter for the denominator of a division calculation.
          nullable: true
        usage_unit:
          type: object
          description: >-
            A usage unit, a non-empty array of equivalent unit names, or null
            for costs. Omission also selects costs. Arrays sum usage without
            converting units.
          nullable: true
          oneOf:
            - type: string
              nullable: true
            - type: array
              items:
                type: string
                pattern: \S
              minItems: 1
        usage_unit_numerator:
          type: object
          description: >-
            A usage unit, a non-empty array of equivalent unit names, or null
            for costs. Omission also selects costs. Arrays sum usage without
            converting units.
          nullable: true
          oneOf:
            - type: string
              nullable: true
            - type: array
              items:
                type: string
                pattern: \S
              minItems: 1
        usage_unit_denominator:
          type: object
          description: >-
            A usage unit, a non-empty array of equivalent unit names, or null
            for costs. Omission also selects costs. Arrays sum usage without
            converting units.
          nullable: true
          oneOf:
            - type: string
              nullable: true
            - type: array
              items:
                type: string
                pattern: \S
              minItems: 1
    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

````

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