# Update submerchant webhooks

Sets a custom webhook URL (`customUrl`) or restores the default URL from the Flow service (`useDefault`).
At least one of the `flow` or `payment` objects is required. Within an object, `customUrl` and `useDefault` are mutually exclusive.
When a custom URL is set for the first time, a new webhook key is generated and returned once in the response.

Endpoint: PATCH /flow/{flowServiceId}/submerchants/{submerchantId}/webhooks
Version: 1.0.0
Security: bearerAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer scopes: flow.submerchants.webhooks, flow.submerchants.webhooks.update

## Path parameters:

  - `flowServiceId` (string, required)
    Flow service ID

  - `submerchantId` (string, required)
    Submerchant ID (`flsm_...`) or its `customId`

## Request fields (application/json):

  - `flow` (object)

  - `flow.customUrl` (string)
    Custom webhook URL
    Example: https://example.com/ipn

  - `flow.useDefault` (boolean)
    Restore the default URL (removes the custom URL and key)
    Example: true

## Request examples:

  - `Custom payment webhook URL` (unknown)

  - `Restore default Flow webhook URL` (unknown)

## Response 200 fields (application/json):

  - `success` (boolean, required)
    Request status

  - `data` (object, required)

  - `data.paymentNewIpnKey` (string, required)
    New payment webhook key (only when it has been generated)
    Example: aVeryLongAndSecureKeyFor32Chars0

  - `data.flowNewIpnKey` (string, required)
    New Flow webhook key (only when it has been generated)
    Example: null

## Response 400:

  - `400` (unknown)
    The submerchant has no assigned (`FLOW_SUBMERCHANT_PAYMENT_SERVICE_NOT_FOUND`) or active (`FLOW_SUBMERCHANT_PAYMENT_SERVICE_NOT_ACTIVE`) Online Payments service

## Response 400 fields (application/json):

  - `success` (boolean, required)
    Request status

  - `message` (string)
    Error description

  - `errorCode` (string, required)
    Error code

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `feedbackUrl` (string)
    URL for reporting API problems (`POST /feedback`). Returned for authenticated API keys.
    Example: https://api.simpay.pl/feedback

  - `success` (boolean, required)
    Request status

  - `errorCode` (string, required)
    Error status code
    Enum: "UNAUTHORIZED"

## Response 403:

  - `403` (unknown)
    Forbidden

## Response 403 fields (application/json):

  - `feedbackUrl` (string)
    URL for reporting API problems (`POST /feedback`). Returned for authenticated API keys.
    Example: https://api.simpay.pl/feedback

  - `success` (boolean, required)
    Request status

  - `errorCode` (string, required)
    Error status code
    Enum: "INVALID_ABILITY_PROVIDED", "IP_ADDRESS_NOT_WHITELISTED"

## Response 404:

  - `404` (unknown)
    Submerchant not found (`FLOW_SUBMERCHANT_NOT_FOUND`)

## Response 404 fields (application/json):

  - `success` (boolean, required)
    Request status

  - `message` (string)
    Error description

  - `errorCode` (string, required)
    Error code

## Response 422:

  - `422` (unknown)
    Unprocessable Content

## Response 422 fields (application/json):

  - `feedbackUrl` (string)
    URL for reporting API problems (`POST /feedback`). Returned for authenticated API keys.
    Example: https://api.simpay.pl/feedback

  - `success` (boolean, required)
    Request status

  - `errorCode` (string, required)
    Error status code
    Enum: "VALIDATION_ERROR"

  - `errors` (object, required)

  - `errors.amount` (array)

