Noma

Update a Webhook

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 segmentDescription
{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

StatusWhen
400Missing project-id or project cannot be resolved
401Missing or invalid bearer token
403Token does not have admin (or *)
404Unknown UUID or webhook belongs to another project (Webhook not found.)
422Validation failed
429Rate 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":[]}'
  • Create a Webhook — Validation rules and allowed events
  • Get a Webhook — Read current values before updating
  • JavaScript SDK — Webhookswebhooks.update

Search documentation

Find guides and reference pages