Rotate an event destination bearer secret
curl --request POST \
--url https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret', 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.prets.app/v1/events/destinations/{destinationId}/bearer-secret",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"destinationId": "<string>",
"bearerSecret": "whsec_3XvK2nQ8mB7pR1sT4uW6yZ0aE5gH9jLcV2bN1xM4qP8",
"rotatedAt": "2023-11-07T05:31:56Z"
}Event destinations
Rotate an event destination bearer secret
POST
/
v1
/
events
/
destinations
/
{destinationId}
/
bearer-secret
Rotate an event destination bearer secret
curl --request POST \
--url https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret', 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.prets.app/v1/events/destinations/{destinationId}/bearer-secret",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prets.app/v1/events/destinations/{destinationId}/bearer-secret")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"destinationId": "<string>",
"bearerSecret": "whsec_3XvK2nQ8mB7pR1sT4uW6yZ0aE5gH9jLcV2bN1xM4qP8",
"rotatedAt": "2023-11-07T05:31:56Z"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Pattern:
^whk_[0-9A-HJKMNP-TV-Z]{26}$Response
New bearer secret minted. Returned cleartext exactly once; the previous secret stops working immediately.
Pattern:
^whk_[0-9A-HJKMNP-TV-Z]{26}$Bearer secret returned cleartext exactly once when minted. Sent on every delivery as Authorization: Bearer {secret}. Cannot be retrieved later.
Pattern:
^whsec_[A-Za-z0-9_-]{43}$Example:
"whsec_3XvK2nQ8mB7pR1sT4uW6yZ0aE5gH9jLcV2bN1xM4qP8"
Was this page helpful?