Update a Webhook
Replaces an existing webhook’s settings. PUT expects the full body shape (same required fields as Create a Webhook), not a partial patch.
Request
PUT /api/webhooks/{webhook} HTTP/1.1
Host: app.nomacms.com
Content-Type: application/json
project-id: <project-uuid>
Authorization: Bearer <api-token>
Accept: application/json| Path segment | Description |
|---|---|
{webhook} | Webhook UUID |
Requires the admin ability on the token.
JSON body
Same fields as Create a Webhook. All required keys must be present on every update.
secret: If you omit secret from the JSON, the existing secret is left unchanged. If you include secret, it replaces the stored value (subject to the same length rules as create).
Response (200)
JSON object — same shape as Get a Webhook. The secret is never returned.
Errors
| Status | When |
|---|---|
| 400 | Missing project-id or project cannot be resolved |
| 401 | Missing or invalid bearer token |
| 403 | Token does not have admin (or *) |
| 404 | Unknown UUID or webhook belongs to another project (Webhook not found.) |
| 422 | Validation failed |
| 429 | Rate limited |
Example
import { createClient } from "@nomacms/js-sdk"
const client = createClient({
projectId: process.env.NOMA_PROJECT_ID!,
apiKey: process.env.NOMA_API_KEY!,
})
await client.webhooks.update(process.env.NOMA_WEBHOOK_UUID!, {
name: "Rebuild site (prod)",
description: "Production revalidation",
url: "https://example.com/api/revalidate",
events: ["content.published", "content.unpublished", "content.updated"],
sources: ["cms", "api"],
payload: true,
status: true,
})import axios from "axios"
async function main() {
const uuid = process.env.NOMA_WEBHOOK_UUID!
const { data } = await axios.put(
`https://app.nomacms.com/api/webhooks/${uuid}`,
{
name: "Rebuild site (prod)",
description: "Production revalidation",
url: "https://example.com/api/revalidate",
events: ["content.published", "content.unpublished", "content.updated"],
sources: ["cms", "api"],
payload: true,
status: true,
collection_ids: [],
},
{
headers: {
"Content-Type": "application/json",
"project-id": process.env.NOMA_PROJECT_ID!,
Authorization: `Bearer ${process.env.NOMA_API_KEY}`,
Accept: "application/json",
},
},
)
console.log(data)
}
void main()curl -sS -X PUT "https://app.nomacms.com/api/webhooks/$NOMA_WEBHOOK_UUID" \
-H "Content-Type: application/json" \
-H "project-id: $NOMA_PROJECT_ID" \
-H "Authorization: Bearer $NOMA_API_KEY" \
-H "Accept: application/json" \
-d '{"name":"Rebuild site (prod)","url":"https://example.com/api/revalidate","events":["content.published","content.updated"],"sources":["cms","api"],"payload":true,"status":true,"collection_ids":[]}'Related
- Create a Webhook — Validation rules and allowed events
- Get a Webhook — Read current values before updating
- JavaScript SDK — Webhooks —
webhooks.update