# update\_label\_validation

`imerit_ango.sdk.SDK.`

## update\_label\_validation(project\_id, custom\_validation\_enabled, validation\_function, external\_validation)

Updates the label validation settings of your project.

### Parameters

* **project\_id:** string
  * The unique identifier for the project. You can find the project ID in [the user interface](https://docs.imerit.net/sdk/sdk-documentation/..#project-ids) or retrieve it using the [`list_projects`](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/list_projects) function.
* **custom\_validation\_enabled:** bool, *Optional, default None*
  * Enables or disables custom label validation logic for the project.
* **validation\_function:** string, *Optional, default None*
  * A Javascript source code string that defines the custom label validation logic executed by the platform.
* **external\_validation:** dict, *Optional, default None*
  * Configuration for delegating validation to an external system or service.
  * Available only for PCT projects.

```python
external_validation = {
    "enabled": True,            # bool: Enable/disable external validation
    "apiUrl": "https://...",    # str:  Validation API endpoint URL
    "singleFrame": False,       # bool: Validate only a single frame
    "specificFrame": False,     # bool: Validate a specific frame (or set of frames)
    "frameNumbers": 5           # int:  Number of frames to validate
}
```

Returns:

* **output:** dict
  * A dictionary containing the result of the operation.
  * Including a `status` field indicating whether the request was successful and a `data` field containing the response payload with updated resources produced by the operation.

### Example

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

javascript_code = """function (answers) {
  let errors = [];
  const points = answers.objects.filter((obj) => obj.tool === "point" && obj["point"][0] < 100);
  points.map((b) => {
    errors.push(
      {
        objectId: b.objectId,
        message: "Point X under 100.",
        preventSubmission: false
      }
    );
  })
  return errors;
}"""

ango_sdk.update_label_validation(
    project_id=project_id,
    custom_validation_enabled=True,
    validation_function=javascript_code
)
```

{% endtab %}

{% tab title="curl" %}

```python
curl -X POST "https://imeritapi.ango.ai/v2/project/$PROJECT_ID/labelValidation" \
  -H "Content-Type: application/json" \
  -H "apikey: $ANGO_API_KEY" \
  -d '{
    "customValidationEnabled": true,
    "validationFunction": "function (answers) {\n  let errors = [];\n\n  const points = answers.objects.filter((obj) => \n    obj.tool === \"point\" && obj[\"point\"][0] < 100\n  );\n\n  points.forEach((b) => {\n    errors.push({\n      objectId: b.objectId,\n      message: \"Point X under 100.\",\n      preventSubmission: false\n    });\n  });\n\n  return errors;\n}"
  }'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**See also**

[get\_project](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_project), [Label Validation](https://docs.imerit.net/core-concepts/label-validation)
{% endhint %}
