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

# Create webhook

> Registers a webhook and returns its secret once.



## OpenAPI

````yaml /hub/openapi/hub.json post /api/v1/hub/webhooks
openapi: 3.0.1
info:
  title: Fanify Hub API
  description: Generate media and text with Fanify credits. All prices use EUR.
  version: v1
servers:
  - url: https://fanifyai.com
security: []
paths:
  /api/v1/hub/webhooks:
    post:
      tags:
        - Webhooks
      summary: Create webhook
      description: Registers a webhook and returns its secret once.
      requestBody:
        description: Webhook registration
        content:
          application/json:
            schema:
              required:
                - url
                - events
              type: object
              properties:
                url:
                  type: string
                  format: uri
                events:
                  type: array
                  items:
                    enum:
                      - generation.running
                      - generation.completed
                    type: string
              additionalProperties: false
            example:
              url: https://host/FanifyHub/Webhook
              events:
                - generation.running
                - generation.completed
        required: true
      responses:
        '201':
          description: Webhook endpoint and one-time secret.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookEndpointDto'
              example:
                id: 0192f3a4-8c1e-7b2a-9f10-2b6d4e0c9a11
                url: https://host/FanifyHub/Webhook
                events:
                  - generation.running
                  - generation.completed
                created_at: '2026-09-07T10:00:00Z'
                last_error: null
                secret: 3s9K7dQ2pR1sT4uV6wX9yZ0aB2cD4eF6gH8iJ0kL2mN
        '400':
          description: Invalid input
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - invalid_input
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#invalid_input
                title: Invalid input
                status: 400
                code: invalid_input
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - unauthorized
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#unauthorized
                title: Unauthorized
                status: 401
                code: unauthorized
        '429':
          description: Rate limit reached
          headers:
            Retry-After:
              description: Seconds before retrying.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - rate_limited
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#rate_limited
                title: Rate limit reached
                status: 429
                code: rate_limited
        '503':
          description: Webhooks not configured
          content:
            application/problem+json:
              schema:
                required:
                  - type
                  - title
                  - status
                  - code
                type: object
                properties:
                  type:
                    type: string
                    format: uri
                  title:
                    type: string
                  status:
                    type: integer
                    format: int32
                  detail:
                    type: string
                    nullable: true
                  instance:
                    type: string
                  code:
                    enum:
                      - webhooks_not_configured
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
                  unrepresentable:
                    type: array
                    items:
                      type: string
              example:
                type: https://fanifyai.com/docs/hub/errors#webhooks_not_configured
                title: Webhooks not configured
                status: 503
                code: webhooks_not_configured
      security:
        - Bearer: []
components:
  schemas:
    WebhookEndpointDto:
      required:
        - created_at
        - events
        - id
        - last_error
        - secret
        - url
      type: object
      properties:
        id:
          type: string
          format: uuid
        url:
          type: string
        events:
          type: array
          items:
            type: string
        created_at:
          type: string
          format: date-time
        last_error:
          type: string
          nullable: true
        secret:
          type: string
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: http
      description: Fanify API key.
      scheme: bearer
      bearerFormat: fanify_sk_...

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.