Rotate Webhook Signing Key
curl --request POST \
--url https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key"
payload = { "request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
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({request_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({request_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key"
payload := strings.NewReader("{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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("https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
val request = Request.Builder()
.url("https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()falseimport Foundation
let parameters = ["request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"signing_secret": "<string>",
"key_id": "<string>",
"previous_key_expires_at": "2023-01-15T01:30:15.01Z"
}Webhooks
Rotate Webhook Signing Key
Generate or rotate the HMAC signing secret for a webhook endpoint. If the webhook already has a key, the existing key is moved into a ‘previous’ slot and remains valid for the overlap window (24H) during which deliveries carry both signatures. The new secret is returned exactly once.
POST
/
v2
/
webhooks
/
{id}
/
rotate-signing-key
Rotate Webhook Signing Key
curl --request POST \
--url https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
'import requests
url = "https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key"
payload = { "request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a" }
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({request_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({request_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'})
};
fetch('https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key"
payload := strings.NewReader("{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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("https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
.asString();val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}")
val request = Request.Builder()
.url("https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()falseimport Foundation
let parameters = ["request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://api.prod.bastion.com/v2/webhooks/{id}/rotate-signing-key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"request_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n}"
response = http.request(request)
puts response.read_body{
"signing_secret": "<string>",
"key_id": "<string>",
"previous_key_expires_at": "2023-01-15T01:30:15.01Z"
}Body
application/json