Skip to main content
PUT
/
webhook
Set the webhook endpoint
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",
  "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": "Rate limit exceeded. Retry after 12 seconds."
}
{
  "error": "server_error",
  "message": "Internal error. The request was not applied."
}

Authorizations

Authorization
string
header
required

Partner API key. psk_test_<32 hex> for test mode, psk_live_<32 hex> for live mode. Keys are stored hashed and cannot be recovered; store them in your secrets manager on issue.

Headers

Idempotency-Key
string

Any unique string (UUIDs work well). Replaying the same key within 24 hours returns the stored response instead of re-executing the request.

Maximum string length: 255

Body

application/json
url
string<uri>
required

HTTPS endpoint that receives events.

Example:

"https://api.example-hr.com/webhooks/prescience"

Response

Endpoint registered. The secret is shown exactly once.

url
string<uri>
required
secret
string
required

Signing secret, whsec_<hex>. Returned only on this response.

Example:

"whsec_4f8a1c2b9d3e6f7a8b9c0d1e2f3a4b5c"