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

# Children of a context graph box

> One level of what the tenant runs and pays for as boxes, for a window of up to 90 days (default the last 7 days). Without parent it returns the top-level boxes (accounts and groups, plus a group per provider and kind for boxes that sit in none) with the box-to-box links, coverage, tray, start_here and known_gaps; with parent it returns the children of that box, highest cost first with the entity id as tiebreak (children that show an allocated cost, such as namespaces and workloads, are ranked by that cost), at most group_limit at a time (CONTEXT_GRAPH_CHILD_LIMIT; CONTEXT_GRAPH_TOP_LEVEL_LIMIT without parent), and parent is that box with its total cost. children_total counts every child, including children with no cost; remainder is how many children are not shown after this page and what they cost together. Page on with next_cursor passed as cursor (it costs the same at any depth) or, for the first pages only, group_offset (at most CONTEXT_GRAPH_MAX_OFFSET); cursor and group_offset cannot be combined. include pins a box: pinned_id is set when it is a box in the window and pinned_ancestors lists the boxes above it from the top, so a client opens each level with parent set to the ancestor and include set to the next id on the path; the pinned box leads nodes only when its direct parent is the requested parent (or it is a top-level box and parent is absent) and it never appears twice in a sequence. An include or parent that is not a box in the window is a 400. Money is rounded to cents and an amount under half a cent is 0. period last_7d, last_30d and month_to_date are served from totals rebuilt in the background; their window is the one the last rebuild covered. For a custom or calendar_month window, or with a filter, every amount (the box total, its children, the remainder and the links) is exact for that window and filter; only the order of the children of a box with more than CONTEXT_GRAPH_EXACT_CHILD_THRESHOLD children is taken from the nearest rebuilt period. Unfiltered box totals come from daily totals kept for 92 days. A window older than that or ending after the last rebuild, and every filtered request on such a box, sums the bill instead and is slower. With a filter the remainder of such a box also holds the box's own cost lines. With filter only boxes with matching cost rows are listed. Boxes with more than 2000 boxes inside show their cost, refs, details, signals other than idle and meters other than billed usage, but no breakdown, basis_parts, idle_share, has_infrastructure or billed usage meters; the others carry typed references (refs, primary), details, typed signals, meters (including bill usage per dimension with its cost and, for a host running the CostGraph agent, its hourly price), breakdown shares and basis_parts, idle_share and cluster. Billed and allocated costs are separate layers and never added together. links are the connections touching the boxes of the page. Both ends of a link are boxes the client has: a nodes entry, parent, a box above parent, a top-level box, or a child of a box listed in open. The end that is not shown stands for the nearest such box above the real far entity, and counts, bytes and cost are summed per ends, means and source. At most 3000 links are returned, the most traffic first, and links_truncated says when more exist. With scope=network the response is the whole network: every box that is an end of a network, NAT, forwarding or call link, the boxes above them, every cluster and the boxes above the included box, in one response with all links between them and no paging; parent, group_offset and cursor are not accepted. coverage.bill_only is true when the tenant has only a bill: no flow tracing, no network access granted and no agent reporting. A 503 with code context_graph_building and retry_after_seconds (also sent as Retry-After) means the totals of the tenant are not built yet.



## OpenAPI

````yaml /api-reference/costgraph/openapi.json get /api/v1/tenant/context-graph/children
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
    x-group: Network
  - 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: 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/context-graph/children:
    get:
      tags:
        - context-graph
      summary: Children of a context graph box
      description: >-
        One level of what the tenant runs and pays for as boxes, for a window of
        up to 90 days (default the last 7 days). Without parent it returns the
        top-level boxes (accounts and groups, plus a group per provider and kind
        for boxes that sit in none) with the box-to-box links, coverage, tray,
        start_here and known_gaps; with parent it returns the children of that
        box, highest cost first with the entity id as tiebreak (children that
        show an allocated cost, such as namespaces and workloads, are ranked by
        that cost), at most group_limit at a time (CONTEXT_GRAPH_CHILD_LIMIT;
        CONTEXT_GRAPH_TOP_LEVEL_LIMIT without parent), and parent is that box
        with its total cost. children_total counts every child, including
        children with no cost; remainder is how many children are not shown
        after this page and what they cost together. Page on with next_cursor
        passed as cursor (it costs the same at any depth) or, for the first
        pages only, group_offset (at most CONTEXT_GRAPH_MAX_OFFSET); cursor and
        group_offset cannot be combined. include pins a box: pinned_id is set
        when it is a box in the window and pinned_ancestors lists the boxes
        above it from the top, so a client opens each level with parent set to
        the ancestor and include set to the next id on the path; the pinned box
        leads nodes only when its direct parent is the requested parent (or it
        is a top-level box and parent is absent) and it never appears twice in a
        sequence. An include or parent that is not a box in the window is a 400.
        Money is rounded to cents and an amount under half a cent is 0. period
        last_7d, last_30d and month_to_date are served from totals rebuilt in
        the background; their window is the one the last rebuild covered. For a
        custom or calendar_month window, or with a filter, every amount (the box
        total, its children, the remainder and the links) is exact for that
        window and filter; only the order of the children of a box with more
        than CONTEXT_GRAPH_EXACT_CHILD_THRESHOLD children is taken from the
        nearest rebuilt period. Unfiltered box totals come from daily totals
        kept for 92 days. A window older than that or ending after the last
        rebuild, and every filtered request on such a box, sums the bill instead
        and is slower. With a filter the remainder of such a box also holds the
        box's own cost lines. With filter only boxes with matching cost rows are
        listed. Boxes with more than 2000 boxes inside show their cost, refs,
        details, signals other than idle and meters other than billed usage, but
        no breakdown, basis_parts, idle_share, has_infrastructure or billed
        usage meters; the others carry typed references (refs, primary),
        details, typed signals, meters (including bill usage per dimension with
        its cost and, for a host running the CostGraph agent, its hourly price),
        breakdown shares and basis_parts, idle_share and cluster. Billed and
        allocated costs are separate layers and never added together. links are
        the connections touching the boxes of the page. Both ends of a link are
        boxes the client has: a nodes entry, parent, a box above parent, a
        top-level box, or a child of a box listed in open. The end that is not
        shown stands for the nearest such box above the real far entity, and
        counts, bytes and cost are summed per ends, means and source. At most
        3000 links are returned, the most traffic first, and links_truncated
        says when more exist. With scope=network the response is the whole
        network: every box that is an end of a network, NAT, forwarding or call
        link, the boxes above them, every cluster and the boxes above the
        included box, in one response with all links between them and no paging;
        parent, group_offset and cursor are not accepted. coverage.bill_only is
        true when the tenant has only a bill: no flow tracing, no network access
        granted and no agent reporting. A 503 with code context_graph_building
        and retry_after_seconds (also sent as Retry-After) means the totals of
        the tenant are not built yet.
      parameters:
        - description: Tenant ID
          name: X-CostGraph-Tenant-ID
          in: header
          schema:
            type: string
        - description: Box whose children to return; omit for the top-level boxes
          name: parent
          in: query
          schema:
            type: string
        - description: Box to pin at the top of its level and return the ancestors of
          name: include
          in: query
          schema:
            type: string
        - description: >-
            Boxes the client has expanded (repeat the parameter or
            comma-separated); only decides which box a link to a box that is not
            shown points at
          name: open
          in: query
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
        - description: Window; defaults to last_7d
          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: >-
            Return the whole network graph in one response; only network is
            accepted
          name: scope
          in: query
          schema:
            type: string
            enum:
              - network
        - description: >-
            Repeated key:value dimension filter, same keys and modifiers as
            /cost/query
          name: filter
          in: query
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
        - description: Children per page; defaults to and is at most the server limit
          name: group_limit
          in: query
          schema:
            type: integer
        - description: >-
            Children to skip, at most the server limit; cannot be combined with
            cursor
          name: group_offset
          in: query
          schema:
            type: integer
        - description: next_cursor of the previous page
          name: cursor
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/responses.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/contextgraph.ChildrenPage'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.ContextGraphBuildingResponse'
      security:
        - BearerAuth: []
        - ApiKeyAuth: []
components:
  schemas:
    responses.SuccessResponse:
      type: object
      required:
        - message
        - status
      properties:
        data: {}
        message:
          type: string
          example: some message
        status:
          type: string
          example: success
    contextgraph.ChildrenPage:
      type: object
      properties:
        children_total:
          type: integer
        coverage:
          $ref: '#/components/schemas/contextgraph.Coverage'
        known_gaps:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Gap'
        links:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Link'
        links_truncated:
          type: boolean
        next_cursor:
          type: string
          nullable: true
        nodes:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Node'
        parent:
          allOf:
            - $ref: '#/components/schemas/contextgraph.Node'
          nullable: true
        pinned_ancestors:
          type: array
          items:
            type: string
        pinned_id:
          type: string
          nullable: true
        remainder:
          $ref: '#/components/schemas/contextgraph.Remainder'
        start_here:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Finding'
        tray:
          $ref: '#/components/schemas/contextgraph.Tray'
        window:
          $ref: '#/components/schemas/contextgraph.Window'
    responses.ErrorResponse:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          example: some message
        status:
          type: string
          example: error
    controllers.ContextGraphBuildingResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - context_graph_building
        message:
          type: string
          example: The context graph is being built for this tenant
        retry_after_seconds:
          type: integer
        status:
          type: string
          example: error
    contextgraph.Coverage:
      type: object
      properties:
        bill_only:
          type: boolean
        flow_tracing:
          type: boolean
        network_inventory:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.InventoryStatus'
        private_bytes_resolved:
          type: number
        private_bytes_total:
          type: number
    contextgraph.Gap:
      type: object
      properties:
        bytes:
          type: number
        code:
          type: string
          enum:
            - no_network_inventory
            - unnamed_private_traffic
            - unnamed_private_traffic_granted
            - no_network_tracing
            - bill_only
            - estimated_split
        entity_ids:
          type: array
          items:
            type: string
        provider:
          type: string
    contextgraph.Link:
      type: object
      properties:
        a:
          type: string
        b:
          type: string
        bytes:
          type: number
        cost:
          type: number
          x-semantic: costAmount
          nullable: true
        count:
          type: integer
        direction:
          type: string
          enum:
            - in
            - out
            - both
          nullable: true
        id:
          type: string
        means:
          type: string
          enum:
            - runs_on
            - mounts
            - backed_by
            - network
            - through_nat
            - forwards_to
            - calls
            - billed_under
        nat_share:
          type: number
          x-semantic: costAmount
          nullable: true
        port:
          type: integer
          nullable: true
        source:
          type: string
          enum:
            - inventory
            - observed
            - configured
            - inferred
        write_share:
          type: number
          nullable: true
    contextgraph.Node:
      type: object
      properties:
        basis:
          type: string
          enum:
            - billed
            - allocated
            - not_billed
        basis_parts:
          type: array
          items:
            type: string
            enum:
              - nodes
              - vms
              - disks
              - load_balancers
              - nat_gateways
              - vpc_endpoints
              - network_interfaces
              - managed_databases
              - managed_caches
              - file_systems
              - clusters
              - accounts
              - saas_services
              - ai_models
              - groups
              - data_transfer
        breakdown_allocated:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Breakdown'
        breakdown_billed:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Breakdown'
        child_count:
          type: integer
        cluster:
          type: string
        cost:
          type: number
          x-semantic: costAmount
        filter_match:
          type: string
          enum:
            - direct
            - connected
        flavour:
          type: string
          enum:
            - eks
            - gke
            - aks
            - Deployment
            - StatefulSet
            - DaemonSet
            - CronJob
            - Job
            - ReplicaSet
            - Pod
            - Service
            - Rollout
          nullable: true
        gpu_model:
          type: string
        group:
          type: string
          enum:
            - service
            - db_cluster
            - cache_group
            - endpoints
            - unplaced
        has_infrastructure:
          type: boolean
        id:
          type: string
        idle_share:
          type: number
        instance_type:
          type: string
        kind:
          type: string
        meters:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Meter'
        name:
          type: string
        open:
          type: boolean
        parent_id:
          type: string
          nullable: true
        path:
          type: array
          items:
            type: string
        primary:
          type: string
          enum:
            - node
            - vm
            - workload
            - pv
            - cluster
            - cost_tree
          nullable: true
        provider:
          type: string
        provider_name:
          type: string
        refs:
          $ref: '#/components/schemas/contextgraph.Refs'
        signals:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Signal'
        version:
          type: string
    contextgraph.Remainder:
      type: object
      properties:
        cost:
          type: number
          x-semantic: costAmount
        count:
          type: integer
    contextgraph.Finding:
      type: object
      properties:
        anomaly_id:
          type: string
        code:
          type: string
          enum:
            - idle_capacity
            - nat_cost
            - disk_iops_use
            - anomaly
            - recommendation
        cost:
          type: number
          x-semantic: costAmount
        entity_id:
          type: string
        period:
          type: string
          enum:
            - window
        share:
          type: number
    contextgraph.Tray:
      type: object
      properties:
        billed:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.BilledProvider'
        seen:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.SeenProvider'
    contextgraph.Window:
      type: object
      properties:
        end:
          type: string
        filters:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        start:
          type: string
    contextgraph.InventoryStatus:
      type: object
      properties:
        connection_id:
          type: string
        projects:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.ProjectInventoryStatus'
        provider:
          type: string
          enum:
            - aws
            - gcp
            - azure
        status:
          type: string
          enum:
            - granted
            - missing
            - partial
            - unknown
        template_url:
          type: string
          nullable: true
    contextgraph.Breakdown:
      type: object
      properties:
        cost:
          type: number
          x-semantic: costAmount
        estimate:
          type: boolean
        key:
          type: string
        share:
          type: number
          nullable: true
    contextgraph.Meter:
      type: object
      properties:
        amortization_months:
          type: integer
        cost:
          type: number
          x-semantic: costAmount
        key:
          type: string
          enum:
            - cpu_cores
            - memory_gb
            - gpus
            - running_hours
            - vcpus
            - price_per_hour
            - disk_gb
            - iops
            - throughput_mbps
            - bytes_processed
            - bytes
            - tokens
            - billed_time
            - billed_data
            - billed_storage
            - billed_capacity
            - billed_requests
            - billed_tokens
        list_price:
          type: number
          x-semantic: costAmount
        price_source:
          type: string
          enum:
            - catalog
            - pin
        provisioned:
          type: number
          nullable: true
        unit:
          type: string
        value:
          type: number
    contextgraph.Refs:
      type: object
      properties:
        bill_resource_id:
          type: string
        cluster_id:
          type: string
        gpu_uuids:
          type: array
          items:
            type: string
        network_endpoint_id:
          type: string
        node_id:
          type: string
        provider:
          type: string
        provider_connected:
          type: boolean
        pv_resource_id:
          type: string
        pvc_resource_id:
          type: string
        vm_host_id:
          type: string
        workload_resource_id:
          type: string
    contextgraph.Signal:
      type: object
      properties:
        actions:
          type: array
          items:
            type: string
        anomaly_id:
          type: string
        anomaly_type:
          type: string
        code:
          type: string
          enum:
            - unnamed_private_traffic
            - unnamed_private_traffic_granted
            - no_network_tracing
        containers:
          type: array
          items:
            type: string
        count:
          type: integer
        description:
          type: string
        idle:
          type: boolean
        idle_cost:
          type: number
          x-semantic: costAmount
        idle_share:
          type: number
        kind:
          type: string
          enum:
            - anomaly
            - recommendation
            - idle
            - data_note
        recommended_instance_type:
          type: string
        savings_currency:
          type: string
        savings_monthly:
          type: number
          x-semantic: costAmount
        target:
          type: string
          enum:
            - node
            - vm
            - workload
            - pv
            - provider
        target_provider:
          type: string
        target_service:
          type: string
        title:
          type: string
    contextgraph.BilledProvider:
      type: object
      properties:
        cost:
          type: number
          x-semantic: costAmount
        provider:
          type: string
    contextgraph.SeenProvider:
      type: object
      properties:
        bytes:
          type: number
        connections:
          type: integer
        provider:
          type: string
    contextgraph.ProjectInventoryStatus:
      type: object
      properties:
        project:
          type: string
        status:
          type: string
          enum:
            - granted
            - missing
            - partial
            - unknown
  securitySchemes:
    BearerAuth:
      description: Enter "Bearer {token}"
      type: apiKey
      name: Authorization
      in: header
    ApiKeyAuth:
      description: API key for machine-to-machine authentication
      type: apiKey
      name: X-API-Key
      in: header

````

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