REST API Reference¶
Complete reference for the Aegis REST API endpoints.
Base URL¶
For self-hosted deployments, use your configured API base URL.
Interactive Documentation¶
The API includes interactive documentation:
- Scalar UI:
https://api.aegispreflight.com/docs - OpenAPI Spec:
https://api.aegispreflight.com/openapi.json
Preflight Endpoints¶
Check Text Content¶
Check text content for sensitive data.
Headers:
| Header | Required | Description |
|---|---|---|
X-Aegis-API-Key |
Yes | Policy API key |
Content-Type |
Yes | application/json |
Request Body:
{
"text": "Content to check",
"destination": "AI_TOOL",
"org_id": "optional-org-id",
"policy_id": "optional-policy-id"
}
| Field | Type | Required | Description |
|---|---|---|---|
text |
string | Yes | Content to check |
destination |
string | Yes | AI_TOOL, VENDOR, or CUSTOMER |
org_id |
string | No | Organization ID (if multi-tenant) |
policy_id |
string | No | Specific policy to use |
Response:
{
"preflight_id": "pf_abc123",
"decision": "ALLOWED_WITH_MASKING",
"summary": "PII detected and masked",
"detected": [
{
"type": "EMAIL",
"count": 1,
"sample": "user@***.com"
},
{
"type": "SSN",
"count": 1,
"sample": "123-45-****"
}
],
"masked_content": "Masked version of content...",
"policy_version": "1.0",
"created_at": "2024-01-15T10:30:00Z"
}
Example:
curl -X POST https://api.aegispreflight.com/api/preflight/text \
-H "X-Aegis-API-Key: aegis_sk_xxx" \
-H "Content-Type: application/json" \
-d '{
"text": "Email me at [email protected]",
"destination": "AI_TOOL"
}'
Check File¶
Check a file for sensitive data.
Headers:
| Header | Required | Description |
|---|---|---|
X-Aegis-API-Key |
Yes | Policy API key |
Content-Type |
Yes | multipart/form-data |
Form Fields:
| Field | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | File to check |
destination |
string | Yes | AI_TOOL, VENDOR, or CUSTOMER |
org_id |
string | No | Organization ID |
policy_id |
string | No | Specific policy |
Response:
{
"preflight_id": "pf_xyz789",
"decision": "BLOCKED",
"summary": "File contains PHI which is blocked for this destination",
"detected": [
{
"type": "PHI",
"count": 5,
"sample": null
}
],
"masked_file_url": null,
"policy_version": "1.0",
"created_at": "2024-01-15T10:30:00Z"
}
Example:
curl -X POST https://api.aegispreflight.com/api/preflight \
-H "X-Aegis-API-Key: aegis_sk_xxx" \
-F "[email protected]" \
-F "destination=VENDOR"
Get Preflight Result¶
Retrieve a previous preflight check result.
Parameters:
| Parameter | Type | Description |
|---|---|---|
preflight_id |
string | Preflight check ID |
Response:
Same as check response above.
Example:
Organization Endpoints¶
List Organizations¶
Response:
[
{
"org_id": "acme",
"name": "Acme Corp",
"slug": "acme",
"settings": {
"primary_color": "#6366f1",
"admin_email": "[email protected]"
},
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:00:00Z"
}
]
Create Organization¶
Request Body:
{
"name": "New Organization",
"slug": "new-org",
"settings": {
"admin_email": "[email protected]",
"primary_color": "#10b981"
}
}
Response:
{
"org_id": "org_abc123",
"name": "New Organization",
"slug": "new-org",
"settings": {...},
"license_id": "lic_xyz789",
"license_key": "aegis_lic_xxx",
"license_type": "trial",
"license_expires_at": "2025-01-15T00:00:00Z",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
Auto-created License
A license and default policy group are automatically created with new organizations.
Get Organization¶
Parameters:
| Parameter | Type | Description |
|---|---|---|
org_id |
string | Organization ID or slug |
Update Organization¶
Request Body:
{
"name": "Updated Name",
"settings": {
"admin_email": "[email protected]"
}
}
Delete Organization¶
Response: 204 No Content
Policy Endpoints¶
List Policies¶
Response:
[
{
"policy_id": "pol_abc123",
"org_id": "acme",
"name": "Engineering Policy",
"description": "Policy for engineering team",
"version": "1.0",
"tags": ["engineering", "dev"],
"is_active": true,
"api_key": "aegis_sk_xxx",
"rules": [
{
"id": "rule-001",
"name": "Block PII to AI",
"enabled": true,
"dataTypes": ["PII"],
"destinations": ["AI_TOOL"],
"action": "BLOCK"
}
],
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:00:00Z"
}
]
Create Policy¶
Request Body:
{
"name": "New Policy",
"description": "Policy description",
"tags": ["production"],
"rules": [
{
"name": "Block SSN",
"enabled": true,
"dataTypes": ["PII"],
"destinations": ["AI_TOOL"],
"action": "BLOCK"
}
]
}
Get Policy¶
Update Policy¶
Request Body:
Delete Policy¶
Regenerate Policy API Key¶
Response:
License Endpoints¶
List Licenses¶
Response:
[
{
"license_id": "lic_abc123",
"org_id": "acme",
"license_key": "aegis_lic_xxx",
"license_type": "standard",
"status": "active",
"expires_at": "2025-12-31T00:00:00Z",
"max_checks_per_month": 100000,
"default_policy_group": "default",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:00:00Z"
}
]
Validate License (SDK)¶
Headers:
| Header | Required | Description |
|---|---|---|
Authorization |
Yes | Bearer aegis_lic_xxx |
Response:
{
"valid": true,
"expires": "2025-12-31T00:00:00Z",
"org_id": "acme",
"policy_version": "1.0",
"policy_config": {...},
"policy_groups": ["default", "engineering"],
"default_policy_group": "default",
"jwt_token": "eyJhbGciOiJSUzI1NiIs..."
}
Get Public Key¶
Response:
Revoke License¶
Response: 204 No Content
Cascade Effect
Revoking a license deactivates all associated policies.
Analytics Endpoints¶
Organization Analytics¶
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
period |
string | 30d |
7d, 30d, or 90d |
Response:
{
"org_id": "acme",
"org_name": "Acme Corp",
"total_checks": 15420,
"bytes_protected": 1048576000,
"allowed": 12000,
"masked": 2500,
"blocked": 920,
"safe_share_rate": 94.0,
"prevented_exposures": 920,
"from_date": "2024-01-01",
"to_date": "2024-01-31"
}
Time Series Data¶
Response:
{
"org_id": "acme",
"period": "30d",
"data": [
{
"date": "2024-01-01",
"checks_total": 500,
"allowed": 400,
"masked": 80,
"blocked": 20,
"bytes_processed": 10485760
}
]
}
Detection Breakdown¶
Response:
{
"org_id": "acme",
"total_detections": 3420,
"types": [
{
"type": "EMAIL",
"label": "Email Addresses",
"count": 1500,
"percentage": 43.8
},
{
"type": "SSN",
"label": "Social Security Numbers",
"count": 800,
"percentage": 23.4
}
],
"from_date": "2024-01-01",
"to_date": "2024-01-31"
}
Audit Endpoints¶
List Audit Log¶
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
int | 50 | Results per page |
offset |
int | 0 | Pagination offset |
org_id |
string | - | Filter by organization |
search |
string | - | Search query |
Response:
{
"items": [
{
"preflight_id": "pf_abc123",
"created_at": "2024-01-15T10:30:00Z",
"destination": "AI_TOOL",
"decision": "BLOCKED",
"summary": "Content blocked due to SSN",
"policy_version": "1.0",
"policy_name": "Engineering Policy",
"org_id": "acme",
"org_name": "Acme Corp"
}
],
"limit": 50,
"offset": 0,
"total": 1520
}
Error Responses¶
Standard Error Format¶
HTTP Status Codes¶
| Code | Description |
|---|---|
200 |
Success |
201 |
Created |
204 |
No Content |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
422 |
Validation Error |
429 |
Rate Limited |
500 |
Server Error |
See Also¶
- Authentication - API authentication guide
- SDK Reference - Python SDK documentation