# Create webhook

Creates a new webhook endpoint to receive payment and order events. Webhook endpoints are inactive until activated by calling the patch endpoint with the status set to ACTIVE.

Endpoint: POST /webhooks/create
Version: 2.0.0
Security: bearerAuth

## Request fields (application/json):

  - `name` (string, required)
    Webhook endpoint name.
    Example: "Billing webhook endpoint"

  - `description` (string)
    Webhook endpoint description.
    Example: "Receives billing events for integration"

  - `url` (string, required)
    URL where the webhook events are sent.
    Example: "https://mycompany.com/solidgate/webhook"

  - `event_types` (array, required)
    List of event types the webhook subscribes to.
    Example: ["INVOICE_CREATED","CUSTOMER_UPDATED"]

  - `included_channel_ids` (array)
    List of channel IDs to include in the webhook events.
Cannot be used together with excluded_channel_ids.
    Example: ["chn_01ARZ3NDEKTSV4RRFFQ69G5FAV","chn_01KTXHKMEXBM5JMEQAHBCV6802"]

  - `excluded_channel_ids` (array)
    List of channel IDs to exclude from the webhook events.
Cannot be used together with included_channel_ids.
    Example: ["chn_01ARZ3NDEKTSV4RRFFQ69G5FAV","chn_01KTXHKMEXBM5JMEQAHBCV6802"]

## Response 200 fields (application/json):

  - `id` (string, required)
    Unique webhook endpoint identifier.
    Example: "wep_e2ab41b4-ffa6-490b-9cff-bd3288425aa0"

  - `url` (string, required)
    URL where the webhook events are sent.
    Example: "https://mycompany.com/solidgate/webhook"

  - `event_types` (array, required)
    List of event types the webhook subscribes to.
    Example: ["INVOICE_CREATED","CUSTOMER_UPDATED"]

  - `status` (string, required)
    Webhook endpoint status.
    Enum: "ACTIVE", "INACTIVE"

  - `secret` (string, required)
    Secret value used to sign webhook payloads. Copy and store this value securely, as it is provided only once.
    Example: "wsec_********************"

  - `created_at` (string, required)
    Date and time when the webhook endpoint was created.
    Example: "2024-01-01T10:00:00.000000Z"

  - `updated_at` (string, required)
    Date and time when the webhook endpoint was last updated.
    Example: "2024-01-02T15:00:00.000000Z"

  - `name` (string, required)
    Webhook endpoint name.
    Example: "Billing webhook endpoint"

  - `description` (string)
    Webhook endpoint description.
    Example: "Receives billing events for integration"

  - `included_channel_ids` (array)
    List of channel IDs to include in the webhook events.
Cannot be used together with excluded_channel_ids.
    Example: ["chn_01ARZ3NDEKTSV4RRFFQ69G5FAV","chn_01KTXHKMEXBM5JMEQAHBCV6802"]

  - `excluded_channel_ids` (array)
    List of channel IDs to exclude from the webhook events.
Cannot be used together with included_channel_ids.
    Example: ["chn_01ARZ3NDEKTSV4RRFFQ69G5FAV","chn_01KTXHKMEXBM5JMEQAHBCV6802"]

## Response 400 fields (application/json):

  - `code` (string, required)
    Code identifying the error type.
    Enum: "VALIDATION"

  - `message` (string, required)
    Message describing the error.
    Example: "One or more fields failed validation due to constraints"

  - `context` (object, required)
    Additional context about the validation error, including specific constraints.
    Example: {"constraints":{"email":{"type":"TYPE","message":"The 'email' field must be a valid email address"},"age":{"type":"MIN","message":"The 'age' field must be a number greater than or equal to 18"}}}

  - `context.constraints` (object, required)
    Failed constraints keyed by the field name.
    Example: {"email":{"type":"TYPE","message":"The 'email' field must be a valid email address"},"age":{"type":"MIN","message":"The 'age' field must be a number greater than or equal to 18"}}

## Response 401 fields (application/json):

  - `code` (string, required)
    Code identifying the error type.
    Enum: "UNAUTHENTICATED"

  - `message` (string, required)
    Message describing the error.
    Example: "Credentials are invalid or missing"

## Response 403 fields (application/json):

  - `code` (string, required)
    Code identifying the error type.
    Enum: "PERMISSION_DENIED"

  - `message` (string, required)
    Message describing the error.
    Example: "Permission denied"

## Response 422 fields (application/json):

  - `code` (string, required)
    Code identifying the error type.
    Enum: "ENDPOINT_ALREADY_EXISTS", "EVENT_TYPES_NOT_FOUND"

  - `message` (string, required)
    Message describing the error.
    Example: "A webhook endpoint with this URL already exists"

  - `context` (object)
    Additional error context.


