> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cds.marmar.life/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a new webhook

> Creates a webhook with an auto-generated secret. The secret is only returned in this response.



## OpenAPI

````yaml /openapi/marmar-cds.openapi.yaml post /v1/webhooks
openapi: 3.1.0
info:
  title: Marmar Clinical Decision Support Reference
  version: 0.1.0
  description: >
    API for integrating Marmar's medication safety assessments into clinical
    workflows. Tenants can synchronize patient records, request assessments, and
    receive webhook notifications when assessments are completed.
servers:
  - url: https://cds.marmar.life
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: Patients
  - name: Assessments
  - name: Tenants
  - name: Webhooks
  - name: FHIR
paths:
  /v1/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create a new webhook
      description: >-
        Creates a webhook with an auto-generated secret. The secret is only
        returned in this response.
      operationId: createWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateWebhookRequest'
      responses:
        '201':
          description: Webhook created
          content:
            application/json:
              schema:
                type: object
                properties:
                  webhook:
                    $ref: '#/components/schemas/Webhook'
                  secret:
                    type: string
                    description: Auto-generated secret. Store securely - not shown again.
                required:
                  - webhook
                  - secret
        '400':
          description: Invalid request payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    CreateWebhookRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 128
          description: Human-readable name for this webhook
        url:
          type: string
          format: uri
          description: URL to receive webhook deliveries
        events:
          type: array
          items:
            type: string
          description: Event types to subscribe to (defaults to ["assessment.completed"])
      required:
        - name
        - url
    Webhook:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          maxLength: 128
        url:
          type: string
          format: uri
        events:
          type: array
          items:
            type: string
          default:
            - assessment.completed
        status:
          type: string
          enum:
            - active
            - paused
            - disabled
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - url
        - events
        - status
        - createdAt
        - updatedAt
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
      required:
        - message
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key obtained from the Tenant Dashboard. Use as Authorization: Bearer
        YOUR_API_KEY

````