Sample - Box Platform API
POST/webhooks

Create a webhook

Creates a webhook that notifies a configured address about events affecting a file or folder. Supply target, triggers, and address; target.type must identify either a file or folder, and each trigger must be a supported event name. A 201 response returns the configured webhook object.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 body fields

Webhook configuration containing the target item, notification address, and events that trigger notifications.

targetobjectrequired
The item that will trigger the webhook.
addressstringrequired
The URL that is notified by this webhook.
triggersarray<WebhookTrigger>required
An array of event names that this webhook is to be triggered for.

6 status codes
201Returns the newly created webhook object, including its target, creator, creation time, notification address, and configured triggers.
idstringoptional
The unique identifier for this webhook.
typestringoptional
The value will always be `webhook`.
Allowed:webhook
targetobjectoptional
The item that will trigger the webhook.
created_byobjectoptional
created_atstringoptional
A timestamp identifying the time that the webhook was created.
addressstringoptional
The URL that is notified by this webhook.
triggersarray<WebhookTrigger>optional
An array of event names that this webhook is to be triggered for.
400Returned when the request parameters are incorrect.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
403Returned when the application does not have permission to manage webhooks.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
404Returned when the target item cannot be found.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
409Returned when a webhook already exists for the same target, application, and user.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
defaultReturns a generic error object for an unexpected client error.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.

Error handling

A 400 is returned when the request parameters are incorrect. A 403 is returned when the application lacks permission to manage webhooks, and a 404 is returned when the target item cannot be found. A 409 is returned when a webhook already exists for the same target, application, and user; provide a valid target, supported triggers, and notification address.