AfriProtec API
Integrate AfriProtec's AI-powered security scanning directly into your CI/CD pipeline, custom scripts, or applications.
https://guardianai-api-em8v.onrender.com
Overview
The AfriProtec API lets you programmatically trigger security scans, retrieve results, monitor domains, generate compliance reports, and interact with the AI security assistant. All scan endpoints are asynchronous — you start a scan and then poll for results.
Supported scan types: website, repository, email domain, network, cloud, dark web, vendor risk, breach & attack simulation, and shadow AI detection.
API Access — Pro Plan Required
AfriProtec API keys let you query domain security scores, integrate with CI/CD pipelines, and build security dashboards. Each API key includes 1,000 queries per month. Keys use the afp_ prefix and are authenticated via the Authorization header.
To get an API key: upgrade to Pro at afriprotec.com/pricing, then generate a key in Settings → Developer API Keys.
API Key Authentication
Pass your afp_ key in the Authorization header on every API v1 request:
API keys do not expire but can be revoked from your dashboard at any time. Keys are hashed server-side — the raw key is only shown once when created.
Error Responses
| Status | Error Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing, invalid, or revoked API key. Upgrade at afriprotec.com/pricing. |
| 429 | quota_exceeded | Monthly query quota exhausted. Upgrade for a higher quota. |
Managing API Keys
All key management endpoints require a user JWT (from dashboard login), not an API key.
Generate a new API key. Only available to Pro plan users. The raw key is returned once — store it securely. Subsequent requests only return the key prefix.
Request Body
Response (200)
List your API keys. Never returns the raw key or hash — only the prefix, metadata, and usage.
Response (200)
Revoke an API key. Sets is_active=false immediately. Any integration using this key will receive a 401 response.
Domain Score
Returns the current security score for a domain. Requires a valid afp_ API key. If the domain has never been scanned, returns a not_scanned status. Rate limited to 60 requests/minute per key.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| domain | string | The domain to look up, e.g. example.com |
Response — domain has been scanned
Response — domain not yet scanned
Status Values
| Value | Meaning |
|---|---|
monitored | Domain is registered for continuous monitoring |
scanned | Domain has been scanned at least once |
not_scanned | No scan data found for this domain |
Grade Scale
| Grade | Score Range | Meaning |
|---|---|---|
A | 80–100 | Strong security posture |
B | 60–79 | Good, minor issues present |
C | 40–59 | Moderate risk, action recommended |
F | 0–39 | Critical issues, immediate action required |
Security Badge
Returns an SVG badge. If the domain owner has opted in to public badge display (via dashboard settings), shows their real security grade. Otherwise returns a generic AfriProtec branding badge. No authentication required. Cached for 1 hour.
/badge/{domain} is still supported.Dashboard Authentication (JWT)
Dashboard scan endpoints require a user JWT obtained from the login endpoint. Pass it in the Authorization header:
Tokens are JWTs issued by Supabase Auth. They expire after one hour. Re-authenticate to get a fresh token. For programmatic API access, use an afp_ API key instead — see API Keys above.
Base URL & Versioning
All endpoints are prefixed with the base URL. The current API version is 2.0.0. No versioning prefix is used in the path.
Error Handling
The API returns standard HTTP status codes and a JSON body with an error or detail field describing what went wrong.
| Status | Meaning |
|---|---|
| 400 | Bad request — invalid input or parameters |
| 401 | Unauthorized — missing, invalid, or revoked API key or JWT token |
| 402 | Scan limit reached — upgrade your plan |
| 403 | Forbidden — action requires a higher plan (e.g. API key creation requires Pro) |
| 404 | Resource not found |
| 422 | Validation error — request body failed schema checks |
| 429 | Rate limit or monthly quota exceeded |
| 500 | Internal server error — our team is notified automatically |
Register
Create a new AfriProtec account. A confirmation email is sent — the user must click the link before they can log in.
Request Body
Response (200)
Login
Authenticate and receive a JWT access token. Use this token in the Authorization header for all protected endpoints.
Request Body
Response (200)
Start a Scan
Start a security scan of a website, repository, email domain, or network target. The scan runs asynchronously — use the returned scan_id to poll for results.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| repo_url | string | required | Target URL, domain, or repository path |
| scan_type | string | optional | full, quick, secrets, or dependencies. Default: full |
| compliance | array | optional | Frameworks to check: kenya_dpa, popia, ndpa, iso27001, gdpr, pci_dss. Default: ["kenya_dpa","popia"] |
Response (200)
Get Scan Results
Poll this endpoint until status is complete or failed. Recommended polling interval: 5 seconds.
Response — running
Response — complete
Dark Web Scan
Check whether your domain or email address appears in dark web breach databases, paste sites, or credential leaks.
Cloud Security Scan
Scan cloud infrastructure (AWS, Azure, GCP) endpoints for misconfigurations and exposed services.
Breach & Attack Simulation
Simulate real-world attack techniques against your target and measure how well your defences hold up. Returns a defence effectiveness score and a list of failed controls.
Shadow AI Detection
Detect unauthorised or unvetted AI services and integrations running in your environment.
Vendor Risk Scan
Assess the security posture of up to 10 third-party vendors at once. Returns a risk score and compliance status for each vendor.
Request Body
Asset Discovery
Enumerate all internet-facing assets associated with a domain — subdomains, IP ranges, open ports, and exposed services.
Register Domain for Monitoring
Register a domain for 24/7 continuous monitoring. AfriProtec will scan it on a schedule and alert you when new vulnerabilities appear.
List Monitored Domains
Returns all domains currently registered for monitoring.
Response (200)
Domain Scan History
Retrieve historical scan results for a monitored domain, useful for tracking your security improvement over time.
Download PDF Report
Download a formatted PDF compliance report for a completed scan. The report is suitable for sharing with regulators, auditors, and investors.
Trust Badge
Returns an SVG badge showing the security score for a domain. Embed it in your website or README to show customers your security posture.
For machine-readable data append /json:
AI Security Assistant
Chat with the AfriProtec AI assistant. Ask questions about security findings, compliance requirements, fix instructions, or anything cybersecurity-related.
Request Body
Include previous messages in the array to maintain conversation context (max 50 messages, max 10,000 chars per message).
Response (200)
Billing Status
Check the current user's plan, scan count, and remaining free scans.
Response (200)
Compliance Frameworks
Use these identifiers in the compliance array on any scan endpoint:
| Identifier | Framework | Region |
|---|---|---|
| kenya_dpa | Kenya Data Protection Act 2019 | Kenya |
| popia | Protection of Personal Information Act | South Africa |
| ndpa | Nigeria Data Protection Act 2023 | Nigeria |
| malabo | AU Malabo Convention on Cyber Security | Pan-African |
| iso27001 | ISO/IEC 27001:2022 | International |
| gdpr | General Data Protection Regulation | EU / Global |
| pci_dss | Payment Card Industry Data Security Standard | Global |
Rate Limits
| Endpoint | Limit | Auth |
|---|---|---|
/api/v1/score/{domain} | 60 requests/minute · 1,000/month quota | API Key (Pro) |
/api/v1/badge/{domain} | Unlimited (cached 1h) | None |
/scan | 10 requests/minute, 100/hour | JWT Required |
/assistant | 20 requests/minute | JWT Required |
/vendor/scan | 3 requests/minute | JWT Required |
/scan/bas | 3 requests/minute | JWT Required |
/assets/discover | 5 requests/minute | JWT Required |
/scan/darkweb | 5 requests/minute | JWT Required |
/scan/cloud | 5 requests/minute | JWT Required |
/scan/{scan_id} (polling) | 60 requests/minute | JWT Required |
CI/CD Integration Example
Add AfriProtec to your GitLab pipeline to block merges with critical vulnerabilities. Requires a Pro plan API key stored as a CI secret variable (AFRIPROTEC_TOKEN = your dashboard JWT, AFRIPROTEC_API_KEY = your afp_ key for score lookups):