API-referentie

Bijlagen

Bijlagen worden als base64-string meegestuurd in het attachments-veld van POST /emails. Er zijn twee soorten: gewone bijlagen en inline afbeeldingen.

Velden per bijlage

VeldTypeVereistBeschrijving
filename string Ja Bestandsnaam die de ontvanger ziet, inclusief extensie.
content string Ja Bestandsinhoud, base64-gecodeerd.
content_type string Ja MIME-type, bijv. application/pdf of image/png.
content_id string Nee CID voor inline afbeeldingen. Gebruik cid:{content_id} in HTML.

Gewone bijlage

Verschijnt als downloadbaar bestand in de e-mailclient.

curl -X POST https://api.wesender.nl/emails \
  -H "Authorization: Bearer $WS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from":    "noreply@joudomein.nl",
    "to":      ["klant@voorbeeld.nl"],
    "subject": "Je factuur",
    "html":    "<p>Zie bijlage.</p>",
    "attachments": [
      {
        "filename":     "factuur-2026-01.pdf",
        "content":      "JVBERi0xLjQK...",
        "content_type": "application/pdf"
      }
    ]
  }'

Inline afbeelding (CID)

Gebruik content_id om een afbeelding direct in de HTML te tonen via cid: referentie.

curl -X POST https://api.wesender.nl/emails \
  -H "Authorization: Bearer $WS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from":    "noreply@joudomein.nl",
    "to":      ["klant@voorbeeld.nl"],
    "subject": "Nieuwsbrief met logo",
    "html":    "<img src=\"cid:logo\" alt=\"Logo\"><p>Hallo!</p>",
    "attachments": [
      {
        "filename":     "logo.png",
        "content":      "iVBORw0KGgo...",
        "content_type": "image/png",
        "content_id":   "logo"
      }
    ]
  }'

Limieten

  • Maximale totaalgrootte per e-mail: 10 MB (inclusief body).
  • Maximaal 10 bijlagen per e-mail.
  • Toegestane MIME-types: PDF, PNG, JPEG, GIF, WebP, TXT, CSV, XLSX, DOCX, ZIP.
  • Executables (.exe, .sh, .bat) worden geweigerd.

Volgende stappen