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

# Generate, Review, and Export Post-Mortem Reports

> Use Scrubbe's AI endpoints to produce five-whys analyses, stakeholder summaries, and exportable PDF reports after an incident is resolved.

A post-mortem closes the loop on an incident by capturing what happened, why it happened, and what will prevent it from recurring. Scrubbe automates the most time-consuming parts: it reads the incident data you have already recorded and generates a structured five-whys analysis, an engineer-facing deep dive, and a plain-language stakeholder summary — all via API. This guide walks you through generating each report and exporting the final document as a PDF.

## Prerequisites

* The incident must be in `RESOLVED` or `CLOSED` status (see [Manage Incidents](/guides/manage-incidents))
* A valid API key with incident read permissions and post-mortem access

***

## List existing post-mortems

Before generating new reports, check whether a post-mortem already exists for the incident.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/postmortems \
  -H "Authorization: Bearer <token>"
```

The response returns all post-mortem records in your workspace, including their associated incident IDs and generation timestamps.

***

## Generate an AI five-whys analysis

The five-whys endpoint reads the incident timeline, comments, and technical description, then walks back through the causal chain to surface the root cause.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/incident-ticket/resolve/ai/five-whys/<incidentId> \
  -H "Authorization: Bearer <token>"
```

The response contains a structured chain of cause-and-effect statements, ending at the identified root cause. Review the output and add any context the AI may have missed before sharing it with your team.

<Tip>The quality of the five-whys output depends directly on how much detail you recorded in `techDescription` and the incident comments. Richer incident data produces sharper analysis.</Tip>

***

## Get an AI resolution suggestion

Use the suggestion endpoint to receive a set of recommended corrective actions based on the incident's root cause and historical patterns in your workspace.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/incident-ticket/resolve/ai/suggestion/<incidentId> \
  -H "Authorization: Bearer <token>"
```

The response includes ranked action items, each with a rationale. Feed these directly into your team's follow-up tickets or use them as a starting point for the post-mortem's "action items" section.

***

## Generate a stakeholder summary

The stakeholder endpoint produces a non-technical narrative of the incident — suitable for executives, customer success teams, or status page updates. It covers impact, duration, root cause (in plain language), and next steps.

```bash theme={null}
curl https://api.scrubbe.io/api/v1/incident-ticket/resolve/ai/stakeholder/<incidentId> \
  -H "Authorization: Bearer <token>"
```

<Note>The stakeholder summary deliberately omits internal technical detail. For a full engineering report, use the [Ezra AI guide](/guides/ai-ezra) to generate an audience-targeted report via `POST /api/v1/ezra/report`.</Note>

***

## Export the post-mortem as a PDF

Once your analysis is complete, generate a PDF for distribution, archiving, or compliance purposes.

```bash theme={null}
curl -X POST https://api.scrubbe.io/api/v1/generate-pdf \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "incidentId": "<incidentId>"
  }'
```

The response contains a download URL or the PDF as a binary stream, depending on your workspace configuration.

<Warning>PDFs are generated from the incident data at the time of the request. If you update the incident or regenerate AI reports after exporting, re-run this call to get a fresh document.</Warning>

***

## Recommended workflow

<Steps>
  <Step title="Resolve the incident">
    Set the incident status to `RESOLVED` via `POST /api/v1/incident-ticket/resolve/:id`. Ensure all comments and findings are recorded on the ticket.
  </Step>

  <Step title="Run the five-whys">
    Call `GET /api/v1/incident-ticket/resolve/ai/five-whys/:id` and review the root cause chain with the incident responders.
  </Step>

  <Step title="Collect action items">
    Call `GET /api/v1/incident-ticket/resolve/ai/suggestion/:id` and assign follow-up work to owners.
  </Step>

  <Step title="Draft the stakeholder summary">
    Call `GET /api/v1/incident-ticket/resolve/ai/stakeholder/:id`, review the output, and adjust tone or detail as needed.
  </Step>

  <Step title="Export to PDF">
    Call `POST /api/v1/generate-pdf` with the incident ID to produce the final archived report.
  </Step>
</Steps>
