API Authentication
Every request to Plunk's API needs to be authenticated with the public or secret key associated with your project. You can find these keys in the API settings of your project.
👋🏼
Only use your secret key in a secure, backend environment. Never expose your secret key to the public. In case you do, regenerate your secret key immediately.
Once you have your key, you can authenticate your requests by passing it as a Bearer token in the Authorization header.
await fetch('https://api.useplunk.com/v1', {
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",
}),
});
import requests
requests.post(
"https://api.useplunk.com/v1/track",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer API_KEY" # Put your API key here
},
json={
"event": "new-project",
"email": "hello@useplunk.com",
},
)
curl --location --request POST 'https://api.useplunk.com/v1' \
--header 'Authorization: Bearer API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{"email": "hello@useplunk.com", "event": "new-project"}'
<?php
$client = new Client();
$request = new Request('POST', 'https://api.useplunk.com/v1', ['Authorization' => 'Bearer API_KEY', 'Content-Type' => 'application/json'], '{
"event": "new-project",
"email": "hello@useplunk.com",
}');
$res = $client->sendAsync($request)->wait();
require "uri"
require "json"
require "net/http"
url = URI("https://api.useplunk.com/v1/track")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer API_KEY" # Put your API key here
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"event": "new-project",
"email": "hello@useplunk.com",
})
response = https.request(request)