Create a webhook encryption key
curl --request POST \
--url http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key_id": "<string>",
"jwk": {
"kty": "RSA",
"n": "<string>",
"e": "<string>",
"alg": "<string>",
"use": "<string>",
"key_ops": [
"<string>"
]
},
"algorithm": "RSA-OAEP-256",
"key_type": "RSA"
}
'import requests
url = "http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys"
payload = {
"key_id": "<string>",
"jwk": {
"kty": "RSA",
"n": "<string>",
"e": "<string>",
"alg": "<string>",
"use": "<string>",
"key_ops": ["<string>"]
},
"algorithm": "RSA-OAEP-256",
"key_type": "RSA"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
key_id: '<string>',
jwk: {
kty: 'RSA',
n: '<string>',
e: '<string>',
alg: '<string>',
use: '<string>',
key_ops: ['<string>']
},
algorithm: 'RSA-OAEP-256',
key_type: 'RSA'
})
};
fetch('http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8787",
CURLOPT_URL => "http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'key_id' => '<string>',
'jwk' => [
'kty' => 'RSA',
'n' => '<string>',
'e' => '<string>',
'alg' => '<string>',
'use' => '<string>',
'key_ops' => [
'<string>'
]
],
'algorithm' => 'RSA-OAEP-256',
'key_type' => 'RSA'
]),
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 := "http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys"
payload := strings.NewReader("{\n \"key_id\": \"<string>\",\n \"jwk\": {\n \"kty\": \"RSA\",\n \"n\": \"<string>\",\n \"e\": \"<string>\",\n \"alg\": \"<string>\",\n \"use\": \"<string>\",\n \"key_ops\": [\n \"<string>\"\n ]\n },\n \"algorithm\": \"RSA-OAEP-256\",\n \"key_type\": \"RSA\"\n}")
req, _ := http.NewRequest("POST", 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.post("http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key_id\": \"<string>\",\n \"jwk\": {\n \"kty\": \"RSA\",\n \"n\": \"<string>\",\n \"e\": \"<string>\",\n \"alg\": \"<string>\",\n \"use\": \"<string>\",\n \"key_ops\": [\n \"<string>\"\n ]\n },\n \"algorithm\": \"RSA-OAEP-256\",\n \"key_type\": \"RSA\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key_id\": \"<string>\",\n \"jwk\": {\n \"kty\": \"RSA\",\n \"n\": \"<string>\",\n \"e\": \"<string>\",\n \"alg\": \"<string>\",\n \"use\": \"<string>\",\n \"key_ops\": [\n \"<string>\"\n ]\n },\n \"algorithm\": \"RSA-OAEP-256\",\n \"key_type\": \"RSA\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"webhook_endpoint_id": "<string>",
"key_id": "<string>",
"algorithm": "<string>",
"key_type": "<string>",
"jwk": {},
"is_active": true,
"created_at": "<string>",
"updated_at": "<string>",
"disabled_at": "<string>"
},
"error": null
}{
"data": null,
"error": {
"code": "BAD_REQUEST",
"message": "Bad request.",
"hint": "The request payload is invalid.",
"docs": "https://kayle.id/docs/api/webhooks/keys#create"
}
}{
"data": null,
"error": {
"code": "NOT_FOUND",
"message": "Webhook endpoint not found.",
"hint": "The webhook endpoint with the given ID was not found.",
"docs": "https://kayle.id/docs/api/webhooks/keys#create"
}
}{
"data": null,
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error.",
"hint": "The server encountered an error.",
"docs": "https://kayle.id/docs/api/errors"
}
}Webhooks
Create a webhook encryption key
Register a new encryption key (JWK) for a webhook endpoint. The key will be used for encrypting webhook payloads.
POST
/
v1
/
webhooks
/
endpoints
/
{endpoint_id}
/
keys
Create a webhook encryption key
curl --request POST \
--url http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"key_id": "<string>",
"jwk": {
"kty": "RSA",
"n": "<string>",
"e": "<string>",
"alg": "<string>",
"use": "<string>",
"key_ops": [
"<string>"
]
},
"algorithm": "RSA-OAEP-256",
"key_type": "RSA"
}
'import requests
url = "http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys"
payload = {
"key_id": "<string>",
"jwk": {
"kty": "RSA",
"n": "<string>",
"e": "<string>",
"alg": "<string>",
"use": "<string>",
"key_ops": ["<string>"]
},
"algorithm": "RSA-OAEP-256",
"key_type": "RSA"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
key_id: '<string>',
jwk: {
kty: 'RSA',
n: '<string>',
e: '<string>',
alg: '<string>',
use: '<string>',
key_ops: ['<string>']
},
algorithm: 'RSA-OAEP-256',
key_type: 'RSA'
})
};
fetch('http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8787",
CURLOPT_URL => "http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'key_id' => '<string>',
'jwk' => [
'kty' => 'RSA',
'n' => '<string>',
'e' => '<string>',
'alg' => '<string>',
'use' => '<string>',
'key_ops' => [
'<string>'
]
],
'algorithm' => 'RSA-OAEP-256',
'key_type' => 'RSA'
]),
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 := "http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys"
payload := strings.NewReader("{\n \"key_id\": \"<string>\",\n \"jwk\": {\n \"kty\": \"RSA\",\n \"n\": \"<string>\",\n \"e\": \"<string>\",\n \"alg\": \"<string>\",\n \"use\": \"<string>\",\n \"key_ops\": [\n \"<string>\"\n ]\n },\n \"algorithm\": \"RSA-OAEP-256\",\n \"key_type\": \"RSA\"\n}")
req, _ := http.NewRequest("POST", 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.post("http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"key_id\": \"<string>\",\n \"jwk\": {\n \"kty\": \"RSA\",\n \"n\": \"<string>\",\n \"e\": \"<string>\",\n \"alg\": \"<string>\",\n \"use\": \"<string>\",\n \"key_ops\": [\n \"<string>\"\n ]\n },\n \"algorithm\": \"RSA-OAEP-256\",\n \"key_type\": \"RSA\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8787/v1/webhooks/endpoints/{endpoint_id}/keys")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"key_id\": \"<string>\",\n \"jwk\": {\n \"kty\": \"RSA\",\n \"n\": \"<string>\",\n \"e\": \"<string>\",\n \"alg\": \"<string>\",\n \"use\": \"<string>\",\n \"key_ops\": [\n \"<string>\"\n ]\n },\n \"algorithm\": \"RSA-OAEP-256\",\n \"key_type\": \"RSA\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"webhook_endpoint_id": "<string>",
"key_id": "<string>",
"algorithm": "<string>",
"key_type": "<string>",
"jwk": {},
"is_active": true,
"created_at": "<string>",
"updated_at": "<string>",
"disabled_at": "<string>"
},
"error": null
}{
"data": null,
"error": {
"code": "BAD_REQUEST",
"message": "Bad request.",
"hint": "The request payload is invalid.",
"docs": "https://kayle.id/docs/api/webhooks/keys#create"
}
}{
"data": null,
"error": {
"code": "NOT_FOUND",
"message": "Webhook endpoint not found.",
"hint": "The webhook endpoint with the given ID was not found.",
"docs": "https://kayle.id/docs/api/webhooks/keys#create"
}
}{
"data": null,
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error.",
"hint": "The server encountered an error.",
"docs": "https://kayle.id/docs/api/errors"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the webhook endpoint to create the encryption key for (e.g. whe_...).
Required string length:
1 - 128Pattern:
^[A-Za-z0-9_-]+$Body
application/json
The key identifier to use as kid in the JWE header.
Required string length:
1 - 128The public JWK for encrypting webhook payloads.
Show child attributes
Show child attributes
The JWE algorithm to use for webhook delivery.
Available options:
RSA-OAEP-256 The JWK key type for webhook delivery.
Available options:
RSA ⌘I