curl --request PUT \
--url https://www.getprescience.com/api/partner/v1/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://api.example-hr.com/webhooks/prescience"
}
'import requests
url = "https://www.getprescience.com/api/partner/v1/webhook"
payload = { "url": "https://api.example-hr.com/webhooks/prescience" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://api.example-hr.com/webhooks/prescience'})
};
fetch('https://www.getprescience.com/api/partner/v1/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://www.getprescience.com/api/partner/v1/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://api.example-hr.com/webhooks/prescience'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://www.getprescience.com/api/partner/v1/webhook"
payload := strings.NewReader("{\n \"url\": \"https://api.example-hr.com/webhooks/prescience\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://www.getprescience.com/api/partner/v1/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://api.example-hr.com/webhooks/prescience\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.getprescience.com/api/partner/v1/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://api.example-hr.com/webhooks/prescience\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://api.example-hr.com/webhooks/prescience",
"mode": "test",
"secret": "whsec_4f8a1c2b9d3e6f7a8b9c0d1e2f3a4b5c"
}{
"error": "invalid_request",
"message": "url must be an https URL.",
"details": [
{
"field": "url",
"message": "url must be an https URL"
}
]
}{
"error": "unauthorized",
"message": "Provide a valid partner API key as `Authorization: Bearer psk_...`."
}{
"error": "rate_limited",
"message": "Too many requests. Please retry later."
}{
"error": "server_error",
"message": "Internal error. The request was not applied."
}Set the webhook endpoint
Registers (or replaces) the webhook endpoint for your key’s mode: a test key sets the test endpoint and a live key sets the live one, each with its own signing secret. The other mode is never changed. The signing secret is returned once and stored encrypted; save it immediately. Rotating: call this endpoint again to get a new secret. The URL must be a public https:// endpoint, and its hostname must resolve only to public addresses: loopback, private, link-local and internal hostnames or addresses (for example localhost, *.internal, 10.0.0.0/8, 169.254.0.0/16) are rejected with invalid_request. Prescience checks the address again before each delivery.
curl --request PUT \
--url https://www.getprescience.com/api/partner/v1/webhook \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://api.example-hr.com/webhooks/prescience"
}
'import requests
url = "https://www.getprescience.com/api/partner/v1/webhook"
payload = { "url": "https://api.example-hr.com/webhooks/prescience" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://api.example-hr.com/webhooks/prescience'})
};
fetch('https://www.getprescience.com/api/partner/v1/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://www.getprescience.com/api/partner/v1/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://api.example-hr.com/webhooks/prescience'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://www.getprescience.com/api/partner/v1/webhook"
payload := strings.NewReader("{\n \"url\": \"https://api.example-hr.com/webhooks/prescience\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://www.getprescience.com/api/partner/v1/webhook")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://api.example-hr.com/webhooks/prescience\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.getprescience.com/api/partner/v1/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://api.example-hr.com/webhooks/prescience\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://api.example-hr.com/webhooks/prescience",
"mode": "test",
"secret": "whsec_4f8a1c2b9d3e6f7a8b9c0d1e2f3a4b5c"
}{
"error": "invalid_request",
"message": "url must be an https URL.",
"details": [
{
"field": "url",
"message": "url must be an https URL"
}
]
}{
"error": "unauthorized",
"message": "Provide a valid partner API key as `Authorization: Bearer psk_...`."
}{
"error": "rate_limited",
"message": "Too many requests. Please retry later."
}{
"error": "server_error",
"message": "Internal error. The request was not applied."
}Authorizations
Partner API key. psk_test_<32 hex> for test mode, psk_live_<32 hex> for live mode. Store them in your secrets manager on issue. Live keys are shown once; the scoped partner portal can show an active sandbox key again.
Headers
Any non-empty string; deterministic keys from your own IDs work best. Repeating the same key with the same body on the same endpoint and mode within 24 hours returns the stored successful response (with Idempotent-Replay: true) instead of re-executing. Error responses are not stored.
Body
HTTPS endpoint that receives events.
"https://api.example-hr.com/webhooks/prescience"
Response
Endpoint registered. The secret is shown exactly once.