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
},
});
import requests
requests.get(
"https://api.useplunk.com/v1/contacts",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer API_KEY" # Put your API key here
}
)
curl --location --request GET 'https://api.useplunk.com/v1/contacts' \
--header 'Authorization: Bearer API_KEY' \
--header 'Content-Type: application/json'
<?php
$client = new Client();
$request = new Request('GET', 'https://api.useplunk.com/v1/contacts', ['Authorization' => 'Bearer API_KEY', 'Content-Type' => 'application/json']);
$res = $client->sendAsync($request)->wait();
require "uri"
require "json"
require "net/http"
url = URI("https://api.useplunk.com/v1/contacts")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer API_KEY" # Put your API key here
request["Content-Type"] = "application/json"
response = https.request(request)
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
},
});
import requests
requests.get(
"https://api.useplunk.com/v1/contacts/count",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer API_KEY" # Put your API key here
}
)
curl --location --request GET 'https://api.useplunk.com/v1/contacts/count' \
--header 'Authorization: Bearer API_KEY' \
--header 'Content-Type: application/json'
<?php
$client = new Client();
$request = new Request('GET', 'https://api.useplunk.com/v1/contacts/count', ['Authorization' => 'Bearer API_KEY', 'Content-Type' => 'application/json']);
$res = $client->sendAsync($request)->wait();
require "uri"
require "json"
require "net/http"
url = URI("https://api.useplunk.com/v1/contacts/count")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer API_KEY" # Put your API key here
request["Content-Type"] = "application/json"
response = https.request(request)
POST /v1/contacts
Used to create a new contact in your Plunk project without triggering an event
Authorization
This endpoint can only be accessed with a secret API key
Example
await fetch('https://api.useplunk.com/v1/contacts', {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer SECRET_KEY", // Put your API key here
},
body: JSON.stringify({
"email": "hello@useplunk.com",
"subscribed": true,
"data": {
"project": "Plunk"
}
}),
});
import requests
requests.post(
"https://api.useplunk.com/v1/contacts",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer SECRET_KEY" # Put your API key here
},
json={
"email": "hello@useplunk.com",
"subscribed": true,
"data": {
"project": "Plunk"
}
}},
)
curl --location --request POST 'https://api.useplunk.com/v1/contacts' \
--header 'Authorization: Bearer SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"email": "hello@useplunk.com", "subscribed": true, "data": { "project": "Plunk"}}'
<?php
$client = new Client();
$request = new Request('POST', 'https://api.useplunk.com/v1/contacts', ['Authorization' => 'Bearer SECRET_KEY', 'Content-Type' => 'application/json'], '{
"email": "hello@useplunk.com",
"subscribed": true,
"data": {
"project": "Plunk"
}
}');
$res = $client->sendAsync($request)->wait();
require "uri"
require "json"
require "net/http"
url = URI("https://api.useplunk.com/v1/contacts")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer SECRET_KEY" # Put your API key here
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"email": "hello@useplunk.com",
"subscribed": true,
"data": {
"project": "Plunk"
}
})
response = https.request(request)
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"
}),
});
import requests
requests.post(
"https://api.useplunk.com/v1/contacts/subscribe",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer SECRET_KEY" # Put your API key here
},
json={
"id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
}},
)
curl --location --request POST 'https://api.useplunk.com/v1/contacts/subscribe' \
--header 'Authorization: Bearer SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"}'
<?php
$client = new Client();
$request = new Request('POST', 'https://api.useplunk.com/v1/contacts/subscribe', ['Authorization' => 'Bearer SECRET_KEY', 'Content-Type' => 'application/json'], '{
"id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
}');
$res = $client->sendAsync($request)->wait();
require "uri"
require "json"
require "net/http"
url = URI("https://api.useplunk.com/v1/contacts/subscribe")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer SECRET_KEY" # Put your API key here
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
})
response = https.request(request)
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"
}),
});
import requests
requests.post(
"https://api.useplunk.com/v1/contacts/unsubscribe",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer SECRET_KEY" # Put your API key here
},
json={
"id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
}},
)
curl --location --request POST 'https://api.useplunk.com/v1/contacts/unsubscribe' \
--header 'Authorization: Bearer SECRET_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"}'
<?php
$client = new Client();
$request = new Request('POST', 'https://api.useplunk.com/v1/contacts/unsubscribe', ['Authorization' => 'Bearer SECRET_KEY', 'Content-Type' => 'application/json'], '{
"id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
}');
$res = $client->sendAsync($request)->wait();
require "uri"
require "json"
require "net/http"
url = URI("https://api.useplunk.com/v1/contacts/unsubscribe")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer SECRET_KEY" # Put your API key here
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"id":"80d74d13-16eb-48c5-bc2b-aae6fd5865cc"
})
response = https.request(request)