# Create Webhook

Create a new webhook subscription for the specified event type.

Endpoint: POST /webhooks
Version: 1.0.0
Security: bearerAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer JWT

## Request fields (application/json):

  - `eventType` (string, required)
    The type of event to subscribe to. Currently only `PdvRequestCompleted` is supported for self-service webhooks.
    Enum: "PdvRequestCompleted"

  - `clientUrl` (string, required)
    The HTTPS URL where webhook payloads will be delivered. Must be a valid HTTPS URL.
    Example: https://your-tms.example.com/webhooks/trucker-tools

## Response 201:

  - `201` (unknown)
    Webhook created successfully

## Response 201 fields (application/json):

  - `uuid` (string)
    Unique identifier for the webhook
    Example: 550e8400-e29b-41d4-a716-446655440000

  - `eventType` (string)
    The event type this webhook subscribes to
    Example: PdvRequestCompleted

  - `clientUrl` (string)
    The URL where webhook payloads are delivered
    Example: https://your-tms.example.com/webhooks/trucker-tools

  - `isActive` (boolean)
    Whether the webhook is currently active
    Example: true

  - `createdAt` (string)
    When the webhook was created
    Example: 2024-05-24T19:50:18.053Z

## Response 201 headers (application/json):

  - `Location` (string)
    URL of the created webhook resource
    Example: /api/v1/webhooks/550e8400-e29b-41d4-a716-446655440000

## Response 400:

  - `400` (unknown)
    Bad request - Invalid request syntax

## Response 400 fields (application/json):

  - `statusCode` (integer)
    HTTP status code
    Example: 422

  - `errors` (array)

  - `errors.appName` (string)
    Application name
    Example: loadtracking-api

  - `errors.dateTime` (string)
    When the error occurred
    Example: 2024-05-24T19:50:18.053Z

  - `errors.message` (string)
    Human-readable error message
    Example: Invalid eventType. Must be one of: PdvRequestCompleted

  - `errors.keyword` (string)
    Error type keyword
    Example: enum

  - `errors.params` (object)
    Additional error parameters

  - `errors.params.field` (string)
    Example: eventType

  - `errors.params.allowedValues` (array)
    Example: ["PdvRequestCompleted"]

## Response 401:

  - `401` (unknown)
    Unauthorized - Invalid or expired token

## Response 401 fields (application/json):

  - `statusCode` (integer)
    HTTP status code
    Example: 422

  - `errors` (array)

  - `errors.appName` (string)
    Application name
    Example: loadtracking-api

  - `errors.dateTime` (string)
    When the error occurred
    Example: 2024-05-24T19:50:18.053Z

  - `errors.message` (string)
    Human-readable error message
    Example: Invalid eventType. Must be one of: PdvRequestCompleted

  - `errors.keyword` (string)
    Error type keyword
    Example: enum

  - `errors.params` (object)
    Additional error parameters

  - `errors.params.field` (string)
    Example: eventType

  - `errors.params.allowedValues` (array)
    Example: ["PdvRequestCompleted"]

## Response 409:

  - `409` (unknown)
    Conflict - Webhook already exists for this event type and URL

## Response 409 fields (application/json):

  - `statusCode` (integer)
    HTTP status code
    Example: 422

  - `errors` (array)

  - `errors.appName` (string)
    Application name
    Example: loadtracking-api

  - `errors.dateTime` (string)
    When the error occurred
    Example: 2024-05-24T19:50:18.053Z

  - `errors.message` (string)
    Human-readable error message
    Example: Invalid eventType. Must be one of: PdvRequestCompleted

  - `errors.keyword` (string)
    Error type keyword
    Example: enum

  - `errors.params` (object)
    Additional error parameters

  - `errors.params.field` (string)
    Example: eventType

  - `errors.params.allowedValues` (array)
    Example: ["PdvRequestCompleted"]

## Response 422:

  - `422` (unknown)
    Validation error

## Response 422 fields (application/json):

  - `statusCode` (integer)
    HTTP status code
    Example: 422

  - `errors` (array)

  - `errors.appName` (string)
    Application name
    Example: loadtracking-api

  - `errors.dateTime` (string)
    When the error occurred
    Example: 2024-05-24T19:50:18.053Z

  - `errors.message` (string)
    Human-readable error message
    Example: Invalid eventType. Must be one of: PdvRequestCompleted

  - `errors.keyword` (string)
    Error type keyword
    Example: enum

  - `errors.params` (object)
    Additional error parameters

  - `errors.params.field` (string)
    Example: eventType

  - `errors.params.allowedValues` (array)
    Example: ["PdvRequestCompleted"]

