Skip to content

Export Endpoints ​

Generate and download reports and data exports.

Export Audit Log ​

Export audit log data.

POST /api/export/audit

Request ​

json
{
  "start_date": "2024-01-01",
  "end_date": "2024-01-31",
  "format": "csv",
  "filters": {
    "entity_types": ["US_SSN", "CREDIT_CARD"],
    "user_ids": ["user_123"]
  }
}
FieldTypeRequiredDescription
start_datestringYesStart date (YYYY-MM-DD)
end_datestringYesEnd date (YYYY-MM-DD)
formatstringNocsv, json, or xlsx
filtersobjectNoFilter criteria

Response ​

json
{
  "export_id": "exp_abc123",
  "status": "processing",
  "format": "csv",
  "record_count": null,
  "download_url": null,
  "expires_at": null
}

Check Export Status ​

GET /api/export/{export_id}

Response when ready:

json
{
  "export_id": "exp_abc123",
  "status": "completed",
  "format": "csv",
  "record_count": 1500,
  "download_url": "https://api.ghostai.com/v1/downloads/exp_abc123",
  "expires_at": "2024-01-15T12:00:00Z"
}

Export Compliance Report ​

Generate compliance reports.

POST /api/export/compliance

Request ​

json
{
  "report_type": "hipaa",
  "period": "monthly",
  "month": "2024-01",
  "format": "pdf",
  "include_details": true
}

Report types:

  • hipaa - HIPAA compliance summary
  • pci - PCI-DSS compliance summary
  • gdpr - GDPR compliance summary
  • general - General compliance report

Response ​

json
{
  "export_id": "exp_xyz789",
  "status": "processing",
  "report_type": "hipaa",
  "download_url": null
}

Export Board Report ​

Generate executive board report.

POST /api/export/board

Request ​

json
{
  "period": "2024-Q1",
  "format": "pdf",
  "sections": ["executive_summary", "risk_analysis", "recommendations"],
  "branding": true
}

Response ​

json
{
  "export_id": "exp_board123",
  "status": "processing",
  "pages": null,
  "download_url": null
}

Export Session Data ​

Export conversation history.

POST /api/export/session

Request ​

json
{
  "session_id": "sess_abc123",
  "format": "json",
  "include_tokens": false,
  "include_audit": true
}

Response ​

json
{
  "session_id": "sess_abc123",
  "export_id": "exp_sess456",
  "messages": 25,
  "download_url": "https://api.ghostai.com/v1/downloads/exp_sess456"
}

Download Export ​

Download a completed export.

GET /api/downloads/{export_id}

Returns the file with appropriate Content-Type header.

Example ​

bash
# Start export
curl -X POST https://api.ghostai.com/v1/export/audit \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2024-01-01",
    "end_date": "2024-01-31",
    "format": "csv"
  }'

# Check status
curl https://api.ghostai.com/v1/export/exp_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN"

# Download when ready
curl -O https://api.ghostai.com/v1/downloads/exp_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN"

Scheduled Exports ​

Set up recurring exports.

POST /api/export/scheduled

Request ​

json
{
  "report_type": "compliance",
  "schedule": "weekly",
  "day_of_week": 1,
  "format": "pdf",
  "recipients": ["compliance@company.com"],
  "enabled": true
}

Response ​

json
{
  "schedule_id": "sch_abc123",
  "next_run": "2024-01-22T08:00:00Z",
  "enabled": true
}

List Scheduled Exports ​

GET /api/export/scheduled

Update Schedule ​

PUT /api/export/scheduled/{schedule_id}

Delete Schedule ​

DELETE /api/export/scheduled/{schedule_id}

SOC 2 Type II Certified | BAA Available | HIPAA-Ready