---
title: "PUT /api/v1/document/document-fields/{uid}/"
method: PUT
path: "/api/v1/document/document-fields/{uid}/"
tags: ["document", "v1"]
---

# PUT /api/v1/document/document-fields/{uid}/

`PUT /api/v1/document/document-fields/{uid}/`

Update Document Field

## Path parameters

- `uid` string, required

## Request body

- DocumentFieldCreate
  - `document_type` string, required
  - `code` string, required — Field codes must be lowercase, should start with a Latin letter, and contain only Latin letters, digits, underscores. Field codes must be unique to every Document Type.
  - `long_code` string
  - `title` string, required
  - `description` string, nullable
  - `type` 'address' | 'choice' | 'company' | 'date' | 'date_recurring' | 'datetime' | 'duration' | 'float' | 'geography' | 'int' | 'linked_documents' | 'money' | 'multi_choice' | 'percent' | 'person' | 'ratio' | 'related_info' | 'string' | 'string_no_word_wrap' | 'text', required
  - `text_unit_type` 'sentence' | 'paragraph' | 'section'
  - `value_detection_strategy` 'disabled' | 'use_regexps_only' | 'use_formula_only' | 'regexp_table' | 'text_based_ml_only' | 'mlflow_model'
  - `classifier_init_script` string, nullable — Classifier initialization script. Here is how it used: <br /><br />def&nbsp;init_classifier_impl(field_code:&nbsp;str,&nbsp;init_script:&nbsp;str):<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;init_script&nbsp;is&nbsp;not&nbsp;None:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;init_script&nbsp;=&nbsp;init_script.strip()<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;not&nbsp;init_script:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;tree&nbsp;as&nbsp;sklearn_tree<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;sklearn_tree.DecisionTreeClassifier()<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;tree&nbsp;as&nbsp;sklearn_tree<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;neural_network&nbsp;as&nbsp;sklearn_neural_network<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;neighbors&nbsp;as&nbsp;sklearn_neighbors<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;svm&nbsp;as&nbsp;sklearn_svm<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;gaussian_process&nbsp;as&nbsp;sklearn_gaussian_process<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn.gaussian_process&nbsp;import&nbsp;kernels&nbsp;as&nbsp;sklearn_gaussian_process_kernels<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;ensemble&nbsp;as&nbsp;sklearn_ensemble<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;naive_bayes&nbsp;as&nbsp;sklearn_naive_bayes<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;discriminant_analysis&nbsp;as&nbsp;sklearn_discriminant_analysis<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;linear_model&nbsp;as&nbsp;sklearn_linear_model<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;eval_locals&nbsp;=&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_linear_model':&nbsp;sklearn_linear_model,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_tree':&nbsp;sklearn_tree,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_neural_network':&nbsp;sklearn_neural_network,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_neighbors':&nbsp;sklearn_neighbors,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_svm':&nbsp;sklearn_svm,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_gaussian_process':&nbsp;sklearn_gaussian_process,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_gaussian_process_kernels':&nbsp;sklearn_gaussian_process_kernels,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_ensemble':&nbsp;sklearn_ensemble,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_naive_bayes':&nbsp;sklearn_naive_bayes,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_discriminant_analysis':&nbsp;sklearn_discriminant_analysis<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;eval_script('classifier&nbsp;init&nbsp;script&nbsp;of&nbsp;field&nbsp;{0}'.format(field_code),&nbsp;init_script,&nbsp;eval_locals)<br />
  - `formula` string, nullable
  - `convert_decimals_to_floats_in_formula_args` boolean — Floating point field values are represented in Python Decimal type to avoid rounding problems in machine numbers representations. Use this checkbox for converting them to Python float type before calculating the formula. Float: 0.1 + 0.2 = 0.30000000000000004. Decimal: 0.1 + 0.2 = 0.3.
  - `value_regexp` string, nullable — This regular expression is run on the sentence found by a Field Detector and extracts a specific string value from a Text Unit. If the regular expression returns multiple matching groups, then the first matching group will be used by the Field. This is only applicable to String Fields.
  - `depends_on_fields` string[]
  - `confidence` 'High' | 'Medium' | 'Low', nullable
  - `requires_text_annotations` boolean
  - `read_only` boolean
  - `category` integer, nullable
  - `family` integer, nullable
  - `default_value` object, nullable — If populated, the Default Value will be displayed for this Field if no other value is found by the chosen Value Detection Strategy. Leave this form blank to have the Field Value remain empty by default. Please wrap entries with quotes, example: “landlord”. This is only applicable to Choice and Multi Choice Fields.
  - `choices` string, nullable — Newline-separated choices. A choice cannot contain a comma.
  - `allow_values_not_specified_in_choices` boolean
  - `metadata` object, nullable
  - `training_finished` boolean
  - `dirty` boolean
  - `order` integer
  - `trained_after_documents_number` integer
  - `hidden_always` boolean
  - `hide_until_python` string, nullable — Enter a boolean expression in Python syntax. If this Python expression evaluates to True, then this Document Field will be displayed in the user interface. Likewise, if this Python expression evaluates to False, then this Document Field will be hidden from view. Importantly, if a document’s status is set to complete and this Document Field remains hidden, then this Document Field’s data will be erased. Similarly, this Document Field might contain data that a user can not review if it is hidden and the document has not been set to complete.
  - `hide_until_js` string, nullable — Target expression ("Hide until python" expression converted to JavaScript syntax for frontend). Allowed operators: +, -, *, /, ===, !==, ==, !=, &&, ||, >, <, >=, <=, %
  - `display_yes_no` boolean — Checking this box will display “Yes” if Related Info text is found, and display “No” if no text is found.
  - `vectorizer_stop_words` string, nullable — Stop words for vectorizers user in field-based ML field detection. These stop words are excluded from going into the feature vector part build based on this field. In addition to these words the standard sklearn "english" word list is used. Format: each word on new line
  - `unsure_choice_value` string, nullable — Makes sense for machine learning strategies with "Unsure" category. The strategy will return this value if probabilities of all other categories appear lower than the specified threshold.
  - `unsure_thresholds_by_value` object, nullable — Makes sense for machine learning strategies with "Unsure" category. The strategy will return concrete result (one of choice values) only if the probability of the detected value is greater than this threshold. Otherwise the strategy returns None or the choice value specified in "Unsure choice value" field. Format: { "value1": 0.9, "value2": 0.5, ...}. Default: 0.9
  - `mlflow_model_uri` string, nullable — MLFlow model URI understandable by the MLFlow artifact downloading routines.
  - `mlflow_detect_on_document_level` boolean — If true - whole document text will be sent to the MLFlow model and the field value will be returned for the whole text with no annotations. If false - each text unit will be sent separately.
  - `warning_message` string

## Response `200`

- DocumentFieldCreate
  - `document_type` string, required
  - `code` string, required — Field codes must be lowercase, should start with a Latin letter, and contain only Latin letters, digits, underscores. Field codes must be unique to every Document Type.
  - `long_code` string
  - `title` string, required
  - `description` string, nullable
  - `type` 'address' | 'choice' | 'company' | 'date' | 'date_recurring' | 'datetime' | 'duration' | 'float' | 'geography' | 'int' | 'linked_documents' | 'money' | 'multi_choice' | 'percent' | 'person' | 'ratio' | 'related_info' | 'string' | 'string_no_word_wrap' | 'text', required
  - `text_unit_type` 'sentence' | 'paragraph' | 'section'
  - `value_detection_strategy` 'disabled' | 'use_regexps_only' | 'use_formula_only' | 'regexp_table' | 'text_based_ml_only' | 'mlflow_model'
  - `classifier_init_script` string, nullable — Classifier initialization script. Here is how it used: <br /><br />def&nbsp;init_classifier_impl(field_code:&nbsp;str,&nbsp;init_script:&nbsp;str):<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;init_script&nbsp;is&nbsp;not&nbsp;None:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;init_script&nbsp;=&nbsp;init_script.strip()<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;not&nbsp;init_script:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;tree&nbsp;as&nbsp;sklearn_tree<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;sklearn_tree.DecisionTreeClassifier()<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;tree&nbsp;as&nbsp;sklearn_tree<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;neural_network&nbsp;as&nbsp;sklearn_neural_network<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;neighbors&nbsp;as&nbsp;sklearn_neighbors<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;svm&nbsp;as&nbsp;sklearn_svm<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;gaussian_process&nbsp;as&nbsp;sklearn_gaussian_process<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn.gaussian_process&nbsp;import&nbsp;kernels&nbsp;as&nbsp;sklearn_gaussian_process_kernels<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;ensemble&nbsp;as&nbsp;sklearn_ensemble<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;naive_bayes&nbsp;as&nbsp;sklearn_naive_bayes<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;discriminant_analysis&nbsp;as&nbsp;sklearn_discriminant_analysis<br />&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;sklearn&nbsp;import&nbsp;linear_model&nbsp;as&nbsp;sklearn_linear_model<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;eval_locals&nbsp;=&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_linear_model':&nbsp;sklearn_linear_model,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_tree':&nbsp;sklearn_tree,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_neural_network':&nbsp;sklearn_neural_network,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_neighbors':&nbsp;sklearn_neighbors,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_svm':&nbsp;sklearn_svm,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_gaussian_process':&nbsp;sklearn_gaussian_process,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_gaussian_process_kernels':&nbsp;sklearn_gaussian_process_kernels,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_ensemble':&nbsp;sklearn_ensemble,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_naive_bayes':&nbsp;sklearn_naive_bayes,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sklearn_discriminant_analysis':&nbsp;sklearn_discriminant_analysis<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;eval_script('classifier&nbsp;init&nbsp;script&nbsp;of&nbsp;field&nbsp;{0}'.format(field_code),&nbsp;init_script,&nbsp;eval_locals)<br />
  - `formula` string, nullable
  - `convert_decimals_to_floats_in_formula_args` boolean — Floating point field values are represented in Python Decimal type to avoid rounding problems in machine numbers representations. Use this checkbox for converting them to Python float type before calculating the formula. Float: 0.1 + 0.2 = 0.30000000000000004. Decimal: 0.1 + 0.2 = 0.3.
  - `value_regexp` string, nullable — This regular expression is run on the sentence found by a Field Detector and extracts a specific string value from a Text Unit. If the regular expression returns multiple matching groups, then the first matching group will be used by the Field. This is only applicable to String Fields.
  - `depends_on_fields` string[]
  - `confidence` 'High' | 'Medium' | 'Low', nullable
  - `requires_text_annotations` boolean
  - `read_only` boolean
  - `category` integer, nullable
  - `family` integer, nullable
  - `default_value` object, nullable — If populated, the Default Value will be displayed for this Field if no other value is found by the chosen Value Detection Strategy. Leave this form blank to have the Field Value remain empty by default. Please wrap entries with quotes, example: “landlord”. This is only applicable to Choice and Multi Choice Fields.
  - `choices` string, nullable — Newline-separated choices. A choice cannot contain a comma.
  - `allow_values_not_specified_in_choices` boolean
  - `metadata` object, nullable
  - `training_finished` boolean
  - `dirty` boolean
  - `order` integer
  - `trained_after_documents_number` integer
  - `hidden_always` boolean
  - `hide_until_python` string, nullable — Enter a boolean expression in Python syntax. If this Python expression evaluates to True, then this Document Field will be displayed in the user interface. Likewise, if this Python expression evaluates to False, then this Document Field will be hidden from view. Importantly, if a document’s status is set to complete and this Document Field remains hidden, then this Document Field’s data will be erased. Similarly, this Document Field might contain data that a user can not review if it is hidden and the document has not been set to complete.
  - `hide_until_js` string, nullable — Target expression ("Hide until python" expression converted to JavaScript syntax for frontend). Allowed operators: +, -, *, /, ===, !==, ==, !=, &&, ||, >, <, >=, <=, %
  - `display_yes_no` boolean — Checking this box will display “Yes” if Related Info text is found, and display “No” if no text is found.
  - `vectorizer_stop_words` string, nullable — Stop words for vectorizers user in field-based ML field detection. These stop words are excluded from going into the feature vector part build based on this field. In addition to these words the standard sklearn "english" word list is used. Format: each word on new line
  - `unsure_choice_value` string, nullable — Makes sense for machine learning strategies with "Unsure" category. The strategy will return this value if probabilities of all other categories appear lower than the specified threshold.
  - `unsure_thresholds_by_value` object, nullable — Makes sense for machine learning strategies with "Unsure" category. The strategy will return concrete result (one of choice values) only if the probability of the detected value is greater than this threshold. Otherwise the strategy returns None or the choice value specified in "Unsure choice value" field. Format: { "value1": 0.9, "value2": 0.5, ...}. Default: 0.9
  - `mlflow_model_uri` string, nullable — MLFlow model URI understandable by the MLFlow artifact downloading routines.
  - `mlflow_detect_on_document_level` boolean — If true - whole document text will be sent to the MLFlow model and the field value will be returned for the whole text with no annotations. If false - each text unit will be sent separately.
  - `warning_message` string

---

[API](https://skmtc.net/lexpredict/apis/contraxsuite-api.md) · [All operations](https://skmtc.net/lexpredict/apis/contraxsuite-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lexpredict/contraxsuite-api/versions/3429f921b4cb/schema)
