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

# Create a new database webhook



## OpenAPI

````yaml openapi-admin post /webhooks
openapi: 3.0.3
info:
  version: 1.2.0
  title: Hanko Admin API
  description: >
    ## Introduction


    This is the OpenAPI specification for the [Hanko Admin
    API](https://github.com/teamhanko/hanko/blob/main/backend/README.md#start-private-api).


    ## Authentication


    The Admin API must be protected by an access management system.


    ---
  contact:
    email: developers@hanko.io
  license:
    name: AGPL-3.0-or-later
    url: https://www.gnu.org/licenses/agpl-3.0.txt
servers:
  - url: https://{tenant_id}.hanko.io/admin
    variables:
      tenant_id:
        default: ''
        description: The (UU)ID of a tenant. Replace the default value with your tenant ID.
security: []
externalDocs:
  description: More about Hanko
  url: https://github.com/teamhanko/hanko
paths:
  /webhooks:
    post:
      summary: Create a new database webhook
      operationId: create-db-webhooks
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Webhook'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseWebhook'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerApiKeyAuth: []
components:
  schemas:
    Webhook:
      type: object
      title: Webhook
      properties:
        callback:
          type: string
          format: uri
        events:
          type: array
          minItems: 1
          items:
            type: string
            enum:
              - user
              - user.login
              - user.create
              - user.delete
              - user.update
              - user.update.email
              - user.update.email.create
              - user.update.email.delete
              - user.update.email.primary
              - user.update.username
              - user.update.username.create
              - user.update.username.delete
              - user.update.username.update
              - email.send
      required:
        - callback
        - events
    DatabaseWebhook:
      type: object
      title: DatabaseWebhook
      properties:
        id:
          type: string
          format: uuid
        callback:
          type: string
          format: uri
        enabled:
          type: boolean
        failures:
          type: integer
          minimum: 0
        expires_at:
          type: string
          format: date-time
        events:
          type: array
          items:
            $ref: '#/components/schemas/DatabaseWebhookEvent'
        created_at:
          type: string
          format: date-time
        updated_at:
          description: Time of last update of the audit log
          type: string
          format: date-time
          example: '2022-09-14T12:15:09.788784Z'
    DatabaseWebhookEvent:
      type: object
      title: DatabaseWebhookEvent
      properties:
        id:
          type: string
          format: uuid
        event:
          type: string
          enum:
            - user
            - user.login
            - user.create
            - user.delete
            - user.update
            - user.update.email
            - user.update.email.create
            - user.update.email.delete
            - user.update.email.primary
            - user.update.username
            - user.update.username.create
            - user.update.username.delete
            - user.update.username.update
            - email.send
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 400
            message: Bad Request
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: 500
            message: Internal Server Error
  securitySchemes:
    BearerApiKeyAuth:
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your API key. Must only be used when using Hanko Cloud.
      type: http
      scheme: bearer
      bearerFormat: API Key

````