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

# Create a webhook subscription

> Create a webhook subscription to deliver webhook notifications to a specified URL endpoint for your application. Requires a destination URL where Dwolla will send notifications and a secret key for webhook validation and security. Returns the location of the created subscription resource. Essential for establishing real-time event notifications and automated integrations with Dwolla's payment processing events.



## OpenAPI

````yaml post /webhook-subscriptions
openapi: 3.1.0
info:
  title: Dwolla API
  description: Dwolla API Documentation
  contact:
    name: Dwolla Developer Relations Team
    url: https://developers.dwolla.com
    email: api@dwolla.com
  version: '2.0'
  termsOfService: https://www.dwolla.com/legal/tos/
  license:
    name: MIT
    url: https://github.com/Dwolla/dwolla-openapi/blob/master/LICENSE
servers:
  - url: https://api.dwolla.com
    description: Production server
  - url: https://api-sandbox.dwolla.com
    description: Sandbox server
security:
  - clientCredentials: []
tags:
  - name: tokens
    description: Operations related to Application Access Tokens
  - name: root
    description: Root API operations
  - name: accounts
    description: Operations related to Accounts
  - name: customers
    description: Operations related to Customers
  - name: kba
    description: Operations related to Knowledge-Based Authentication
  - name: beneficial owners
    description: Operations related to Beneficial Owners
  - name: documents
    description: Operations related to Documents
  - name: exchanges
    description: Operations related to Exchanges
  - name: exchange sessions
    description: Operations related to Exchange Sessions
  - name: funding sources
    description: Operations related to Funding Sources
  - name: transfers
    description: Operations related to Transfers
  - name: labels
    description: Operations related to Labels
  - name: mass payments
    description: Operations related to Mass Payments
  - name: events
    description: Operations related to Events
  - name: webhook subscriptions
    description: Operations related to Webhook Subscriptions
  - name: webhooks
    description: Operations related to Webhooks
  - name: client tokens
    description: Operations related to Client Tokens
  - name: sandbox simulations
    description: Sandbox-only operations for simulating processing of bank transfers
paths:
  /webhook-subscriptions:
    post:
      tags:
        - webhook subscriptions
      summary: Create a webhook subscription
      description: >-
        Create a webhook subscription to deliver webhook notifications to a
        specified URL endpoint for your application. Requires a destination URL
        where Dwolla will send notifications and a secret key for webhook
        validation and security. Returns the location of the created
        subscription resource. Essential for establishing real-time event
        notifications and automated integrations with Dwolla's payment
        processing events.
      operationId: createWebhookSubscription
      parameters:
        - $ref: '#/components/parameters/Accept'
      requestBody:
        required: true
        description: Parameters to create a webhook subscriptions
        content:
          application/json:
            schema:
              required:
                - url
                - secret
              type: object
              properties:
                url:
                  type: string
                  example: http://myapplication.com/webhooks
                secret:
                  type: string
                  example: sshhhhhh
      responses:
        '201':
          description: create
          headers:
            Location:
              $ref: '#/components/headers/Location'
        '400':
          description: Bad request
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/InvalidUrlFormatError'
                  - $ref: '#/components/schemas/SecretTooLongError'
                  - $ref: '#/components/schemas/MaxSubscriptionsReachedError'
        '403':
          description: Forbidden
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: Not Found
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
        '429':
          description: Too Many Requests
          headers: {}
          content:
            application/vnd.dwolla.v1.hal:
              schema:
                $ref: '#/components/schemas/TooManyRequestsError'
      x-codeSamples:
        - lang: bash
          source: >
            POST https://api-sandbox.dwolla.com/webhook-subscriptions

            Accept: application/vnd.dwolla.v1.hal+json

            Content-Type: application/vnd.dwolla.v1.hal+json

            Authorization: Bearer
            0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q

            {
                "url": "http://myapplication.com/webhooks",
                "secret": "sshhhhhh"
            }
        - lang: javascript
          source: |
            // Using dwolla-v2 - https://github.com/Dwolla/dwolla-v2-node
            var requestBody = {
              url: "http://myawesomeapplication.com/destination",
              secret: "your webhook secret",
            };
            dwolla
              .post("webhook-subscriptions", requestBody)
              .then((res) => res.headers.get("location")); // => 'https://api-sandbox.dwolla.com/webhook-subscriptions/5af4c10a-f6de-4ac8-840d-42cb65454216'
        - lang: python
          source: >
            # Using dwollav2 - https://github.com/Dwolla/dwolla-v2-python

            request_body = {
              'url': 'http://myapplication.com/webhooks',
              'secret': 'sshhhhhh'
            }

            subscription = app_token.post('webhook-subscriptions', request_body)

            subscription.headers['location'] # =>
            'https://api-sandbox.dwolla.com/webhook-subscriptions/5af4c10a-f6de-4ac8-840d-42cb65454216'
        - lang: php
          source: >
            <?php

            // Using dwollaswagger -
            https://github.com/Dwolla/dwolla-swagger-php

            $webhookApi = new DwollaSwagger\WebhooksubscriptionsApi($apiClient);

            $subscription = $webhookApi->create(array (
              'url' => 'http://myapplication.com/webhooks',
              'secret' => 'sshhhhhh',
            ));

            $subscription; # =>
            "https://api-sandbox.dwolla.com/webhook-subscriptions/5af4c10a-f6de-4ac8-840d-42cb65454216"

            ?>
        - lang: ruby
          source: >
            # Using dwolla_v2 - https://github.com/Dwolla/dwolla-v2-ruby

            request_body = {
              :url => "http://myawesomeapplication.com/destination",
              :secret => "your webhook secret"
            }

            subscription = app_token.post "webhook-subscriptions", request_body

            subscription.response_headers[:location] # =>
            "https://api-sandbox.dwolla.com/webhook-subscriptions/5af4c10a-f6de-4ac8-840d-42cb65454216"
components:
  parameters:
    Accept:
      name: Accept
      in: header
      required: true
      description: >-
        The media type of the response. Must be
        application/vnd.dwolla.v1.hal+json
      schema:
        type: string
        enum:
          - application/vnd.dwolla.v1.hal+json
        default: application/vnd.dwolla.v1.hal+json
  headers:
    Location:
      description: The location of the created resource
      schema:
        type: string
  schemas:
    InvalidUrlFormatError:
      title: InvalidUrlFormatError
      type: object
      properties:
        code:
          type: string
          example: ValidationError
        message:
          type: string
          example: >-
            Validation error(s) present. See embedded errors list for more
            details.
        _embedded:
          type: object
          properties:
            errors:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    example: InvalidFormat
                  message:
                    type: string
                    example: Url must be a valid url.
                  path:
                    type: string
                    example: /url
                  _links:
                    type: object
                    example: {}
    SecretTooLongError:
      title: SecretTooLongError
      type: object
      properties:
        code:
          type: string
          example: ValidationError
        message:
          type: string
          example: >-
            Validation error(s) present. See embedded errors list for more
            details.
        _embedded:
          type: object
          properties:
            errors:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    example: InvalidFormat
                  message:
                    type: string
                    example: Secret must be 128 or fewer characters.
                  path:
                    type: string
                    example: /secret
                  _links:
                    type: object
                    example: {}
    MaxSubscriptionsReachedError:
      title: MaxSubscriptionsReachedError
      type: object
      properties:
        code:
          type: string
          example: MaxNumberOfResources
        message:
          type: string
          example: The maximum number of subscriptions has been reached.
    ForbiddenError:
      title: ForbiddenError
      description: Error response schema for 403 Forbidden
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: Forbidden
        message:
          type: string
          example: The supplied credentials are not authorized for this resource.
    NotFoundError:
      title: NotFoundError
      description: Error response schema for 404 NotFound
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: NotFound
        message:
          type: string
          example: The requested resource was not found.
    TooManyRequestsError:
      title: TooManyRequestsError
      type: object
      properties:
        code:
          type: string
          example: Too Many Requests
        message:
          type: string
          example: Please wait a short period of time before re-attempting the request.
  securitySchemes:
    clientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /token
          x-speakeasy-token-endpoint-authentication: client_secret_basic
          scopes: {}

````