Box Developer Documentation
Latest version

Update webhook

put
https://api.box.com/2.0
/webhooks/:webhook_id

This endpoint is in the version 2024.0. No changes are required to continue using it. For more details, see Box API versioning.

Updates a webhook.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
3321123

The ID of the webhook.

Request Body

stringin bodyoptional
"https://example.com/webhooks"

The URL that is notified by this webhook.

objectin body

The item that will trigger the webhook.

stringin bodyoptional
"1231232"

The ID of the item to trigger a webhook.

stringin bodyoptional
"file"

The type of item to trigger a webhook.

Value is one of file,folder

string arrayin bodyoptional
["FILE.UPLOADED"]

An array of event names that this webhook is to be triggered for.

Response

application/jsonWebhook

Returns the new webhook object.

application/jsonClient error

Returns an error if the parameters were incorrect.

application/jsonClient error

Returns an error if the application does not have the permission to manage webhooks.

application/jsonClient error

Returns an error if the target item or webhook could not be found.

application/jsonClient error

Returns an error if the a webhook for this combination of target, application, and user already exists.

application/jsonClient error

An unexpected client error.

put
Update webhook
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

Learn more about Box SDK versionig strategy.


cURL
curl -i -X PUT "https://api.box.com/2.0/webhooks/3321123" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "triggers": [
         "FILE.DOWNLOADED"
       ]
     }'
Node/TypeScript v10
await client.webhooks.updateWebhookById(webhook.id!, {
  requestBody: {
    address: 'https://example.com/updated-webhook',
  } satisfies UpdateWebhookByIdRequestBody,
} satisfies UpdateWebhookByIdOptionalsInput);
Python v10
client.webhooks.update_webhook_by_id(
    webhook.id, address="https://example.com/updated-webhook"
)
.NET v10
await client.Webhooks.UpdateWebhookByIdAsync(webhookId: NullableUtils.Unwrap(webhook.Id), requestBody: new UpdateWebhookByIdRequestBody() { Address = "https://example.com/updated-webhook" });
Swift v10
try await client.webhooks.updateWebhookById(webhookId: webhook.id!, requestBody: UpdateWebhookByIdRequestBody(address: "https://example.com/updated-webhook"))
Java v10
client.getWebhooks().updateWebhookById(webhook.getId(), new UpdateWebhookByIdRequestBody.Builder().address("https://example.com/updated-webhook").build())
Java v4
BoxWebHook webhook = new BoxWebHook(api, id);
BoxWebHook.Info info = webhook.new Info();
info.setAddress(url);
webhook.update(info);
Python v3
update_object = {
    'triggers': ['FILE.COPIED'],
    'address': 'https://newexample.com',
}
webhook = client.webhook(webhook_id='12345').update_info(data=update_object)
print(f'Updated the webhook info for triggers: {webhook.triggers} and address: {webhook.address}')
.NET v5
var updates = new BoxWebhookRequest()
{
    Id = "12345",
    Address = "https://example.com/webhooks/fileActions
};
BoxWebhook updatedWebhook = await client.WebhooksManager.UpdateWebhookAsync(updates);
Node v3
client.webhooks.update('678901', {address: "https://example.com/webhooks/fileActions"})
	.then(webhook => {
		/* webhook -> {
			id: '1234',
			type: 'webhook',
			target: { id: '22222', type: 'folder' },
			created_by: 
			{ type: 'user',
				id: '33333',
				name: 'Example User',
				login: 'user@example.com' },
			created_at: '2016-05-09T17:41:27-07:00',
			address: 'https://example.com/webhooks/fileActions',
			triggers: [ 'FILE.DOWNLOADED', 'FILE.UPLOADED' ] }
		*/
	});

Response Example

{
  "id": "11446498",
  "type": "webhook",
  "address": "https://example.com/webhooks",
  "created_at": "2012-12-12T10:53:43-08:00",
  "created_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "target": {
    "id": "1231232",
    "type": "file"
  },
  "triggers": [
    "FILE.UPLOADED"
  ]
}