API v1.0

API Documentatie

RESTful API voor email hosting beheer

Introductie

De Imply API biedt programmatische toegang tot je email hosting service. Beheer domeinen, mailboxen, aliassen en monitor email verkeer.

Base URL
https://imply.nl/api/v1

Authenticatie

De API gebruikt JWT Bearer tokens. Voeg je token toe in de Authorization header:

Authorization: Bearer YOUR_ACCESS_TOKEN

Rate Limiting

API verzoeken zijn gelimiteerd tot:

  • 60 verzoeken per minuut voor geauthenticeerde gebruikers
  • 20 verzoeken per minuut voor niet-geauthenticeerde verzoeken
  • Burst allowance van 10 verzoeken

Authenticatie

POST /auth/login

Authenticeer en ontvang access tokens

Request Body

Veld Type Verplicht Beschrijving
email string Verplicht Gebruiker email adres
password string Verplicht Gebruiker wachtwoord
totp_code string Optioneel TOTP code als 2FA actief is

Response Voorbeeld

{
  "success": true,
  "message": "Login successful",
  "data": {
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
    "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
    "token_type": "Bearer",
    "expires_in": 3600,
    "user": {
      "id": 123,
      "email": "user@example.com",
      "role": "user"
    }
  }
}
POST /auth/refresh

Refresh access token met refresh token

GET /auth/verify

Verifieer huidige token geldigheid

Domeinen

GET /domains

Lijst alle domeinen voor geauthenticeerde gebruiker

Query Parameters

Parameter Type Beschrijving
page integer Pagina nummer (standaard: 1)
per_page integer Items per pagina (standaard: 20, max: 100)
search string Zoek domeinen op naam
verified boolean Filter op DNS verificatie status
GET /domains/{domain_id}

Haal specifieke domein details op inclusief DNS records

POST /domains

Creëer een nieuw domein

Request Body

{
  "domain": "example.com",
  "catch_all": "admin@example.com"
}
PATCH /domains/{domain_id}

Update domein instellingen

DELETE /domains/{domain_id}

Verwijder een domein

Mailboxen

GET /mailboxes

Lijst alle mailboxen

GET /mailboxes/{mailbox_id}

Haal specifieke mailbox details op

POST /mailboxes

Creëer een nieuwe mailbox

Request Body

{
  "email": "john@example.com",
  "password": "SecurePassword123!",
  "storage_quota_mb": 5120,
  "name": "John Doe"
}
PATCH /mailboxes/{mailbox_id}

Update mailbox instellingen

DELETE /mailboxes/{mailbox_id}

Verwijder een mailbox

Email Aliassen

GET /aliases

Lijst alle email aliassen

POST /aliases

Creëer een nieuwe alias

Request Body

{
  "alias": "info@example.com",
  "destination": "john@example.com"
}
DELETE /aliases/{alias_id}

Verwijder een alias

Webhooks

Ontvang real-time notificaties voor belangrijke events in je account.

GET /webhooks

Lijst alle webhooks

POST /webhooks

Registreer een nieuwe webhook

Beschikbare Events

  • domain.created - Nieuw domein aangemaakt
  • domain.verified - Domein geverifieerd
  • mailbox.created - Nieuwe mailbox aangemaakt
  • mailbox.quota_exceeded - Mailbox quota overschreden
  • email.received - Email ontvangen
  • email.sent - Email verzonden

Webhook Payload Voorbeeld

{
  "event": "mailbox.created",
  "timestamp": "2025-01-15T10:30:00Z",
  "data": {
    "mailbox_id": 456,
    "email": "john@example.com",
    "domain_id": 123
  }
}

Statistieken

GET /statistics/email-traffic

Haal email verkeer statistieken op

Query Parameters

Parameter Type Beschrijving
start_date date Start datum (YYYY-MM-DD)
end_date date Eind datum (YYYY-MM-DD)
domain_id integer Filter op specifiek domein
GET /statistics/storage

Haal opslag statistieken op

Error Responses

De API gebruikt standaard HTTP status codes en retourneert errors in JSON formaat.

HTTP Status Codes

Code Betekenis
200 OK - Verzoek succesvol
201 Created - Resource aangemaakt
400 Bad Request - Ongeldige parameters
401 Unauthorized - Authenticatie vereist
403 Forbidden - Geen toegang
404 Not Found - Resource niet gevonden
429 Too Many Requests - Rate limit overschreden
500 Internal Server Error - Server fout

Error Response Voorbeeld

{
  "success": false,
  "error": {
    "code": "INVALID_DOMAIN",
    "message": "The domain name is invalid or already exists",
    "details": {
      "field": "domain",
      "value": "invalid-domain"
    }
  }
}

Code Voorbeelden

cURL

curl -X POST https://imply.nl/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "password123"
  }'

JavaScript (Fetch)

const response = await fetch('https://imply.nl/api/v1/domains', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json'
  }
});

const data = await response.json();
console.log(data);

Python (Requests)

import requests

headers = {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json'
}

response = requests.get('https://imply.nl/api/v1/domains', headers=headers)
data = response.json()
print(data)

PHP

$ch = curl_init('https://imply.nl/api/v1/domains');

curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_ACCESS_TOKEN',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);

print_r($data);