API Aan de Slag
API Aan de Slag
Section titled “API Aan de Slag”De AmiPhished REST API stelt u in staat om het platform te integreren met uw bestaande systemen.
Authenticatie
Section titled “Authenticatie”API Key Aanmaken
Section titled “API Key Aanmaken”- Ga naar Instellingen → API
- Klik Nieuwe API Key
- Geef een beschrijvende naam
- Selecteer permissies
- Kopieer de key (wordt maar 1x getoond)
Authenticatie Header
Section titled “Authenticatie Header”Voeg de API key toe aan elke request:
curl https://api.amiphished.nl/v1/users \ -H "Authorization: Bearer YOUR_API_KEY"Base URL
Section titled “Base URL”https://api.amiphished.nl/v1Sandbox Environment
Section titled “Sandbox Environment”Voor development en testing:
https://api.sandbox.amiphished.nl/v1Rate Limiting
Section titled “Rate Limiting”| Plan | Requests/minuut | Requests/dag |
|---|---|---|
| Starter | 60 | 10.000 |
| Professional | 300 | 100.000 |
| Enterprise | 1000 | Onbeperkt |
Headers in response:
X-RateLimit-Limit: 60X-RateLimit-Remaining: 45X-RateLimit-Reset: 1609459200Response Formaat
Section titled “Response Formaat”Alle responses zijn in JSON:
{ "success": true, "data": { // Response data }, "meta": { "page": 1, "per_page": 25, "total": 150 }}Error Response
Section titled “Error Response”{ "success": false, "error": { "code": "VALIDATION_ERROR", "message": "Email is required", "details": { "field": "email", "reason": "required" } }}Beschikbare Endpoints
Section titled “Beschikbare Endpoints”| Method | Endpoint | Beschrijving |
|---|---|---|
| GET | /users | Lijst alle gebruikers |
| POST | /users | Maak nieuwe gebruiker |
| GET | /users/{id} | Haal gebruiker op |
| PUT | /users/{id} | Update gebruiker |
| DELETE | /users/{id} | Verwijder gebruiker |
Campaigns
Section titled “Campaigns”| Method | Endpoint | Beschrijving |
|---|---|---|
| GET | /campaigns | Lijst alle campagnes |
| POST | /campaigns | Maak nieuwe campagne |
| GET | /campaigns/{id} | Haal campagne op |
| POST | /campaigns/{id}/start | Start campagne |
| POST | /campaigns/{id}/stop | Stop campagne |
Reports
Section titled “Reports”| Method | Endpoint | Beschrijving |
|---|---|---|
| GET | /reports/campaigns/{id} | Campagne rapport |
| GET | /reports/users/{id} | Gebruiker rapport |
| GET | /reports/compliance | Compliance rapport |
Voorbeelden
Section titled “Voorbeelden”Gebruiker Aanmaken
Section titled “Gebruiker Aanmaken”curl -X POST https://api.amiphished.nl/v1/users \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "email": "jan@bedrijf.nl", "first_name": "Jan", "last_name": "Janssen", "department": "IT", "groups": ["all-users", "it-team"] }'Response:
{ "success": true, "data": { "id": "usr_123abc", "email": "jan@bedrijf.nl", "first_name": "Jan", "last_name": "Janssen", "department": "IT", "created_at": "2025-01-15T10:30:00Z" }}Campagne Starten
Section titled “Campagne Starten”curl -X POST https://api.amiphished.nl/v1/campaigns/camp_456def/start \ -H "Authorization: Bearer YOUR_API_KEY"Rapport Ophalen
Section titled “Rapport Ophalen”curl https://api.amiphished.nl/v1/reports/campaigns/camp_456def \ -H "Authorization: Bearer YOUR_API_KEY"Webhooks
Section titled “Webhooks”Ontvang real-time notificaties:
Webhook Configureren
Section titled “Webhook Configureren”- Ga naar Instellingen → API → Webhooks
- Voeg endpoint URL toe
- Selecteer events
- Sla op
Beschikbare Events
Section titled “Beschikbare Events”campaign.startedcampaign.completeduser.clickeduser.submitteduser.reportedtraining.completed
Webhook Payload
Section titled “Webhook Payload”{ "event": "user.clicked", "timestamp": "2025-01-15T10:30:00Z", "data": { "campaign_id": "camp_456def", "user_id": "usr_123abc", "template_id": "tmpl_789ghi" }}Webhook Verificatie
Section titled “Webhook Verificatie”Verifieer de signature:
X-AmiPhished-Signature: sha256=abc123...SDK’s & Libraries
Section titled “SDK’s & Libraries”Python
Section titled “Python”pip install amiphishedfrom amiphished import Client
client = Client(api_key="YOUR_API_KEY")users = client.users.list()Node.js
Section titled “Node.js”npm install @amiphished/sdkconst AmiPhished = require('@amiphished/sdk');
const client = new AmiPhished('YOUR_API_KEY');const users = await client.users.list();