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

# Obter Error Budget do SLO

> Retorna o detalhamento do error budget de um SLO, incluindo histórico de consumo

<ParamField path="name" type="string" required>
  Nome único do SLO (ex: `slo-payment-availability`)
</ParamField>

<ParamField query="granularity" type="string" default="daily">
  Granularidade do histórico: `hourly`, `daily`, `weekly`
</ParamField>

<ResponseExample>
  ```json Response 200 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "SLOBudget",
    "metadata": {
      "name": "slo-payment-availability",
      "namespace": "production"
    },
    "budget": {
      "target": 99.95,
      "window": "30d",
      "totalMinutes": 43200,
      "allowedDowntimeMinutes": 21.6,
      "consumedDowntimeMinutes": 14.7,
      "remainingDowntimeMinutes": 6.9,
      "remainingPercent": 32.0,
      "burnRate": {
        "current1h": 2.1,
        "current6h": 1.8,
        "current24h": 1.2
      },
      "forecast": {
        "exhaustionDate": "2026-03-25T08:00:00Z",
        "daysRemaining": 5.7,
        "trend": "deteriorating"
      },
      "history": [
        {
          "date": "2026-03-19",
          "consumed": 1.2,
          "cumulative": 14.7,
          "remainingPercent": 32.0
        },
        {
          "date": "2026-03-18",
          "consumed": 0.5,
          "cumulative": 13.5,
          "remainingPercent": 37.5
        },
        {
          "date": "2026-03-17",
          "consumed": 0.1,
          "cumulative": 13.0,
          "remainingPercent": 39.8
        }
      ]
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /slos/{name}/budget
openapi: 3.1.0
info:
  title: ChatCLI AIOps Platform API
  description: >-
    REST API for the ChatCLI AIOps Platform — incidents, SLOs, runbooks,
    approvals, postmortems, analytics, audit, federation and health.


    The playground below uses **editable server variables** so you can point
    requests at your own self-hosted instance. Adjust `host`, `port` and
    `basePath` to match your deployment, then click **Try it**.
  version: 1.0.0
  contact:
    name: ChatCLI
    url: https://github.com/diillson/chatcli
  license:
    name: Apache-2.0
    identifier: Apache-2.0
servers:
  - url: http://{host}:{port}/{basePath}
    description: >-
      Self-hosted ChatCLI AIOps Platform — adjust host, port and basePath to
      match your deployment.
    variables:
      host:
        default: localhost
        description: >-
          Hostname or IP of your ChatCLI operator. For Kubernetes, use the
          Service DNS (e.g. chatcli-api.chatcli-system.svc) or your Ingress
          host.
      port:
        default: '8090'
        description: >-
          Port the API listens on. Default is 8090; configurable via Helm value
          `apiPort` or env var CHATCLI_API_PORT.
      basePath:
        default: api/v1
        description: >-
          API base path. Always `api/v1` unless you have a custom proxy rewrite
          in front of the operator.
security:
  - ApiKeyAuth: []
tags:
  - name: Incidents
    description: >-
      Incident lifecycle: list, fetch, acknowledge, resolve, snooze, timeline
      and remediation views.
  - name: Runbooks
    description: Remediation runbooks (list, create, update, delete).
  - name: SLOs
    description: Service Level Objectives and error budgets.
  - name: Approvals
    description: Approval workflow for risky remediations.
  - name: Postmortems
    description: Auto-generated postmortems with review, feedback and close.
  - name: Remediations
    description: Remediation plans and agentic execution history.
  - name: AI Insights
    description: AI root-cause analysis and recommendations per incident.
  - name: Analytics
    description: 'Operational analytics: MTTD, MTTR, trends, capacity, compliance.'
  - name: Audit
    description: Immutable audit log and exports.
  - name: Federation
    description: 'Multi-cluster federation: clusters, status and cross-cluster correlations.'
  - name: Health
    description: Liveness and readiness probes.
paths:
  /slos/{name}/budget:
    get:
      tags:
        - SLOs
      summary: Get SLO Error Budget
      description: Returns the SLO error budget breakdown, including consumption history.
      operationId: getSLOBudget
      parameters:
        - name: name
          in: path
          required: true
          description: Unique SLO name.
          schema:
            type: string
            example: slo-payment-availability
        - name: granularity
          in: query
          required: false
          description: Granularity of the history.
          schema:
            type: string
            enum:
              - hourly
              - daily
              - weekly
            default: daily
      responses:
        '200':
          description: SLO budget breakdown
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SLOBudget'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    SLOBudget:
      type: object
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: SLOBudget
        metadata:
          type: object
          properties:
            name:
              type: string
            namespace:
              type: string
        budget:
          type: object
          properties:
            target:
              type: number
            window:
              type: string
            totalMinutes:
              type: number
            allowedDowntimeMinutes:
              type: number
            consumedDowntimeMinutes:
              type: number
            remainingDowntimeMinutes:
              type: number
            remainingPercent:
              type: number
            burnRate:
              type: object
              properties:
                current1h:
                  type: number
                current6h:
                  type: number
                current24h:
                  type: number
            forecast:
              type: object
              properties:
                exhaustionDate:
                  type: string
                  format: date-time
                daysRemaining:
                  type: number
                trend:
                  type: string
            history:
              type: array
              items:
                type: object
                properties:
                  date:
                    type: string
                  consumed:
                    type: number
                  cumulative:
                    type: number
                  remainingPercent:
                    type: number
    Error:
      type: object
      required:
        - apiVersion
        - kind
        - error
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: Error
        error:
          oneOf:
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: integer
                  example: 404
                message:
                  type: string
                  example: Resource not found
                details:
                  type: string
            - type: string
        code:
          type: integer
          description: Top-level code (only used by some endpoints).
          example: 400
  responses:
    Unauthorized:
      description: Missing or invalid API token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded for this token's role
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Bearer token issued by the operator. Format: `Authorization: Bearer
        <token>`.

````