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

# Export Formats

> Export findings in various formats for different use cases

# Export Formats

AIPTx supports multiple export formats to integrate with your existing tools and workflows.

## Available Formats

| Format   | Use Case                    | Extension |
| -------- | --------------------------- | --------- |
| JSON     | API integration, automation | `.json`   |
| CSV      | Spreadsheets, data analysis | `.csv`    |
| PDF      | Reports, documentation      | `.pdf`    |
| HTML     | Web viewing, sharing        | `.html`   |
| SARIF    | IDE/CI integration          | `.sarif`  |
| XML      | Legacy system integration   | `.xml`    |
| Markdown | Documentation               | `.md`     |

## JSON Export

### Command

```bash theme={null}
aiptx findings export --scan-id scan_abc123 --format json --output findings.json
```

### Structure

```json theme={null}
{
  "scan": {
    "id": "scan_abc123",
    "target": "https://app.example.com",
    "completed_at": "2024-01-15T14:00:00Z"
  },
  "summary": {
    "total": 42,
    "critical": 2,
    "high": 5,
    "medium": 12,
    "low": 23
  },
  "findings": [
    {
      "id": "finding_xyz789",
      "title": "SQL Injection in Search API",
      "severity": "critical",
      "cvss_score": 9.8,
      "endpoint": {
        "method": "POST",
        "path": "/api/search",
        "parameter": "query"
      },
      "description": "...",
      "remediation": "...",
      "poc": { ... }
    }
  ]
}
```

## CSV Export

### Command

```bash theme={null}
aiptx findings export --scan-id scan_abc123 --format csv --output findings.csv
```

### Columns

| Column      | Description              |
| ----------- | ------------------------ |
| id          | Finding ID               |
| title       | Finding title            |
| severity    | critical/high/medium/low |
| cvss\_score | CVSS 3.1 score           |
| status      | open/fixed/accepted      |
| endpoint    | Affected URL             |
| parameter   | Vulnerable parameter     |
| category    | Vulnerability category   |
| cwe\_id     | CWE identifier           |
| description | Finding description      |
| remediation | Fix guidance             |

## SARIF Export

SARIF (Static Analysis Results Interchange Format) enables integration with IDEs and CI/CD tools.

### Command

```bash theme={null}
aiptx findings export --scan-id scan_abc123 --format sarif --output results.sarif
```

### Integration

**GitHub Code Scanning:**

```yaml theme={null}
- name: Upload SARIF
  uses: github/codeql-action/upload-sarif@v2
  with:
    sarif_file: results.sarif
```

**VS Code:**
Install the SARIF Viewer extension to view results directly in your editor.

### Structure

```json theme={null}
{
  "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
  "version": "2.1.0",
  "runs": [{
    "tool": {
      "driver": {
        "name": "AIPTx",
        "version": "1.0.0",
        "rules": [
          {
            "id": "sql-injection",
            "name": "SQL Injection",
            "shortDescription": { "text": "SQL injection vulnerability" },
            "defaultConfiguration": { "level": "error" }
          }
        ]
      }
    },
    "results": [
      {
        "ruleId": "sql-injection",
        "level": "error",
        "message": { "text": "SQL Injection in Search API" },
        "locations": [{
          "physicalLocation": {
            "artifactLocation": { "uri": "/api/search" }
          }
        }]
      }
    ]
  }]
}
```

## PDF Reports

### Command

```bash theme={null}
aiptx report generate --scan-id scan_abc123 --format pdf --output report.pdf
```

### Templates

* **Executive** - High-level summary for leadership
* **Technical** - Detailed findings for security teams
* **Compliance** - Mapped to compliance frameworks
* **Developer** - Code-focused for dev teams

## HTML Reports

### Command

```bash theme={null}
aiptx report generate --scan-id scan_abc123 --format html --output report.html
```

### Features

* Interactive navigation
* Expandable finding details
* Syntax-highlighted code
* Search and filter
* Print-friendly styling

## XML Export

### Command

```bash theme={null}
aiptx findings export --scan-id scan_abc123 --format xml --output findings.xml
```

### Structure

```xml theme={null}
<?xml version="1.0" encoding="UTF-8"?>
<aiptx-report>
  <scan id="scan_abc123" target="https://app.example.com">
    <completed-at>2024-01-15T14:00:00Z</completed-at>
  </scan>
  <findings>
    <finding id="finding_xyz789" severity="critical">
      <title>SQL Injection in Search API</title>
      <cvss-score>9.8</cvss-score>
      <endpoint method="POST" path="/api/search" />
      <description>...</description>
      <remediation>...</remediation>
    </finding>
  </findings>
</aiptx-report>
```

## Markdown Export

### Command

```bash theme={null}
aiptx findings export --scan-id scan_abc123 --format markdown --output findings.md
```

### Use Cases

* GitHub/GitLab issues
* Documentation
* Wiki pages
* Slack/Teams sharing

## Filtering Exports

### By Severity

```bash theme={null}
aiptx findings export --scan-id scan_abc123 --severity critical,high --format json
```

### By Status

```bash theme={null}
aiptx findings export --scan-id scan_abc123 --status open --format csv
```

### By Category

```bash theme={null}
aiptx findings export --scan-id scan_abc123 --category injection,authentication --format json
```

## API Export

### Endpoint

```bash theme={null}
GET /v1/findings/export?scan_id=scan_abc123&format=json
```

### Example

```bash theme={null}
curl -X GET "https://api.aiptx.io/v1/findings/export?scan_id=scan_abc123&format=sarif" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o results.sarif
```
