How to chain annotation projects with webhooks on Kili

Kili Tutorial: How to chain annotation projects with webhooks on Kili

In this tutorial, we will show how to use webhooks to monitor actions in Kili, such as a label creation. The goal of this tutorial is to illustrate some basic components and concepts of Kili in a simple way, but also to dive into the actual process of iteratively developing real applications in Kili.


For an overview of Kili, visit You can also check out the Kili documentation Our goal is to export labels that can predict whether an image contains a Porsche or a Tesla.

The tutorial is divided into two parts:

  1. Why use webhooks?
  2. Using Kili’s webhook in Python

1. Why use webhooks?

Webhooks allow to react to particular action in Kili’s database by triggering a callback whenever an action is completed. For instance, here, every time a label is created in frontend (upper panel), the label can be logged in Python (lower right panel):

from IPython.display import Image
with open('','rb') as f:
display(Image(, format='png'))


2. Using Kili’s webhook in Python

Kili Playground exposes a method label_created_or_updated that allows to listen for all actions on labels:

  • creation of a new label
  • update of an existing label

First of all, you need to authenticate:

import os

!pip install kili
from kili.authentication import KiliAuth
from kili.playground import Playground

email = os.getenv('KILI_EMAIL')
password = os.getenv('KILI_PASSWORD')
api_endpoint = ''

kauth = KiliAuth(email, password, api_endpoint)
playground = Playground(kauth)

Then you can define a callback that will be triggered each time a label gets created/updated:


def callback(id, data):
print(f'New data: {data}\n')

project_id=project_id, callback=callback)


In this tutorial, we accomplished the following:

We introduced the concept of webhook and we used label_created_or_updated to trigger a webhook.

You can also visit the Kili website or Kili documentation for more info!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.