API

Authentication

Create a token

  1. Open Settings → API & webhooks in the MailPirate app.
  2. Find Marketing API token.
  3. Create or rotate the token.
  4. Copy the plain token immediately - you will not be able to see it again later.
  5. Store it in your secret manager (not in frontend JavaScript).

Rotate if it leaks. Revoke to disable integrations immediately.

Send the token

Preferred:

Authorization: Bearer mp_...

Also accepted:

X-Marketing-Token: mp_...

Or (less ideal) as a query parameter:

GET /profiles?token=mp_...&store_slug=main

Scope

A token belongs to one workspace. Every request must target a store_slug that belongs to that workspace.

If you also send team_public_id, it must match the workspace the token belongs to. A mismatch returns 403.

Example

TOKEN="mp_..."
BASE="https://app.mailpirate.com/api/v1/marketing"

curl -sS "$BASE/profiles?store_slug=main&limit=10" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json"

Frontend warning

Do not embed Marketing API tokens in browser code. For website signups, use an embed form (public form endpoint) or call subscribe from your own backend.