Events

Each event corresponds with a certain action that can happen in CKBox in a certain environment. Also, each event has a specific payload format with the relevant event information.

Before you use Webhooks, please get familiar with the basic principles of the feature. You can read more about using Webhooks in the Overview guide.

# Assets

You can trigger the following events for assets in CKBox.

# Asset uploaded

Name: asset.uploaded
Description: Triggered whenever the file is uploaded to a category or a folder.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • asset – The details of the uploaded asset.
  • user – The details of a user performing this action.

# Example

The following example presents a webhook request sent after a user uploads a file.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'asset.uploaded',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        asset: {
            id: '-1zT3SPzjuEv',
            name: 'Cupcake',
            extension: 'jpeg',
            url: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/file',
            images_urls: {
                '192': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/192.webp',
                '384': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/384.webp',
                '576': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/576.webp',
                '768': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/768.webp',
                '960': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/960.webp',
                '1152': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1152.webp',
                '1344': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1344.webp',
                '1536': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1536.webp',
                '1728': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1728.webp',
                '1920': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1920.webp',
                default: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1920.jpeg'
            },
            mime_type: 'image/jpeg',
            category_id: '1f0ca0db-d0fa-4b03-9703-9f152615ed0c',
            size_in_bytes: 523625,
            tags: [],
            metadata: { 
                description: 'An image of a cupcake', 
                custom_attributes: {}
            }
        },
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:03:18.815Z'
}

# Asset modified

Name: asset.modified
Description: Triggered when the asset is modified.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • asset – The details of the modified asset.
  • asset_before_modification – A snapshot of the asset before modification.
  • user – The details of a user performing this action.

# Example

The following example presents a webhook request sent after a user modifies an asset.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'asset.modified',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        asset: {
            id: '-1zT3SPzjuEv',
            name: 'Cupcake',
            extension: 'jpeg',
            url: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/file',
            images_urls: {
                '192': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/192.webp',
                '384': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/384.webp',
                '576': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/576.webp',
                '768': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/768.webp',
                '960': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/960.webp',
                '1152': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1152.webp',
                '1344': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1344.webp',
                '1536': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1536.webp',
                '1728': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1728.webp',
                '1920': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1920.webp',
                default: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1920.jpeg'
            },
            mime_type: 'image/jpeg',
            category_id: '1f0ca0db-d0fa-4b03-9703-9f152615ed0c',
            size_in_bytes: 523625,
            tags: [ 'foo' ],
            metadata: { 
                description: 'Updated description!', 
                custom_attributes: {}
            }
        },
        asset_before_modification: {
            id: '-1zT3SPzjuEv',
            name: 'Cupcake',
            extension: 'jpeg',
            url: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/file',
            images_urls: {
                '192': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/192.webp',
                '384': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/384.webp',
                '576': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/576.webp',
                '768': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/768.webp',
                '960': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/960.webp',
                '1152': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1152.webp',
                '1344': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1344.webp',
                '1536': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1536.webp',
                '1728': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1728.webp',
                '1920': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1920.webp',
                default: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1920.jpeg'
            },
            mime_type: 'image/jpeg',
            category_id: '1f0ca0db-d0fa-4b03-9703-9f152615ed0c',
            size_in_bytes: 523625,
            tags: [],
            metadata: { 
                description: 'An image of a cupcake', 
                custom_attributes: {}
            }
        },
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:07:34.497Z'
}

# Asset removed

Name: asset.removed
Description: Triggered when the asset is removed.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • asset – The details of the removed asset.
  • user – The details of a user performing this action.

# Example

The following example presents a webhook request sent after a user removes an asset.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'asset.removed',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        asset: {
            id: '-1zT3SPzjuEv',
            name: 'Cupcake',
            extension: 'jpeg',
            url: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/file',
            images_urls: {
                '192': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/192.webp',
                '384': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/384.webp',
                '576': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/576.webp',
                '768': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/768.webp',
                '960': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/960.webp',
                '1152': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1152.webp',
                '1344': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1344.webp',
                '1536': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1536.webp',
                '1728': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1728.webp',
                '1920': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1920.webp',
                default: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/-1zT3SPzjuEv/images/1920.jpeg'
            },
            mime_type: 'image/jpeg',
            category_id: '1f0ca0db-d0fa-4b03-9703-9f152615ed0c',
            size_in_bytes: 523625,
            tags: [ 'foo' ],
            metadata: { 
                description: 'An image of a cupcake', 
                custom_attributes: {}
            }
        },
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:09:52.989Z'
}

# Asset copied

Name: asset.copied
Description: Triggered when the asset is copied.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • asset – The details of the removed asset.
  • source_asset – The details of the source asset.
  • user – The details of a user performing this action.

# Example

The following example presents a webhook request sent after a user copies an asset.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'asset.copied',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        asset: {
            id: 'ZXs11paEIP72',
            name: 'Cupcake',
            extension: 'jpeg',
            url: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/file',
            images_urls: {
                '192': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/192.webp',
                '384': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/384.webp',
                '576': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/576.webp',
                '768': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/768.webp',
                '960': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/960.webp',
                '1152': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/1152.webp',
                '1344': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/1344.webp',
                '1536': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/1536.webp',
                '1728': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/1728.webp',
                '1920': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/1920.webp',
                default: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/ZXs11paEIP72/images/1920.jpeg'
            },
            mime_type: 'image/jpeg',
            category_id: '1f0ca0db-d0fa-4b03-9703-9f152615ed0c',
            folder_id: 'W_g4u6ZEHxuO',
            size_in_bytes: 523625,
            tags: [],
            metadata: { 
                description: 'An image of a cupcake', 
                custom_attributes: {}
            }
        },
        source_asset: {
            id: '_DpyO7eRxHtT',
            name: 'Cupcake',
            extension: 'jpeg',
            url: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/file',
            images_urls: {
                '192': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/192.webp',
                '384': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/384.webp',
                '576': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/576.webp',
                '768': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/768.webp',
                '960': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/960.webp',
                '1152': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1152.webp',
                '1344': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1344.webp',
                '1536': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1536.webp',
                '1728': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1728.webp',
                '1920': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1920.webp',
                default: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1920.jpeg'
            },
            mime_type: 'image/jpeg',
            category_id: '1f0ca0db-d0fa-4b03-9703-9f152615ed0c',
            size_in_bytes: 523625,
            tags: [],
            metadata: { 
                description: 'An image of a cupcake', 
                custom_attributes: {}
            }
        },
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:29:11.602Z'
}

# Asset overwritten

Name: asset.overwritten
Description: Triggered when the asset’s content is overwritten.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • asset – The details of the overwritten asset.
  • user – The details of a user performing this action.

# Example

The following example presents a webhook request sent after a user overwrites an asset.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'asset.overwritten',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        asset: {
            id: '_DpyO7eRxHtT',
            name: 'Cupcake',
            extension: 'jpeg',
            url: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/file',
            images_urls: {
                '192': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/192.webp',
                '384': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/384.webp',
                '576': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/576.webp',
                '768': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/768.webp',
                '960': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/960.webp',
                '1152': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1152.webp',
                '1344': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1344.webp',
                '1536': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1536.webp',
                '1728': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1728.webp',
                '1920': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1920.webp',
                default: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1920.jpeg'
            },
            mime_type: 'image/jpeg',
            category_id: '1f0ca0db-d0fa-4b03-9703-9f152615ed0c',
            size_in_bytes: 203024,
            tags: [],
            metadata: { 
                description: 'An image of a cupcake', 
                custom_attributes: {}
            }
        },
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:32:22.689Z'
}

# Asset cache invalidated

Name: asset.cache.invalidated
Description: Triggered when the asset’s cache should be invalidated.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • asset – The details of the overwritten asset.
  • user – The details of a user performing this action.
  • paths_to_be_invalidated – A list of URL paths that should be invalidated.

# Example

The following example presents a webhook request sent after an asset’s content changes and CDN paths should be invalidated.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'asset.overwritten',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        asset: {
            id: '_DpyO7eRxHtT',
            name: 'Cupcake',
            extension: 'jpeg',
            url: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/file',
            images_urls: {
                '192': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/192.webp',
                '384': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/384.webp',
                '576': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/576.webp',
                '768': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/768.webp',
                '960': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/960.webp',
                '1152': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1152.webp',
                '1344': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1344.webp',
                '1536': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1536.webp',
                '1728': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1728.webp',
                '1920': 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1920.webp',
                default: 'https://ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/1920.jpeg'
            },
            mime_type: 'image/jpeg',
            category_id: '1f0ca0db-d0fa-4b03-9703-9f152615ed0c',
            size_in_bytes: 203024,
            tags: [],
            metadata: { 
                description: 'An image of a cupcake', 
                custom_attributes: {}
            }
        },
        paths_to_be_invalidated: ['https://cdn.ckbox.dev/6afdca1ba1e38969dea1/assets/_DpyO7eRxHtT/images/192.webp']
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:32:22.689Z'
}

# Folders

The following events can be triggered for folders in CKBox.

# Folder created

Name: folder.created
Description: Triggered when a folder is created.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • folder – The details of the created folder.
  • user – The details of a user performing this action

# Example

The following example presents a webhook request sent after a user creates a folder.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'folder.created',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        folder: {
            id: 'hr8zl8N_8-un',
            name: 'Folder',
            category_id: '957165c8-bb91-4792-922d-72c572b5b12d'
        },
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:41:37.953Z'
}

# Folder modified

Name: folder.modified
Description: Triggered when the folder is modified.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • folder – The details of the modified folder.
  • user – The details of a user performing this action

# Example

The following example presents a webhook request sent after a user modifies the folder.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'folder.modified',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        folder: {
            id: 'hr8zl8N_8-un',
            name: 'Images',
            category_id: '957165c8-bb91-4792-922d-72c572b5b12d'
        },
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:42:42.351Z'
}

# Folder removed

Name: folder.removed
Description: Triggered when the folder is removed.

# Payload

  • workspace_id – The identifier of the workspace for which the action was initialized.
  • folder – The details of the removed folder.
  • user – The details of a user performing this action

# Example

The following example presents a webhook request sent after a user removes the folder.

{
    environment_id: '6afdca1ba1e38969dea1',
    event: 'folder.removed',
    payload: {
        workspace_id: '80e839331c4d8827c474',
        folder: {
            id: 'hr8zl8N_8-un',
            name: 'Images',
            category_id: '957165c8-bb91-4792-922d-72c572b5b12d'
        },
        user: { id: 'user-1', role: 'User' }
    },
    sent_at: '2024-02-18T18:43:30.861Z'
}

# Next steps