Update Webhook API


This API is used to update the configuration of an existing webhook that you created using the Create Webhook API. You can modify details such as the webhook URL, description, credentials, list of subscribed events, or choose to enable or disable the webhook.

EnvironmentHttp MethodAPI
SandboxPUThttps://api-preprod.phonepe.com/apis/pg-sandbox/configs/v1/webhooks/{webhookId}
ProductionPUThttps://api.phonepe.com/apis/pg/configs/v1/webhooks/{webhookId}
Request Headers
Header NameHeader ValueDescription
Content-Typeapplication/json
AuthorizationO-Bearer <access_token>Pass access_token received in Authorization call
Request Payload
{
    "url": "https://webhook.site/f9c9b854-72f1-462a-b28e-e3e9e4dee939",
    "description": "Webhook description",
    "username": "username",
    "password": "password456",
    "events": [
        "pg.order.completed",
        "pg.order.failed"
    ],
    "enabled": 
true
}
Field NameData TypeDescription
urlStringThe HTTPS webhook URL to which PhonePe have to post the webhook response.
descriptionStringDescription of the Webhook URL
usernameLongusername length must be between 5 and 20.
It should be alphanumeric only.
passwordStringpassword must be 8-20 characters long.
It should be alphanumeric and contain both letters and numbers.
eventsArraywebhook events for which callback is required.
enabledBooleanFlag to enable or disable the webhook
Response Headers
Header NameHeader Value
Content-Typeapplication/json
Sample Response for case 1: Success Response
{
    "id": "CF2410212252436169514926",
    "url": "https://webhook.site/f9c9b854-72f1-462a-b28e-e3e9e4dee939",
    "description": "Webhook description",
    "username": "username",
    "password": "password123",
    "events": [
        "pg.order.completed",
        "pg.order.failed"
    ],
    "createdAt": 1729531363628,
    "updatedAt": 1729531363632,
    "enabled": true
}
Sample Response for case 2: Failed with Invalid Auth Token
{
    "code": "BAD_REQUEST",
    "message": "Cannot make more than 30 webhooks"
}
Sample Response for case 3: Failed with Invalid Auth Token
{
    "code": "AUTHORIZATION_FAILED",
    "message": "Authorization failed [message = Please check the authorization token and try again]"
}
Sample Response case 4: Internal Server Error
{
    "code": "INTERNAL_SERVER_ERROR",
    "message": "There is an error trying to process your transaction at the moment. Please try again in a while."
}
Field NameData TypeDescription
idStringUnique identifier of the webhook. This ID can be used to update or delete the webhook.
urlStringThe secure HTTPS endpoint where PhonePe will send webhook event notifications.
descriptionStringA brief description to identify the purpose or context of the webhook URL.
usernameLongUsername must be 5 to 20 characters long and alphanumeric.
passwordStringPassword must be 8 to 20 characters long, alphanumeric, and include both letters and numbers.
eventsArrayList of webhook events for which you want to receive callbacks.
createdAtLongEpoch timestamp indicating when the webhook was created.
updatedAtLongEpoch timestamp indicating the last time the webhook was updated.
enabledBooleanFlag to indicate whether the webhook is currently active or not.
Is this article helpful?