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

# Add Webhook

## Overview

The "Add Webhook" endpoint is designed to enable Toingg to perform specific actions by triggering external systems during a call. By sending a POST request to the `/add_webhook` endpoint, users can configure the webhook to respond to particular events, such as call initiation or completion. This setup allows Toingg to interact with external services in real-time, facilitating actions like data updates, notifications, or other automated processes. Users can specify the webhook's name, event path, HTTP method, and any necessary headers or JSON data to ensure the webhook functions as intended, providing a seamless integration experience.

#### Example cURL Request

```bash theme={null}
curl -X POST \
  https://api.toingg.com/api/v3/webhooks/add_webhook \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -d '{
    "name": "YOUR_WEBHOOK_NAME",
    "path": "/your/event/path",
    "method": "POST",
    "description": "Optional description of this webhook",
    "headers": [
      {
        "name": "X-Custom-Header",
        "value": "your_header_value"
      }
    ],
    "params": [
      {
        "name": "api_key",
        "value": "your_api_key"
      }
    ],
    "json_data": {
      "custom_field": "custom_value"
    }
  }'
```


## OpenAPI

````yaml POST /add_webhook
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.toingg.com/api/v3
security: []
paths:
  /add_webhook:
    post:
      tags:
        - Webhook handling
      summary: Add Webhook
      operationId: add_webhook_add_webhook_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Endpoint'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    Endpoint:
      properties:
        name:
          type: string
          title: Name
        path:
          type: string
          title: Path
        method:
          $ref: '#/components/schemas/endpointMethod'
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        headers:
          anyOf:
            - type: object
            - type: 'null'
          title: Headers
        params:
          anyOf:
            - type: object
            - type: 'null'
          title: Params
        json_data:
          anyOf:
            - type: object
            - type: 'null'
          title: Json Data
      type: object
      required:
        - name
        - path
        - method
      title: Endpoint
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    endpointMethod:
      type: string
      enum:
        - GET
        - POST
        - PUT
        - DELETE
      title: endpointMethod
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: login

````