PPlunk Docs

Authentication

Authenticate requests to the Plunk API using your project keys.

Every project has two keys: a secret key used server-side for sending emails and managing contacts, and a public key used client-side for tracking events.

Secret key

Pass your secret key as a bearer token on every server-side request.

bash
Authorization: Bearer sk_live_xxxxxxxxxxxxxxxx

Public key

Public keys are safe to expose in the browser and can only be used to track events, not send emails or read contact data.

javascript
fetch("https://api.useplunk.com/v1/track", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    event: "page-viewed",
    email: "user@example.com",
    publicKey: "pk_live_xxxxxxxxxxxxxxxx",
  }),
});

Rotating keys

You can regenerate either key at any time from your project settings. Requests using the old key will start failing immediately.