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

# Report sandboxes starting and stopping

> Records 1 to 100 sandbox events. started records the sandbox with the USD price per hour for its size at that moment; send size_class, or vcpus and memory_mib, or decision_id alone to use the size routed by that decision. A start with no size, from either, is priced at the provider's default size when the price list gives one, and the sandbox is listed with that size, where vcpus can be fractional, and default_size true. decision_id from a routing answer links the sandbox to it; an unknown decision_id is ignored. When that answer moved the sandbox off the team's first provider and the sandbox started there at the routed size, the first provider's price and billing rules are kept to measure savings. A repeated started event for a sandbox is ignored. stopped records when the sandbox stopped, never before it started; a stop that arrives before its start is kept until the start arrives, for up to 2 days, and a second stop is ignored. at defaults to now and is moved into the last 24 hours. sandbox_id holds up to 256 characters; metadata holds at most 20 string tags, keys up to 64 and values up to 256 characters; none may contain control characters. Any invalid event rejects the whole request. Events are recorded even while the organization's billing needs attention. Too many requests in a short time answer 429.



## OpenAPI

````yaml /api-reference/costgraph/openapi.json post /api/v1/tenant/sandboxes/events
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: sandboxes
    x-group: Sandboxes
  - 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/sandboxes/events:
    post:
      tags:
        - sandboxes
      summary: Report sandboxes starting and stopping
      description: >-
        Records 1 to 100 sandbox events. started records the sandbox with the
        USD price per hour for its size at that moment; send size_class, or
        vcpus and memory_mib, or decision_id alone to use the size routed by
        that decision. A start with no size, from either, is priced at the
        provider's default size when the price list gives one, and the sandbox
        is listed with that size, where vcpus can be fractional, and
        default_size true. decision_id from a routing answer links the sandbox
        to it; an unknown decision_id is ignored. When that answer moved the
        sandbox off the team's first provider and the sandbox started there at
        the routed size, the first provider's price and billing rules are kept
        to measure savings. A repeated started event for a sandbox is ignored.
        stopped records when the sandbox stopped, never before it started; a
        stop that arrives before its start is kept until the start arrives, for
        up to 2 days, and a second stop is ignored. at defaults to now and is
        moved into the last 24 hours. sandbox_id holds up to 256 characters;
        metadata holds at most 20 string tags, keys up to 64 and values up to
        256 characters; none may contain control characters. Any invalid event
        rejects the whole request. Events are recorded even while the
        organization's billing needs attention. Too many requests in a short
        time answer 429.
      parameters:
        - description: Tenant ID
          name: X-CostGraph-Tenant-ID
          in: header
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/sandbox.EventsRequest'
        description: Sandbox events
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/responses.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/sandbox.EventsResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    sandbox.EventsRequest:
      type: object
      required:
        - events
      properties:
        events:
          type: array
          maxItems: 100
          minItems: 1
          items:
            $ref: '#/components/schemas/sandbox.Event'
    responses.SuccessResponse:
      type: object
      required:
        - message
        - status
      properties:
        data: {}
        message:
          type: string
          example: some message
        status:
          type: string
          example: success
    sandbox.EventsResponse:
      type: object
      required:
        - accepted
      properties:
        accepted:
          type: integer
    responses.ErrorResponse:
      type: object
      required:
        - message
        - status
      properties:
        message:
          type: string
          example: some message
        status:
          type: string
          example: error
    sandbox.Event:
      type: object
      required:
        - provider
        - sandbox_id
        - type
      properties:
        at:
          type: string
          nullable: true
        decision_id:
          type: string
        memory_mib:
          type: integer
          maximum: 4194304
          minimum: 1
        metadata:
          type: object
          additionalProperties:
            type: string
        provider:
          type: string
          example: e2b
        sandbox_id:
          type: string
          maxLength: 256
        size_class:
          type: string
          enum:
            - ''
            - xs
            - sm
            - md
            - lg
            - xl
            - 2xl
        type:
          type: string
          enum:
            - started
            - stopped
        vcpus:
          type: integer
          maximum: 1024
          minimum: 1
  securitySchemes:
    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.