# Events

## Project Created

A `PROJECT_CREATED` event will be sent when a new project is created.

### Example

#### Request Body

All `json` examples have been prettified for documentation purposes.

```json
{
  "eventType": "PROJECT_CREATED",
  "data": {
    "timestamp": "2023-11-17T09:02:45.258Z",
    "project": {
      "id": "N2E4MjNlYTc",
      "name": "hamlet.TXT",
      "tags": [
        "CUSTOM"
      ]
    },
    "team": {
      "id": "1",
      "name": "User's Team Workspace"
    }
  }
}
```

#### Request Header

```json
{
  "accept-encoding": "gzip, compress, deflate, br",
  "accept": "application/json, text/plain, */*",
  "content-length": "200",
  "content-type": "application/json",
  "user-agent": "Datasaur",
  "x-datasaur-signature": "643a34cd1a649b37a6d3611ff7fb561a0255e899ca89a9475c79b38764775033"
}
```

## Before Update Labels

A `BEFORE_UPDATE_LABELS` event will be sent just before the labeler put a new label or update an existing label.

### Example

#### Request Body

```json
{
  "eventType": "BEFORE_UPDATE_LABELS",
  "data": {
    "timestamp": "2023-11-17T09:49:54.108Z",
    "document": {
      "id": "cdf0631f-66b6-4330-be05-4c87fd169afb",
      "originId": "97812272-e8cd-4f92-97e3-e83de1e33db0",
      "name": "hamlet.TXT",
      "fileName": "hamlet.TXT",
      "createdAt": "2023-11-17T09:48:41.000Z",
      "lastSavedAt": "2023-11-17T09:48:41.048Z"
    },
    "isReviewDocument": false,
    "labelUpdateList": {
      "toDeleteList": [],
      "toUpsertList": [
        {
          "documentId": "cdf0631f-66b6-4330-be05-4c87fd169afb",
          "startCellIndex": 0,
          "startCellLine": 0,
          "startTokenIndex": 0,
          "startCharIndex": 0,
          "endCellIndex": 0,
          "endCellLine": 0,
          "endTokenIndex": 0,
          "endCharIndex": 2,
          "counter": 0,
          "layer": 0,
          "labeledBy": "LABELER",
          "type": "SPAN",
          "labelSetItemId": "geo",
          "confidenceScore": null,
          "labeledByUserId": 1
        }
      ]
    },
    "owner": {
      "id": "1",
      "email": "user+1@datasaur.ai",
      "username": "",
      "name": ""
    },
    "team": {
      "id": "1"
    }
  }
}
```

#### Request Header

```json
{
  "accept-encoding": "gzip, compress, deflate, br",
  "accept": "application/json, text/plain, */*",
  "content-length": "808",
  "content-type": "application/json",
  "user-agent": "Datasaur",
  "x-datasaur-signature": "4dd97f9908612bc4d0a7bc7bd0135c72fd5cc51a47e465f274233732e4733271"
}
```

## Project Completed

A `PROJECT_COMPLETED` event will be sent after the labeler marks the project as completed.

### Example

#### Request Body

```json
{
  "eventType": "PROJECT_COMPLETED",
  "data": {
    "timestamp": "2023-11-17T09:52:57.478Z",
    "labeler": {
      "id": "1",
      "email": "user+1@datasaur.ai",
      "username": "",
      "name": ""
    },
    "project": {
      "id": "ZTYzZjRhYjE",
      "name": "hamlet.TXT",
      "tags": [
        "CUSTOM"
      ]
    },
    "team": {
      "id": "1"
    }
  }
}
```

#### Request Header

```json
{
  "accept-encoding": "gzip, compress, deflate, br",
  "accept": "application/json, text/plain, */*",
  "content-length": "243",
  "content-type": "application/json",
  "user-agent": "Datasaur",
  "x-datasaur-signature": "ff872ff9b07652a35ced110de99f190dd159814d04836a5fdb5b73bdf0396db0"
}
```

## Project Reviewed

A `PROJECT_REVIEWED` event will be sent after the reviewer marks the project as completed in Reviewer Mode.

### Example

#### Request Body

```json
{
  "eventType": "PROJECT_REVIEWED",
  "data": {
    "timestamp": "2023-11-17T09:53:23.514Z",
    "reviewer": {
      "id": "1",
      "email": "user+1@datasaur.ai",
      "username": "",
      "name": ""
    },
    "project": {
      "id": "ZTYzZjRhYjE",
      "name": "hamlet.TXT",
      "tags": [
        "CUSTOM"
      ]
    },
    "team": {
      "id": "1"
    }
  }
}
```

#### Request Header

```json
{
  "accept-encoding": "gzip, compress, deflate, br",
  "accept": "application/json, text/plain, */*",
  "content-length": "243",
  "content-type": "application/json",
  "user-agent": "Datasaur",
  "x-datasaur-signature": "f9e52fba3fe2f74467f81dd7b3f0569610ffc4b428ad23939d69621d13af0a68"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datasaur.ai/integrations/webhook-notifications/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
