Box Developer Documentation
 
    Latest version

    Create webhook

    post
    https://api.box.com/2.0
    /webhooks

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

    Creates a webhook.

    Request

    bearer [ACCESS_TOKEN]
    application/json

    Request Body

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

    The URL that is notified by this webhook

    objectin body

    The item that will trigger the webhook

    stringin bodyrequired
    "1231232"

    The ID of the item to trigger a webhook

    stringin bodyrequired
    "file"

    The type of item to trigger a webhook

    Value is one of file,folder

    string arrayin bodyrequired
    ["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 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.

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

    Request Example

    cURL
    curl -i -X POST "https://api.box.com/2.0/webhooks" \
         -H "authorization: Bearer <ACCESS_TOKEN>" \
         -H "content-type: application/json" \
         -d '{
           "target": {
             "id": "21322",
             "type": "file"
           },
           "address": "https://example.com/webhooks",
           "triggers": [
             "FILE.PREVIEWED"
           ]
         }'

    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"
      ]
    }