# 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](/sdk/sdk-documentation.md#project-ids) or retrieve it using the [`list_projects`](/sdk/sdk-documentation/project-level-sdk-functions/list_projects.md) 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.

<details open>

<summary><strong>How to verify in Ango Hub?</strong></summary>

After successfully executing the `update_label_validation` function, you can validate the changes directly in Ango Hub.

Navigate to: **Projects → \[Your Project] → Settings → Label Validation**

* Confirm that the label validation code and its configurations have been updated correctly.

{% hint style="info" %}
Changes made via the SDK are reflected in Ango Hub in near real-time. If updates are not immediately visible, please refresh the page.
{% endhint %}

</details>

### 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" %}

```bash
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](/sdk/sdk-documentation/project-level-sdk-functions/get_project.md), [Label Validation](/core-concepts/label-validation.md)
{% endhint %}


---

# 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.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/update_label_validation.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.
