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

# Creating a New Webhook for a List

> This endpoint creates a webhook for a list

## Request URL

```http theme={null}
POST https://app.tatango.com/api/v2/lists/{ID}/webhooks
```


## OpenAPI

````yaml POST /api/v2/lists/{ID}/webhooks
openapi: 3.1.0
info:
  title: Tatango Legacy v2 API
  description: Tatango legacy v2 API endpoints for existing integrations.
  version: 2.0.0
servers:
  - url: https://app.tatango.com
security:
  - basicAuth: []
paths:
  /api/v2/lists/{ID}/webhooks:
    post:
      tags:
        - Webhooks
      summary: Creating a New Webhook for a List
      description: This endpoint creates a webhook for a list
      parameters:
        - name: ID
          in: path
          description: The ID of the list
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                webhook:
                  type: object
                  properties:
                    callback_url:
                      type: string
                      description: >-
                        The URL to receive webhook events. Must be a valid HTTP
                        or HTTPS endpoint.
                      example: http://localhost.dev/null?api_key=foo_bar_baz
                    subscribe:
                      type: boolean
                      description: >-
                        Whether to receive subscription events (e.g., when a
                        user subscribes).
                      example: true
                    unsubscribe:
                      type: boolean
                      description: Whether to receive unsubscription events.
                      example: true
                    message_sent:
                      type: boolean
                      description: Whether to receive events when a message is sent.
                      example: false
                  required:
                    - callback_url
                    - subscribe
                    - unsubscribe
                    - message_sent
      responses:
        '200':
          description: Webhook created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateWebhookResponse'
              example:
                status: Webhook created
                webhook:
                  callback_url: http://localhost.dev/null?api_key=foo_bar_baz
                  created_at: '2016-09-07T14:11:13-07:00'
                  enabled: true
                  id: 4
                  list_id: 29
                  message_sent: false
                  subscribe: true
                  unsubscribe: true
                  updated_at: '2016-09-07T14:11:13-07:00'
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: >-
            curl "https://app.tatango.com/api/v2/lists/ID/webhooks" -d
            '{"webhook":{"url":"https://example.com/webhook","event":"delivery_status"}}'
            -X POST \
              -H "Accept: application/json" \
              -H "Content-Type: application/json" \
              -u emailaddress@mydomain.com:my_api_key \
              -H "Host: example.org" \
              -H "Cookie: "
        - lang: Ruby
          label: Ruby
          source: >-
            require 'net/http'

            require 'uri'

            require 'json'


            uri = URI.parse('https://app.tatango.com/api/v2/lists/ID/webhooks')

            http = Net::HTTP.new(uri.host, uri.port)

            http.use_ssl = true

            request = Net::HTTP::Post.new(uri.request_uri)

            request.basic_auth("emailaddress@mydomain.com", "my_api_key")

            request['Accept'] = 'application/json'

            request['Content-Type'] = 'application/json'

            request.body = {"webhook" => {"url" =>
            "https://example.com/webhook", "event" =>
            "delivery_status"}}.to_json

            response = http.request(request)
components:
  schemas:
    CreateWebhookResponse:
      type: object
      properties:
        status:
          type: string
          example: Webhook created
        webhook:
          type: object
          properties:
            callback_url:
              type: string
              example: http://localhost.dev/null?api_key=foo_bar_baz
            created_at:
              type: string
              example: '2016-09-07T14:11:13-07:00'
            enabled:
              type: boolean
              example: true
            id:
              type: integer
              example: 4
            list_id:
              type: integer
              example: 29
            message_sent:
              type: boolean
              example: false
            subscribe:
              type: boolean
              example: true
            unsubscribe:
              type: boolean
              example: true
            updated_at:
              type: string
              example: '2016-09-07T14:11:13-07:00'
      required:
        - status
        - webhook
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Tatango authenticates API requests by validating an API key passed via
        HTTP Basic Authentication. Use your login email as the username and your
        API key as the password.

````