API reference

AfriPhish exposes a REST API under /api/v1. Programmatic API access requires the Pro plan or higher.

Base URLhttps://api.afriphish.com/api/v1 (your deployment may differ). Interactive OpenAPI docs are served at /docs on the backend.

Authentication

The API uses JWT bearer tokens. Obtain one by logging in:

curl -X POST https://api.afriphish.com/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{ "email": "admin@yourcompany.com", "password": "••••••••" }'
{ "access_token": "eyJ…", "refresh_token": "eyJ…" }

Send the access token on every request:

curl https://api.afriphish.com/api/v1/organizations/me \
  -H "Authorization: Bearer $ACCESS_TOKEN"

Access tokens are short-lived (15 min). Exchange a refresh token for a new pair at POST /auth/refresh.

Common endpoints

Method & pathDescription
GET /plansPublic tier catalogue
GET /organizations/meYour organisation
GET /organizations/me/entitlementsLive plan, seats, features, trial
POST /organizations/me/logoUpload/replace the org logo
GET /usersList users
POST /users/inviteInvite a user
GET /users/rolesAssignable role catalogue
GET /phishing/campaignsList campaigns
POST /phishing/campaignsCreate a campaign
GET /training/modulesList training modules
GET /policiesList policies
GET /policies/{id}/rosterSignature roster (signed / unsigned)
POST /policies/{id}/notifyDistribute a policy to sign
GET /interventions/rulesCoaching rules
GET /reports/catalogueAvailable reports
GET /reports/download/{key}Export a report (?format=csv|json|pdf|html)
GET /legal/documentsLegal document templates (DPA / Terms / Privacy)

Errors

Standard HTTP status codes. A few worth knowing:

  • 401 Unauthorized — missing/expired token.
  • 402 Payment Required — your plan doesn't include this feature, or your trial has expired. Upgrade to unlock. See Plans.
  • 403 Forbidden — your role isn't permitted, a seat cap was hit, or the organisation is deactivated.

Error bodies are JSON:

{ "detail": "Your plan does not include this feature. Upgrade to unlock it." }

Rate limits

Endpoints are rate-limited per category (auth, tracking, default). If you exceed a limit you'll receive 429 Too Many Requests; back off and retry.


Questions about the API? Email sales@afriphish.com and we'll connect you with an engineer.