Set webhook endpoint
curl --request PUT \
--url https://api.pnplayer.com/v1/api/account/webhook \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"url": "https://example.com/hooks/pnplayer",
"events": []
}
'import requests
url = "https://api.pnplayer.com/v1/api/account/webhook"
payload = {
"url": "https://example.com/hooks/pnplayer",
"events": []
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com/hooks/pnplayer', events: []})
};
fetch('https://api.pnplayer.com/v1/api/account/webhook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pnplayer.com/v1/api/account/webhook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com/hooks/pnplayer',
'events' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Auth-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pnplayer.com/v1/api/account/webhook"
payload := strings.NewReader("{\n \"url\": \"https://example.com/hooks/pnplayer\",\n \"events\": []\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Auth-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.pnplayer.com/v1/api/account/webhook")
.header("X-Auth-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/hooks/pnplayer\",\n \"events\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pnplayer.com/v1/api/account/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Auth-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/hooks/pnplayer\",\n \"events\": []\n}"
response = http.request(request)
puts response.read_body{
"data": {
"url": "<string>",
"events": [
"video.ready"
],
"secret": "<string>",
"secretRevealed": true
}
}{
"message": "<string>"
}{
"message": "Forbidden"
}{
"message": "Not found"
}Webhooks
Set webhook endpoint
Sets or replaces the HTTPS endpoint and event subscription. A signing secret is generated on first setup and returned in full once (secretRevealed: true); later calls keep the existing secret and return it masked. Requires the account owner or the UPDATE_SETTINGS scope.
PUT
/
v1
/
api
/
account
/
webhook
Set webhook endpoint
curl --request PUT \
--url https://api.pnplayer.com/v1/api/account/webhook \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <api-key>' \
--data '
{
"url": "https://example.com/hooks/pnplayer",
"events": []
}
'import requests
url = "https://api.pnplayer.com/v1/api/account/webhook"
payload = {
"url": "https://example.com/hooks/pnplayer",
"events": []
}
headers = {
"X-Auth-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-Auth-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com/hooks/pnplayer', events: []})
};
fetch('https://api.pnplayer.com/v1/api/account/webhook', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pnplayer.com/v1/api/account/webhook",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com/hooks/pnplayer',
'events' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Auth-Token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pnplayer.com/v1/api/account/webhook"
payload := strings.NewReader("{\n \"url\": \"https://example.com/hooks/pnplayer\",\n \"events\": []\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-Auth-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.pnplayer.com/v1/api/account/webhook")
.header("X-Auth-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/hooks/pnplayer\",\n \"events\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pnplayer.com/v1/api/account/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-Auth-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/hooks/pnplayer\",\n \"events\": []\n}"
response = http.request(request)
puts response.read_body{
"data": {
"url": "<string>",
"events": [
"video.ready"
],
"secret": "<string>",
"secretRevealed": true
}
}{
"message": "<string>"
}{
"message": "Forbidden"
}{
"message": "Not found"
}Authorizations
apiKeyAuthbearerAuth
API key created in the dashboard or via POST /v1/api/api-keys. Keys are prefixed pn_ and do not expire until revoked.
Body
application/json
Must use https://
Maximum string length:
2000Example:
"https://example.com/hooks/pnplayer"
Events to receive. Omit or send an empty array to receive all events.
Available options:
video.ready, video.deleted, caption.added, caption.updated, caption.removed, chapters.updated, tag.created, tag.deleted, video.tags.attached, video.tags.detached Response
Configuration saved
Show child attributes
Show child attributes
