- Development Integration
- /
- SDK
- /
- Python
- /
Management Module
- /
Custom Field Management
- /
- Create/Update Custom Field Definition
¶ Create/modify custom field definitions
Update time: 2025-07-23 07:34:21
This document is automatically generated based on https://github.com/authing/authing-docs-factory based on the https://api-explorer.genauth.ai V3 API, and is consistent with the API parameters and return results. If this document description is incorrect, please refer to the V3 API.
Create/modify user, department or role custom field definitions. If the passed key does not exist, create it, and if it exists, update it.
¶ Method name
ManagementClient.set_custom_fields
¶ Request parameters
| Name | Type | Required | Default value | Description | Sample value |
|---|---|---|---|---|---|
| list | SetCustomFieldDto[] | Yes | - | Custom field list Array length limit: 50. | |
| tenantId | string | No | - | Tenant ID | 642c1df417c2d8a80d744c1d |
¶ Request Response
Type: CustomFieldListRespDto
| Name | Type | Description |
|---|---|---|
| statusCode | number | Business status code, which can be used to determine whether the operation is successful. 200 means success. |
| message | string | Description |
| apiCode | number | Segmented error code, which can be used to get the specific error type (not returned for successful requests). For a detailed list of error codes, please see: API Code List (opens new window) |
| requestId | string | Request ID. Returned when the request fails. |
| data | array | Response data |
Example results:
{
"statusCode": 200,
"message": "Success",
"requestId": "934108e5-9fbf-4d24-8da1-c330328abd6c",
"data": {
"targetType": "USER",
"createdAt": "2022-03-17T05:23:01.567Z",
"dataType": "ENUM",
"key": "school",
"label": "School",
"description": "School",
"visibleInAdminConsole": true,
"visibleInUserCenter": true,
"i18n": {
"label": {
"zh-CN": {
"enabled": false,
"value": "中文"
},
"en-US": {
"enabled": false,
"value": "English"
},
"zh-TW": {
"enabled": false,
"value": "繁體中文"
}
}
},
"options": "[{\"value\":\"pku\",\"label\":\"xxxx\"}]"
}
}
¶ Data Structure
¶ SetCustomFieldDto
| Name | Type | Is it required? | Description | Sample value |
|---|---|---|---|---|
| targetType | string | Yes | Subject type, currently supports users, roles, groups and departments | USER |
| key | string | Yes | Field key, cannot conflict with the key of built-in fields, cannot be modified after setting. | school |
| dataType | string | No | Data type, cannot be modified after setting. - STRING: string type- NUMBER: number type- DATETIME: date type- BOOLEAN: Boolean type- ENUM: enumeration value type | STRING |
| label | string | no | display name | school |
| description | string | no | detailed description | school |
| encrypted | boolean | no | encrypted storage. When enabled, the newly added data of this field will be encrypted. Once this parameter is set, it cannot be changed. | |
| isUnique | boolean | no | Is it a unique field? When enabled, the value reported by the current field will be uniquely verified. This parameter is only for | |
| userEditable | boolean | no | Whether the user can edit | |
| visibleInAdminConsole | boolean | no | Whether it needs to be displayed in the GenAuth console: - If it is a user-defined field, control whether it is displayed in the user details; - If it is a department-defined field, control whether it is displayed in the department details; - If it is a role extension field, control whether it is displayed in the role details. | true |
| visibleInUserCenter | boolean | no | Whether to display in the user's personal center (this parameter does not control whether the API interface is returned). | true |
| validateRules | object | No | Validation rules | [{"type":"UNIQUE","content":"","error":"Already exists"}] |
| appIds | array | No | App Id list | ["appid1"] |
| desensitization | boolean | No | Desensitization | true |
| options | array | No | Enumeration value type selection Nested type: CustomFieldSelectOption. | [{"value":"pku","label":"xxxxx"}] |
| i18n | No | Multi-language display name Nested type: CustomFieldI18n. | {"label":{"zh-CN":{"enabled":false,"value":"中文"},"en-US":{"enabled":false,"value":"English"},"zh-TW":{"enabled":false,"value":"繁體中文"}}} |
¶ CustomFieldSelectOption
| Name | Type | Is it required? | Description | Sample value |
|---|---|---|---|---|
| value | string | Yes | Enumeration value value | hust |
| label | string | Yes | Enumeration value label | Huazhong University of Science and Technology |
¶ CustomFieldI18n
| Name | Type | Is it required? | Description | Sample value |
|---|---|---|---|---|
| label | Yes | Multi-language support fields Nested type: LangObject. | {"zh-CN":{"enabled":false,"value":"中文"},"en-US":{"enabled":false,"value":"English"},"zh-TW":{"enabled":false,"value":"繁體中文"},"ja-JP":{"enabled":false,"value":"日本語"}} |
¶ LangObject
| Name | Type | Is it required? | Description | Sample value |
|---|---|---|---|---|
| zh-CN | Yes | Multi-language Chinese content Nested type: LangUnit. | {"enabled":false,"value":"中文"} | |
| en-US | Yes | Multilingual English content Nesting type: LangUnit. | {"enabled":false,"value":"English"} | |
| zh-TW | Yes | Multilingual Traditional Chinese content Nesting type: LangUnit. | {"enabled":false,"value":"繁體中文"} | |
| ja-JP | Yes | Multilingual Japanese content Nesting type: LangUnit. | {"enabled":false,"value":"日本語"} |
¶ LangUnit
| Name | Type | Is it required? | Description | Sample value |
|---|---|---|---|---|
| enabled | boolean | yes | Whether it is enabled. If enabled, and the console selects this language, the content will be displayed. (Default is off) | |
| value | string | yes | Multilingual content |
¶ CustomFieldDto
| Name | Type | Is it required? | Description | Sample value |
|---|---|---|---|---|
| targetType | string | Yes | Target object type: - USER: User- ROLE: Role- GROUP: Group- DEPARTMENT: Department | USER |
| createdAt | string | No | Creation time, only valid for custom fields, built-in fields do not have creation time. | 2022-03-17T05:23:01.567Z |
| dataType | string | Yes | Data type, cannot be modified after setting. - STRING: string type- NUMBER: number type- DATETIME: date type- BOOLEAN: Boolean type- ENUM: enumeration value type | STRING |
| key | string | yes | field key, cannot conflict with the key of built-in fields, cannot be modified after setting. | school |
| label | string | yes | display name | school |
| description | string | no | detailed description information | school |
| encrypted | boolean | no | whether to store encrypted. After enabling, newly added data of this field will be encrypted, and this parameter cannot be changed once set. | |
| isUnique | boolean | yes | whether it is a unique field. After enabling, the value reported by the current field will be uniquely verified. This parameter is only valid for fields with data types of strings and numbers. | |
| userEditable | boolean | no | Whether the user can edit. If it is a special field such as mobile phone number or email address, the user cannot modify it directly and needs to verify it first through verification code or other methods. | |
| visibleInAdminConsole | boolean | yes | Whether to display in the GenAuth console: - If it is a user-defined field, control whether to display in user details; - If it is a department-defined field, control whether to display in department details; - If it is a role extension field, control whether to display in role details. | true |
| visibleInUserCenter | boolean | no | Whether to display in the user's personal center (this parameter does not control whether the API interface is returned). | true |
| i18n | no | Multi-language display name Nested type: CustomFieldI18n. | {"label":{"zh-CN":{"enabled":false,"value":"中文"},"en-US":{"enabled":false,"value":"English"},"zh-TW":{"enabled":false,"value":"繁體中文"}}} | |
| options | array | no | Enumeration value type selection Nested type: CustomFieldSelectOption. | [{"value":"pku","label":"xxxxx"}] |
¶ CustomFieldI18n
| Name | Type | Is this field required? | Description | Sample value |
|---|---|---|---|---|
| label | yes | Field that supports multiple languages Nested type: LangObject. | {"zh-CN":{"enabled":false,"value":"中文"},"en-US":{"enabled":false,"value":"English"},"zh-TW":{"enabled":false,"value":"繁體中文"},"ja-JP":{"enabled":false,"value":"日本語"}} |
¶ LangObject
| Name | Type | Required | Description | Sample value |
|---|---|---|---|---|
| zh-CN | Yes | Multilingual Chinese content Nested type: LangUnit. | {"enabled":false,"value":"中文"} | |
| en-US | Yes | Multilingual English content Nesting type: LangUnit. | {"enabled":false,"value":"English"} | |
| zh-TW | Yes | Multilingual Traditional Chinese content Nesting type: LangUnit. | {"enabled":false,"value":"繁體中文"} | |
| ja-JP | Yes | Multilingual Japanese content Nesting type: LangUnit. | {"enabled":false,"value":"日本語"} |
¶ LangUnit
| Name | Type | Is it required? | Description | Sample value |
|---|---|---|---|---|
| enabled | boolean | yes | Is it enabled? If enabled, and the console selects this language, the content will be displayed. (Closed by default) | |
| value | string | Yes | Multilingual content |
¶ CustomFieldSelectOption
| Name | Type | Is it required? | Description | Sample value |
|---|---|---|---|---|
| value | string | Yes | Enumeration value value | hust |
| label | string | Yes | Enumeration value label | Huazhong University of Science and Technology |
