PingMel

API reference

Base URL https://api.pingmel.dev. All requests and responses are JSON.

Authentication

Create an API key in your project (Dashboard → Projects → API keys) and send it as a bearer token. Keys belong to one project.

Authorization: Bearer pk_...

Send email

POST /v1/email. The from address must be on a verified domain of the project. Up to 50 recipients per call; you get one message id per recipient.

{
  "from": "orders@yourshop.com",
  "to": ["ana@example.com", "raj@example.org"],
  "subject": "Your invoice",
  "text": "Hi! Your invoice is attached.",
  "html": "<p>Hi! Your invoice is attached.</p>",
  "attachments": [
    {"filename": "invoice.pdf", "content_type": "application/pdf", "content": "<base64>"}
  ]
}

→ 202 {"ids": ["m_...", "m_..."]}

Attachments larger than 5 MB are not attached. They are stored and a download link, valid for 7 days, is added to the email.

Send push

POST /v1/push. Connect your Firebase service account in the project's Push tab first. Up to 500 device tokens per call. data values are sent as strings.

{"tokens": ["<FCM device token>"], "title": "Flash sale", "body": "20% off today", "data": {"sku": "7"}}

→ 202 {"ids": ["m_..."]}

Message status

GET /v1/messages/{id}

{"id": "m_...", "channel": "email", "recipient": "ana@example.com",
 "status": "delivered", "attempts": 0, "error": null, "created": 1795187579, "updated": 1795187580}

Status is one of queued, deferred (temporary failure, retrying with backoff), delivered, failed.

Callbacks

Set a URL in the project's Callbacks tab and choose events. We POST each event to it:

{"event": "delivered", "ts": 1795187580,
 "data": {"id": "m_...", "recipient": "ana@example.com", "channel": "email", "error": null}}

Every request has PingMel-Signature: sha256=<hex>, the HMAC-SHA256 of the raw body with your project secret. Check it before trusting the body:

// Node.js
const crypto = require("crypto");
const expected = "sha256=" + crypto.createHmac("sha256", SECRET).update(rawBody).digest("hex");
const ok = crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(req.headers["pingmel-signature"]));

Errors

CodeMeaning
400Invalid input; the error field says what.
401Missing or wrong API key.
402No active plan, or not enough wallet credit for usage above the plan.
404Message not found in this project.