# Export Sonjoo audit reports

> Choose HTML, Markdown, JSON, or AI-readable exports and find evidence in live and saved Sonjoo JSON reports.

Canonical documentation: <https://sajaddehshiri.ir/sonjoo-seo-audit/cli/exports/>

Use `--format` for the output format and `--output` for a report file. Without an output file, an explicit `--format json` writes the live audit JSON to standard output. Audit history is controlled separately by `--save`, `--no-save`, and your configuration.

| Format     | Use                                                                          |
| ---------- | ---------------------------------------------------------------------------- |
| `console`  | Inspect the report in a terminal or plain text file.                         |
| `json`     | Process findings, page coverage, and the gate result in scripts.             |
| `html`     | Open or share a report offline.                                              |
| `markdown` | Paste findings into an issue or project document.                            |
| `llm`      | Give a human or AI assistant focused findings and evidence in a text format. |

CSV is available for Crawl Explorer data in the dashboard and local API. For a full CLI audit use one of the formats in the table above.

## Write an HTML report

```sh
sonjoo audit https://example.com/ --no-save --format html --output reports/audit.html
```

Specify the output file whenever you set an explicit format and want a file. `--output` overrides the configured path. `--format` or `--json` without `--output` writes to stdout instead of using the configured path. When both format flags appear, `--format` takes precedence over `--json`. With neither format flag, `[output]` in `sonjoo.toml` can supply both the format and the path. Its `text` alias selects `console` and is available only in configuration.

## Read live and saved JSON

* `sonjoo audit <url> --format json` returns the live report directly. Read `categoryResults`, `ruleCoverage`, `reportSummary`, and `gate` at the top level. Crawl reports also contain page `coverage`.
* `sonjoo analyze <crawl-id> --json` returns an analysis of stored pages. Its direct export leaves out the live run profile and live completion state. Use the detailed saved report if you need the persisted audit metadata.
* `sonjoo report <audit-id> --format json` returns saved-audit metadata and an inner `result` object. Look for findings under `result.categoryResults`.
* `sonjoo report --list --format json` returns audit summaries. Use their `auditId` to load a detailed report.

When processing JSON, check for an error object before reading findings. Keep `ruleId`, `status`, `message`, and the URL from `details.pageUrl` when available. For aggregated crawl findings, inspect the [coverage and drill-down evidence](https://sajaddehshiri.ir/sonjoo-seo-audit/guides/reports-and-coverage/).

To see both shapes locally, start the [fixture](https://sajaddehshiri.ir/sonjoo-seo-audit/start/first-audit/#read-the-title-finding). Run these commands from an empty directory. They save one audit in an isolated history, read it back, and produce a separate HTML report.


```sh
target="${SONJOO_DOCS_TARGET:-http://127.0.0.1:18765}"
(
  export SONJOO_HOME="$PWD/.sonjoo-docs-history"
  sonjoo audit "$target/healthy" --categories core --save --fail-under 0 \
    --format json --output live.json
  audit_id=$(sonjoo report --list --format json |
    python3 -c 'import json, sys; print(json.load(sys.stdin)[0]["auditId"])')
  sonjoo report "$audit_id" --format json > saved.json
  sonjoo audit "$target/healthy" --categories core --no-save --fail-under 0 \
    --format html --output audit.html
)
```

When you finish, remove `.sonjoo-docs-history` if you no longer need the example audit.

## Export an AI-readable report

```sh
sonjoo audit https://example.com/ --no-save --format llm --output audit.txt
```

Before sharing, review the export for sensitive URLs and page details. Ask the assistant to cite the rule ID and affected URL for each recommendation, and to identify partial or unmeasured coverage. See [how to reproduce the title finding](https://sajaddehshiri.ir/sonjoo-seo-audit/start/first-audit/#read-the-title-finding) for an example of evidence you can cite.
