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

# Search the context graph

> Boxes, connections and signals matching a name or identifier, ranked best first. q needs at least 2 characters and is matched literally. Boxes have the same shape as context graph nodes, plus path, the names of the boxes above each one from the top; connections have the same shape as its links; both ends of every connection are among the boxes. filter narrows the boxes searched to the ones the context graph shows for the same filter, and filters echoes the filters applied.



## OpenAPI

````yaml /api-reference/costgraph/openapi.json get /api/v1/tenant/context-graph/search
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/context-graph/search:
    get:
      tags:
        - context-graph
      summary: Search the context graph
      description: >-
        Boxes, connections and signals matching a name or identifier, ranked
        best first. q needs at least 2 characters and is matched literally.
        Boxes have the same shape as context graph nodes, plus path, the names
        of the boxes above each one from the top; connections have the same
        shape as its links; both ends of every connection are among the boxes.
        filter narrows the boxes searched to the ones the context graph shows
        for the same filter, and filters echoes the filters applied.
      parameters:
        - description: Tenant ID
          name: X-CostGraph-Tenant-ID
          in: header
          schema:
            type: string
        - description: Search text, at least 2 characters
          name: q
          in: query
          required: true
          schema:
            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: >-
            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
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/responses.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/contextgraph.SearchResult'
        '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'
      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.SearchResult:
      type: object
      properties:
        boxes:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Node'
        connections:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Link'
        filters:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        signals:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.SearchSignal'
    responses.ErrorResponse:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          example: some message
        status:
          type: string
          example: error
    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
            - quiet
            - more
        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
        refs:
          $ref: '#/components/schemas/contextgraph.Refs'
        signals:
          type: array
          items:
            $ref: '#/components/schemas/contextgraph.Signal'
        version:
          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.SearchSignal:
      type: object
      properties:
        anomaly_id:
          type: string
          nullable: true
        entity_id:
          type: string
        title:
          type: string
    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:
        cost:
          type: number
          x-semantic: costAmount
        key:
          type: string
          enum:
            - cpu_cores
            - memory_gb
            - gpus
            - running_hours
            - vcpus
            - disk_gb
            - iops
            - throughput_mbps
            - bytes_processed
            - bytes
            - tokens
            - billed_time
            - billed_data
            - billed_storage
            - billed_capacity
            - billed_requests
            - billed_tokens
        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
  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.