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

# Create webhook endpoint

> Register a new webhook endpoint. When `verify` is true (default), YPH sends a synchronous `webhook.test` post request to verify endpoint readiness and reachability before creation.



## OpenAPI

````yaml /openapi.yaml post /webhooks
openapi: 3.1.0
info:
  title: YPH Public API
  version: 1.0.0
  description: |
    Programmatic access to Digital Samples, Actors, Insta Swaps, and webhooks.

    Authenticate with `Authorization: Bearer yph_sk_live_…`.
servers:
  - url: https://api.yourproducthere.ai/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: System
  - name: Account
  - name: Actors
  - name: Digital Samples
  - name: Insta Swaps
  - name: Webhooks
paths:
  /webhooks:
    post:
      tags:
        - Webhooks
      summary: Create webhook endpoint
      description: >-
        Register a new webhook endpoint. When `verify` is true (default), YPH
        sends a synchronous `webhook.test` post request to verify endpoint
        readiness and reachability before creation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - url
                - events
              properties:
                url:
                  type: string
                  format: uri
                  description: The secure HTTPS target URL to receive event payloads.
                events:
                  type: array
                  items:
                    type: string
                    enum:
                      - insta_swap.queued
                      - insta_swap.completed
                      - insta_swap.failed
                      - digital_sample.analysis.completed
                      - digital_sample.analysis.failed
                verify:
                  type: boolean
                  default: true
                  description: Whether to verify endpoint reachability synchronously.
      responses:
        '201':
          description: >-
            Created successfully (the signing secret is only returned once in
            the response)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEndpointWithSecret'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missingUrl:
                  summary: Missing Endpoint URL
                  value:
                    code: REQUIRED_FIELD_MISSING
                    error: url is required
                    parameter: url
                invalidEvents:
                  summary: Invalid Event Types
                  value:
                    code: INVALID_PARAMETER
                    error: events must only contain permitted event types
                    parameter: events
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          description: Verification failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                  error:
                    type: string
                  verify:
                    type: boolean
              examples:
                verificationFailed:
                  summary: Verification Test Failed
                  value:
                    code: UNPROCESSABLE_ENTITY
                    error: >-
                      Webhook target URL returned a non-2xx status code on
                      verification check
                    verify: false
components:
  schemas:
    WebhookEndpointWithSecret:
      type: object
      properties:
        id:
          type: string
          format: uuid
        orgId:
          type: string
        url:
          type: string
          format: uri
        events:
          type: array
          items:
            type: string
        secret:
          type: string
          description: HMAC signature secret (only returned once on creation)
        active:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        code:
          type: string
          description: >-
            A machine-readable, uppercase error code (e.g.
            `REQUIRED_FIELD_MISSING`, `INVALID_PARAMETER`, `RESOURCE_NOT_FOUND`,
            `UNAUTHORIZED`, `CONFLICT`).
        error:
          type: string
          description: A human-readable error message explaining why the request failed.
        parameter:
          type: string
          nullable: true
          description: >-
            The name of the specific input parameter or body field that caused
            the error (e.g. `seedVideoUrl`, `title`, etc.).
        details:
          type: object
          nullable: true
          description: >-
            Additional key-value pairs providing context or structured details
            about the failure.
      example:
        code: REQUIRED_FIELD_MISSING
        error: title is required
        parameter: title
        details: null
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthorized:
              summary: Invalid API Key
              value:
                code: UNAUTHORIZED
                error: Unauthorized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your organization API key starting with yph_sk_live_…

````