---
title: "Self-register this portal's webhook"
method: PUT
path: "/webhook-subscription"
tags: ["Webhooks"]
---

# Self-register this portal's webhook

`PUT /webhook-subscription`

Subscribe the calling portal's webhook for the authenticated organization.

OAuth-token only: the client is resolved from the token (not the body), the
org from the token's ``org`` claim — a portal can only ever register its own
webhook, for orgs that consented to it.

## Request body

- object
  - `target_url` string, required — HTTPS receiver yourang POSTs signed event notifications to
  - `event_types` string[] — Event-type patterns to subscribe to (e.g. event.*, contact.*)

## Response `200`

Successful Response

- object
  - `ok` boolean, required
  - `data` object, nullable
    - `id` string, uuid, required — Webhook endpoint identifier
    - `target_url` string, required — Where deliveries are POSTed
    - `event_types` string[], required — Subscribed event-type patterns
    - `signing_secret` string, required — HMAC-SHA256 secret to verify X-Yourang-Signature
  - `meta` object, nullable
    - `limit` integer, required
    - `offset` integer, required
    - `total_items` integer, required
  - `error` object, nullable
    - `code` string, required
    - `message` string, required
    - `details` union
      - string
      - string[]
      - object

## Other responses

- `400` — Invalid request data
- `401` — Invalid or missing API key
- `403` — Insufficient permissions

---

[API](https://skmtc.net/yourang/apis/yourang-ai-external-api-v1.md) · [All operations](https://skmtc.net/yourang/apis/yourang-ai-external-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/yourang/yourang-ai-external-api-v1/revisions/49680ee64400/schema)
