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

> Retorna o postmortem completo de um incidente, incluindo análise de root cause, timeline e action items

<ParamField path="name" type="string" required>
  Nome único do postmortem (ex: `PM-20260318-001`)
</ParamField>

<ResponseExample>
  ```json Response 200 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "PostMortem",
    "metadata": {
      "name": "PM-20260318-001",
      "incident": "INC-20260318-003",
      "createdAt": "2026-03-18T23:00:00Z",
      "author": "ai-generated",
      "reviewedBy": "carlos.silva@empresa.com"
    },
    "report": {
      "title": "OOMKill recorrente no checkout-service",
      "severity": "critical",
      "duration": "45m",
      "detectedAt": "2026-03-18T22:00:00Z",
      "resolvedAt": "2026-03-18T22:45:00Z",
      "summary": "O checkout-service sofreu múltiplos OOMKills durante 45 minutos devido a um memory leak no handler de webhook de pagamento. O incidente afetou 3.2% das requests de checkout e foi resolvido automaticamente pelo operator após aprovação.",
      "impact": {
        "usersAffected": 1250,
        "requestsAffected": "3.2%",
        "revenueImpact": "estimado R$ 15.000",
        "slosBreached": ["slo-checkout-error-rate"]
      },
      "rootCause": {
        "description": "Memory leak no handler de webhook de pagamento. O handler não fechava o body do HTTP response em caso de erro de validação, causando acúmulo de buffers na heap.",
        "category": "code-bug",
        "confidence": 0.91
      },
      "timeline": [
        {
          "time": "2026-03-18T22:00:00Z",
          "event": "Primeiro OOMKill detectado no pod checkout-service-5f8d7c6b4-k9m2n"
        },
        {
          "time": "2026-03-18T22:02:00Z",
          "event": "Decision engine inicia análise automática"
        },
        {
          "time": "2026-03-18T22:03:30Z",
          "event": "Root cause identificado: memory leak no webhook handler"
        },
        {
          "time": "2026-03-18T22:05:00Z",
          "event": "Runbook 'oomkill-standard' selecionado, aprovação solicitada"
        },
        {
          "time": "2026-03-18T22:08:00Z",
          "event": "Aprovação concedida por carlos.silva@empresa.com"
        },
        {
          "time": "2026-03-18T22:10:00Z",
          "event": "Memory limit aumentado para 1Gi, pods reiniciando"
        },
        {
          "time": "2026-03-18T22:45:00Z",
          "event": "Incidente resolvido — pods estáveis por 30 minutos"
        }
      ],
      "remediationApplied": {
        "runbook": "runbook-oomkill-standard",
        "steps": [
          "Diagnóstico de memória via kubectl top",
          "Patch de memory limit de 512Mi para 1Gi",
          "Verificação de estabilidade por 30 minutos"
        ],
        "result": "success"
      },
      "actionItems": [
        {
          "priority": "P1",
          "description": "Corrigir memory leak no handler de webhook — fechar response body em todos os paths de erro",
          "assignee": "backend-team",
          "status": "open",
          "dueDate": "2026-03-22"
        },
        {
          "priority": "P2",
          "description": "Adicionar métricas de heap usage no checkout-service para detecção precoce",
          "assignee": "platform-team",
          "status": "open",
          "dueDate": "2026-03-25"
        },
        {
          "priority": "P3",
          "description": "Revisar memory limits de todos os serviços do namespace production",
          "assignee": "sre-team",
          "status": "open",
          "dueDate": "2026-03-30"
        }
      ],
      "lessonsLearned": [
        "Adicionar linting automático para verificar fechamento de response bodies em handlers HTTP",
        "Memory limits devem ser revisados trimestralmente baseado em métricas reais de uso",
        "O runbook de OOMKill funcionou bem, mas a aprovação levou 3 minutos — considerar auto-approve para riskScore < 50"
      ],
      "metricSnapshots": [
        {"name": "cpu_usage", "value": "0.45", "timestamp": "2026-03-18T21:55:00Z", "phase": "before"},
        {"name": "memory_usage", "value": "498000000", "timestamp": "2026-03-18T22:00:00Z", "phase": "during"},
        {"name": "memory_usage", "value": "312000000", "timestamp": "2026-03-18T22:30:00Z", "phase": "after"}
      ],
      "blastRadius": [
        {"resource": {"kind": "Service", "name": "checkout-svc", "namespace": "production"}, "impact": "5xx responses during pod restarts", "severity": "high"}
      ],
      "gitCorrelation": {
        "commitSHA": "a1b2c3d4",
        "commitMessage": "feat: add webhook handler for payment notifications",
        "author": "dev@empresa.com",
        "timestamp": "2026-03-18T19:30:00Z",
        "confidence": 0.82,
        "filesChanged": ["internal/webhook/handler.go", "internal/webhook/handler_test.go"]
      },
      "trending": {
        "occurrenceCount": 3,
        "windowDays": 30,
        "relatedPostMortems": ["PM-20260305-001", "PM-20260312-002"],
        "pattern": "Recurring oom_kill on Deployment/checkout-service (3 occurrences in 30 days)"
      },
      "gitOpsContext": "Helm release 'checkout' chart=checkout version=2.3.1 status=deployed revision=42",
      "logAnalysisSummary": "1 Go panic stack trace; 12 critical error patterns (resource/connectivity); Primary exception: panic: runtime error: invalid memory address",
      "cascadeChain": ["production/checkout-service(root_cause)", "production/api-gateway(victim)"],
      "feedback": {
        "overrideRootCause": "",
        "remediationAccuracy": 4,
        "comments": "Good analysis. Consider suggesting AdjustResources before restart next time.",
        "providedBy": "sre@company.com",
        "providedAt": "2026-03-19T09:00:00Z"
      }
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /postmortems/{name}
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:
  /postmortems/{name}:
    get:
      tags:
        - Postmortems
      summary: Get Postmortem
      description: >-
        Returns the full postmortem for an incident, including root-cause
        analysis, timeline and action items.
      operationId: getPostmortem
      parameters:
        - name: name
          in: path
          required: true
          description: Unique postmortem name.
          schema:
            type: string
            example: PM-20260318-001
      responses:
        '200':
          description: Postmortem details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostMortem'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    PostMortem:
      type: object
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: PostMortem
        metadata:
          type: object
          properties:
            name:
              type: string
            namespace:
              type: string
            incident:
              type: string
            createdAt:
              type: string
              format: date-time
            author:
              type: string
            reviewedBy:
              type: string
        resourceMeta:
          type: object
          description: Used by some endpoints in place of metadata.
          properties:
            name:
              type: string
            namespace:
              type: string
        report:
          type: object
          properties:
            title:
              type: string
            severity:
              type: string
            duration:
              type: string
            detectedAt:
              type: string
              format: date-time
            resolvedAt:
              type: string
              format: date-time
            summary:
              type: string
            impact:
              type: object
              additionalProperties: true
            rootCause:
              type: object
              properties:
                description:
                  type: string
                category:
                  type: string
                confidence:
                  type: number
            timeline:
              type: array
              items:
                type: object
                properties:
                  time:
                    type: string
                    format: date-time
                  event:
                    type: string
            remediationApplied:
              type: object
              additionalProperties: true
            actionItems:
              type: array
              items:
                type: object
                properties:
                  priority:
                    type: string
                  description:
                    type: string
                  assignee:
                    type: string
                  status:
                    type: string
                  dueDate:
                    type: string
                    format: date
            lessonsLearned:
              type: array
              items:
                type: string
            metricSnapshots:
              type: array
              items:
                type: object
                additionalProperties: true
            blastRadius:
              type: array
              items:
                type: object
                additionalProperties: true
            gitCorrelation:
              type: object
              additionalProperties: true
            trending:
              type: object
              additionalProperties: true
            gitOpsContext:
              type: string
            logAnalysisSummary:
              type: string
            cascadeChain:
              type: array
              items:
                type: string
            feedback:
              $ref: '#/components/schemas/PostMortemFeedback'
            chaosInduced:
              type: boolean
              description: >-
                True when this PostMortem belongs to a chaos drill (parent Issue
                carried platform.chatcli.io/source=chaos-experiment). GAP-04
                fix.
            chaosExperiment:
              type: string
              description: >-
                Name of the ChaosExperiment CR correlated with the incident.
                GAP-04 fix.
        status:
          type: object
          properties:
            state:
              type: string
              enum:
                - Open
                - InReview
                - Closed
            reviewer:
              type: string
            reviewStartedAt:
              type: string
              format: date-time
            closedAt:
              type: string
              format: date-time
            notes:
              type: string
            feedback:
              $ref: '#/components/schemas/PostMortemFeedback'
            requiresHumanAction:
              type: boolean
              description: >-
                True when the parent Issue was only Contained (workload
                silenced, root cause not fixed). PostMortemReconciler will not
                allow Closed transition while this is true and the
                human-action-acknowledged annotation is absent. GAP-07 fix moved
                this field from Spec to Status (correct K8s convention for
                controller-derived facts) — 1.122.x clients that wrote to Spec
                now read null until they upgrade.
            requiredAction:
              type: string
              description: >-
                Concrete follow-up action a human must take (e.g., 'restore
                deployment replicas after fixing root cause'). Set together with
                requiresHumanAction. GAP-07 fix moved this from Spec to Status.
    PostMortemFeedback:
      type: object
      properties:
        overrideRootCause:
          type: string
        remediationAccuracy:
          type: integer
          minimum: 1
          maximum: 5
        comments:
          type: string
        providedBy:
          type: string
        providedAt:
          type: string
          format: date-time
    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>`.

````