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

# Create Webhook

> Create a new webhook and configure its callback endpoint. Returns a webhook ID and a secret token for verifying incoming requests.



## OpenAPI

````yaml POST /webhooks
openapi: 3.0.0
info:
  title: Webhooks API for TON blockchain
  version: 1.0.0
  description: Real-time webhook subscriptions for TON blockchain events
  contact:
    name: Support
    email: support@tonkeeper.com
servers:
  - url: https://rt.tonapi.io
  - url: https://rt-testnet.tonapi.io
security:
  - BearerAuth: []
tags:
  - name: Webhooks
    description: Webhook CRUD operations
  - name: Account TX
    description: Account transaction subscriptions
  - name: Mempool MSG
    description: Mempool message subscriptions
  - name: Opcode MSG
    description: Opcode message subscriptions
  - name: New Contracts
    description: New contract deployment subscriptions
paths:
  /webhooks:
    post:
      tags:
        - Webhooks
      summary: Create webhook
      description: >-
        Create a new webhook and configure its callback endpoint. Returns a
        webhook ID and a secret token for verifying incoming requests.
      operationId: createWebhook
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - endpoint
              properties:
                endpoint:
                  type: string
                  description: Callback URL for receiving events.
                  example: https://your-server.com/webhook
      responses:
        '200':
          description: Webhook created
          content:
            application/json:
              schema:
                type: object
                required:
                  - webhook_id
                  - token
                properties:
                  webhook_id:
                    type: integer
                    description: Webhook identifier.
                    example: 5
                  token:
                    type: string
                    description: >-
                      Secret token sent as `Authorization` header with every
                      webhook request.
                    example: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: bad request
            status_code: 400
    Unauthorized:
      description: Unauthorized — missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: unauthorized
            status_code: 401
  schemas:
    ErrorResponse:
      type: object
      required:
        - message
        - status_code
      properties:
        message:
          type: string
        status_code:
          type: integer
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        API key from [tonconsole.com](https://tonconsole.com/). Can also be
        passed as a `token` query parameter.

````