API Integratie

Integreer je applicaties met de Imply email service via onze RESTful API

Volledige API documentatie:
Deze pagina geeft een overzicht van de API mogelijkheden. Voor de complete referentie, zie docs.imply.nl/api/.

Aan de slag

API Token aanmaken

Eerst heb je een API token nodig voor authenticatie:

curl -X POST https://api.imply.nl/v1/auth/tokens \
  -H "Content-Type: application/json" \
  -d '{
    "email": "jouw@email.nl",
    "password": "jouwwachtwoord",
    "name": "Mijn Applicatie",
    "scopes": ["mailboxes:read", "mailboxes:write", "mail:send"]
  }'

Response:

{
  "token": "imply_live_abc123def456ghi789...",
  "name": "Mijn Applicatie",
  "scopes": ["mailboxes:read", "mailboxes:write", "mail:send"],
  "created_at": "2025-01-15T10:30:00Z",
  "expires_at": null
}
Belangrijk!
Bewaar je API token veilig. Deze geeft volledige toegang tot je account. Deel het nooit publiekelijk en sla het niet op in version control.

Eerste API call

Test je token met een eenvoudige call:

curl -X GET https://api.imply.nl/v1/account \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Veelgebruikte endpoints

Mailboxen beheren

Mailbox aanmaken

curl -X POST https://api.imply.nl/v1/mailboxes \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "nieuw@jouwdomein.nl",
    "password": "VeiligWachtwoord123!",
    "name": "Nieuwe Gebruiker",
    "quota": 5368709120
  }'

Mailbox opvragen

curl -X GET https://api.imply.nl/v1/mailboxes/nieuw@jouwdomein.nl \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Mailbox quota aanpassen

curl -X PATCH https://api.imply.nl/v1/mailboxes/nieuw@jouwdomein.nl \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "quota": 10737418240
  }'

Emails versturen

Simpele email

curl -X POST https://api.imply.nl/v1/mail/send \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "jij@jouwdomein.nl",
    "to": "ontvanger@example.com",
    "subject": "Test email",
    "body": "Dit is een test email vanuit de API."
  }'

HTML email met bijlagen

curl -X POST https://api.imply.nl/v1/mail/send \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "jij@jouwdomein.nl",
    "to": ["ontvanger1@example.com", "ontvanger2@example.com"],
    "cc": ["cc@example.com"],
    "subject": "HTML email met bijlage",
    "html": "

Hallo!

Dit is een HTML email.

", "attachments": [ { "filename": "document.pdf", "content": "base64_encoded_content_here", "content_type": "application/pdf" } ] }'

Aliassen beheren

Alias aanmaken

curl -X POST https://api.imply.nl/v1/aliases \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "alias": "info@jouwdomein.nl",
    "destinations": ["jan@jouwdomein.nl", "marie@jouwdomein.nl"]
  }'

Alle aliassen ophalen

curl -X GET https://api.imply.nl/v1/aliases \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Domeinen beheren

Domein toevoegen

curl -X POST https://api.imply.nl/v1/domains \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "nieuwdomein.nl"
  }'

DNS records opvragen

curl -X GET https://api.imply.nl/v1/domains/nieuwdomein.nl/dns \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Webhooks

Ontvang real-time notificaties wanneer er events plaatsvinden. Zie de webhooks pagina voor details.

Webhook aanmaken

curl -X POST https://api.imply.nl/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://jouw-app.nl/webhooks/imply",
    "events": ["email.received", "email.sent", "mailbox.created"],
    "secret": "jouw_webhook_secret"
  }'

Rate limiting

De API heeft rate limits om misbruik te voorkomen:

Endpoint type Limiet
Algemeen 100 requests per minuut
Email versturen 50 emails per minuut
Bulk operaties 10 requests per minuut

Rate limit info wordt meegestuurd in response headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1642251600
Rate limit overschreden:
Als je de limiet overschrijdt, krijg je een 429 Too Many Requests response. Wacht tot de reset tijd voordat je opnieuw probeert.

Error handling

HTTP status codes

Code Betekenis
200 OK Request succesvol
201 Created Resource aangemaakt
400 Bad Request Ongeldige input
401 Unauthorized Ontbrekende of ongeldige authenticatie
403 Forbidden Geen toegang tot deze resource
404 Not Found Resource niet gevonden
429 Too Many Requests Rate limit overschreden
500 Internal Server Error Server fout

Error response formaat

{
  "error": {
    "code": "invalid_email",
    "message": "Het opgegeven email adres is ongeldig",
    "field": "email"
  }
}

SDK's en libraries

JavaScript/Node.js

npm install @imply/api-client

// Gebruik
const Imply = require('@imply/api-client');
const client = new Imply('your_api_token');

// Mailbox aanmaken
await client.mailboxes.create({
  email: 'nieuw@jouwdomein.nl',
  password: 'VeiligWachtwoord123!',
  name: 'Nieuwe Gebruiker'
});

// Email versturen
await client.mail.send({
  from: 'jij@jouwdomein.nl',
  to: 'ontvanger@example.com',
  subject: 'Test',
  body: 'Dit is een test'
});

Python

pip install imply-api

# Gebruik
from imply import ImplyClient

client = ImplyClient('your_api_token')

# Mailbox aanmaken
client.mailboxes.create(
    email='nieuw@jouwdomein.nl',
    password='VeiligWachtwoord123!',
    name='Nieuwe Gebruiker'
)

# Email versturen
client.mail.send(
    from_email='jij@jouwdomein.nl',
    to='ontvanger@example.com',
    subject='Test',
    body='Dit is een test'
)

PHP

composer require imply/api-client

// Gebruik
use Imply\ApiClient;

$client = new ApiClient('your_api_token');

// Mailbox aanmaken
$client->mailboxes()->create([
    'email' => 'nieuw@jouwdomein.nl',
    'password' => 'VeiligWachtwoord123!',
    'name' => 'Nieuwe Gebruiker'
]);

// Email versturen
$client->mail()->send([
    'from' => 'jij@jouwdomein.nl',
    'to' => 'ontvanger@example.com',
    'subject' => 'Test',
    'body' => 'Dit is een test'
]);

Best practices

Voorbeeldintegraties

CRM integratie

Automatisch mailboxen aanmaken voor nieuwe medewerkers:

// Wanneer nieuwe medewerker wordt toegevoegd aan CRM
async function onEmployeeCreated(employee) {
  const mailbox = await imply.mailboxes.create({
    email: `${employee.firstname}.${employee.lastname}@bedrijf.nl`,
    password: generateSecurePassword(),
    name: `${employee.firstname} ${employee.lastname}`,
    quota: 10737418240 // 10GB
  });

  // Stuur welkomst email
  await imply.mail.send({
    from: 'it@bedrijf.nl',
    to: mailbox.email,
    subject: 'Welkom bij Bedrijf!',
    html: getWelcomeEmailTemplate(employee)
  });

  // Update CRM met email adres
  await crm.updateEmployee(employee.id, {
    email: mailbox.email
  });
}

Support ticket systeem

Verwerk inkomende emails als support tickets:

// Webhook handler voor inkomende emails
app.post('/webhooks/imply', async (req, res) => {
  const event = req.body;

  if (event.type === 'email.received') {
    const email = event.data;

    // Maak ticket aan
    const ticket = await supportSystem.createTicket({
      subject: email.subject,
      description: email.body,
      customer_email: email.from,
      priority: detectPriority(email)
    });

    // Stuur bevestiging
    await imply.mail.send({
      from: 'support@bedrijf.nl',
      to: email.from,
      subject: `Re: ${email.subject}`,
      body: `Bedankt voor je bericht. Ticket #${ticket.id} is aangemaakt.`
    });
  }

  res.sendStatus(200);
});

Testing

Test omgeving

Gebruik de test API voor development:

// Test API base URL
https://api-test.imply.nl/v1/

// Test API tokens beginnen met imply_test_
const testToken = 'imply_test_abc123...';
Test emails:
Emails verstuurd via de test API worden niet echt verzonden, maar zijn wel beschikbaar via de API voor testing doeleinden.

Postman collectie

Download onze Postman collectie met alle API endpoints:

Volledige API referentie:
Voor alle endpoints, parameters, en response voorbeelden, zie docs.imply.nl/api/.