Skip to content
API
Contacts

Contacts

Your contacts are all users, subscribers and customers that are present in your Plunk dashboard. They will automatically be added to your Plunk account when they trigger an event on your website or app.

GET /v1/contacts/ID

Gets the details of a specific contact.

Authorization

This endpoint can only be accessed with a secret API key

Returns

A JSON object containing the contact's details.

{
  "id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc",
  "email":"hello@useplunk.com",
  "subscribed":true,
  "data": {
    "project": "Plunk"
  }
}

Example

GET /v1/contacts

Get a list of all contacts in your Plunk account.

Authorization

This endpoint can only be accessed with a secret API key as it returns sensitive information.

Returns

A JSON array of contacts

[
  {
    "id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc",
    "email":"hello@useplunk.com",
    "subscribed":true,
    "data": {
      "project": "Plunk"
    }
  }
]

Example

await fetch('https://api.useplunk.com/v1/contacts', {
    method: "GET"
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer API_KEY", // Put your API key here
    },
});

GET /v1/contacts/count

Gets the total number of contacts in your Plunk account. Useful for displaying the number of contacts in a dashboard, landing page or other marketing material.

Authorization

This endpoint can be accessed with either a secret API key or a public API key.

Returns

A JSON object containing the amount of contacts in your Plunk account.

{
  "count": 41
}

Example

await fetch('https://api.useplunk.com/v1/contacts/count', {
    method: "GET"
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer API_KEY", // Put your API key here
    },
});

POST /v1/contacts/subscribe

Updates a contact's subscription status to subscribed.

Authorization

This endpoint can be accessed with either a secret API key or a public API key.

Example

await fetch('https://api.useplunk.com/v1/contacts/subscribe', {
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer SECRET_KEY", // Put your API key here
    },
    body: JSON.stringify({
        "id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
    }),
});

POST /v1/contacts/unsubscribe

Updates a contact's subscription status to unsubscribed.

Authorization

This endpoint can be accessed with either a secret API key or a public API key.

Example

await fetch('https://api.useplunk.com/v1/contacts/unsubscribe', {
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer SECRET_KEY", // Put your API key here
    },
    body: JSON.stringify({
        "id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
    }),
});