Webhooks
Rotate team webhook secret
Rotates the signing secret and returns the new secret once.
Requires a team API key with webhooks:manage. Project tokens are not accepted.
POST
/
platform
/
webhooks
/
{webhookId}
/
secret-rotations
Rotate team webhook secret
curl --request POST \
--url https://api.polymorfa.com/platform/webhooks/{webhookId}/secret-rotations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"overlapSeconds": 3600
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({overlapSeconds: 3600})
};
fetch('https://api.polymorfa.com/platform/webhooks/{webhookId}/secret-rotations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/platform/webhooks/{webhookId}/secret-rotations"
payload = { "overlapSeconds": 3600 }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/platform/webhooks/{webhookId}/secret-rotations"
payload := strings.NewReader("{\n \"overlapSeconds\": 3600\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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))
}false{
"data": {
"webhookId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operationId": null,
"secretAvailable": true,
"secretMetadata": {
"version": 2,
"createdAt": "2023-11-07T05:31:56Z",
"previousValidUntil": "2023-11-07T05:31:56Z"
},
"idempotency": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"replayed": true,
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}Authorizations
Send your team API key or project token as Authorization: Bearer <token>. The credential must have the required permissions. Project tokens can access only their own project.
Headers
Specifies idempotency key for this header parameter.
Value constraints
| Constraint | Accepted input |
|---|---|
| String length | 1 through 255 characters |
Required string length:
1 - 255Path Parameters
Identifier for the webhook.
Value constraints
| Constraint | Accepted input |
|---|---|
| Format | uuid |
Body
application/json
Specifies overlap seconds for this management rotate webhook secret input.
Value constraints
| Constraint | Accepted input |
|---|---|
| Numeric value | 0 through 86400 (inclusive) |
Required range:
0 <= x <= 86400Response
Success
Structured data carried by this object.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Rotate team webhook secret
curl --request POST \
--url https://api.polymorfa.com/platform/webhooks/{webhookId}/secret-rotations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"overlapSeconds": 3600
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({overlapSeconds: 3600})
};
fetch('https://api.polymorfa.com/platform/webhooks/{webhookId}/secret-rotations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.polymorfa.com/platform/webhooks/{webhookId}/secret-rotations"
payload = { "overlapSeconds": 3600 }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.polymorfa.com/platform/webhooks/{webhookId}/secret-rotations"
payload := strings.NewReader("{\n \"overlapSeconds\": 3600\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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))
}false{
"data": {
"webhookId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"operationId": null,
"secretAvailable": true,
"secretMetadata": {
"version": 2,
"createdAt": "2023-11-07T05:31:56Z",
"previousValidUntil": "2023-11-07T05:31:56Z"
},
"idempotency": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key": "<string>",
"replayed": true,
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"param": "<string>"
},
"data": null,
"docs": "<string>"
}