# Tag an exception

> API reference for tagging stream exceptions in a Communications Mining dataset using the streams exceptions endpoint in Automation Cloud.

![docs image](https://dev-assets.cms.uipath.com/assets/images/ixp/ixp-docs-image-321851-59c39cfd.webp) `/api/v1/datasets/<project>/<dataset_name>/streams/<stream_name>/exceptions`

Permissions required: **Consume streams, View sources**.

* Bash
  ```bash
  curl -X PUT 'https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions' \
      -H "Authorization: Bearer $REINFER_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
    "exceptions": [
      {
        "metadata": {
          "type": "No Prediction"
        },
        "uid": "18ba5ce699f8da1f.abcdef0123456789"
      },
      {
        "metadata": {
          "type": "Wrong Prediction"
        },
        "uid": "18ba5ce699f8da1f.0123456789abcdef"
      }
    ]
  }'
  ```
* Node
  ```javascript
  const request = require("request");

  request.put(
    {
      url: "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions",
      headers: {
        Authorization: "Bearer " + process.env.REINFER_TOKEN,
      },
      json: true,
      body: {
        exceptions: [
          {
            metadata: { type: "No Prediction" },
            uid: "18ba5ce699f8da1f.abcdef0123456789",
          },
          {
            metadata: { type: "Wrong Prediction" },
            uid: "18ba5ce699f8da1f.0123456789abcdef",
          },
        ],
      },
    },
    function (error, response, json) {
      // digest response
      console.log(JSON.stringify(json, null, 2));
    }
  );
  ```
* Python
  ```python

  response = requests.put(
      "https://<my_api_endpoint>/api/v1/datasets/project1/collateral/streams/dispute/exceptions",
      headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
      json={
          "exceptions": [
              {
                  "uid": "18ba5ce699f8da1f.abcdef0123456789",
                  "metadata": {"type": "No Prediction"},
              },
              {
                  "uid": "18ba5ce699f8da1f.0123456789abcdef",
                  "metadata": {"type": "Wrong Prediction"},
              },
          ]
      },
  )

  print(json.dumps(response.json(), indent=2, sort_keys=True))
  ```
* Response
  ```json
  {
    "status": "ok"
  }
  ```

This endpoint allows you to tag comments as exceptions in the platform, so that a model trainer can review and label them in order to improve the model. We recommend to tag the comments for which the model returned no predictions, and comments for which the model returned wrong predictions.

| NAME | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `exceptions` | `array<Exception>` | yes | A list of exceptions. |

Where `Exception` has the following format:

| NAME | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `uid` | string | yes | The `uid` of the comment that should be tagged as exception. |
| `metadata` | Metadata | yes | An object containing exception metadata. |

Where `Metadata` has the following format:

| NAME | TYPE | REQUIRED | DESCRIPTION |
| --- | --- | --- | --- |
| `type` | string | yes | The exception type will be available as a filter property in the Communications Mining™ UI. The value can be an arbitrary string. Please choose a short, easy-to-understand string such as "No Prediction" and "Wrong Prediction". |
