Skip to content
API
Events

Events

Events are the power behind Plunk's email marketing automations. They are the triggers that start your automations. Events are triggered by a user's actions on your site, such as signing up for your newsletter, or making a purchase.

POST /v1/track

Triggers an event and creates it if it doesn't exist.

Authorization

This endpoint can be accessed with both the public and private API keys. Meaning that you can trigger events from both the client and the server.

Returns

A JSON object containing the success status and the contact's ID.

{
  "success": true,
  "contact": "80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
}

Example

await fetch('https://api.useplunk.com/v1/track', {
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer API_KEY", // Put your API key here
    },
    body: JSON.stringify({
        "event": "new-project",
        "email": "hello@useplunk.com",
    }),
});