Skip to content

Modify Site Account Profile



POST /api/v1/account/{account_uuid}/modify

Overview

Modify the basic profile, business attributes, and session duration of the specified account.

Before Calling and Usage Steps

Requires External credentials with w permission. The path account_uuid is obtained from the Account List or the creation response. Submit only the fields to update; omitted fields are retained, and attributes and customAttributes are replaced as complete objects. You can modify normal or disabled accounts; this API cannot change the account exterId, brand, Language, disabled status, or Workspace roles. Modification clears the account profile cache and asynchronously refreshes related alert configurations based on the changes; success does not mean all historical login tokens have been revoked.

Path Parameters

Parameter Name Type Required Description
account_uuid string Y Target account UUID.
Example: acnt_example001
How to obtain or specify: Obtain it from content.data[].uuid in the Account List.

Request Headers

Parameter Name Type Required Description
X-Df-SVersion string Signature version for the original path and request body; do not omit it and continue using the algorithm on this page.
Example: v20240417
How to obtain or specify: The example on this page uses this fixed version, which is paired with the example signature algorithm.
X-Df-Access-Key string Y Read APIs can use r or w credentials; write APIs require w credentials.
Example: <external-access-key>
How to obtain or specify: Assigned by the site administrator as External API AK; Workspace OpenAPI Keys cannot be used.
X-Df-Signature string Y Perform HMAC-SHA256 on the uppercase method, nonce, original full path, timestamp, and original UTF-8 request body concatenated with spaces, then take the hex digest.
Example: <hmac-sha256-hex>
How to obtain or specify: Calculate using the matching SK according to External API Signature Authentication; see the complete runnable template below.
X-Df-Timestamp string Y Must be within the signature validity time window configured for the site; do not reuse the example time.
Example: 1785427200
How to obtain or specify: When sending, use str(int(time.time())) to generate the current Unix seconds string.
X-Df-Nonce string Y Temporary nonce; when resending after a failure, also generate a new value and recalculate the signature.
Example: 97d275ee9f774315a7885ba7347acbd9
How to obtain or specify: Generate uuid.uuid4().hex anew for each request.

Body Request Parameters

Parameter Name Type Required Description
name string Optional; if omitted, the original value is retained. Provide a non-empty string; do not pass null.
Null allowed: False
Example: 示例成员新名称
How to obtain or specify: Use the member's latest display nickname.
mobile string The mobile field consists of two parts: countryCode and the local mobile number. It supports + international numbers or international numbers with a 00 prefix; legacy 11-digit domestic numbers starting with 1 can default to 86. When a country code is provided, the complete number is validated. Optional; if omitted, the original number is retained. An explicit empty string clears both the number and country code; null is invalid.
Null allowed: False
Empty string allowed: True
Example: 2025550123
How to obtain or specify: Obtain it from the member profile; submit it together with countryCode to avoid using an old country code.
countryCode string Optional; if only this field is passed, it is validated and normalized together with the original mobile number. When changing numbers, it is recommended to pass both fields together. When mobile is empty, the country code is ultimately cleared as well; null is invalid.
Null allowed: False
Empty string allowed: True
Example: 1
How to obtain or specify: Submit it together with mobile as the target country/region code.
username string Optional; if omitted, the original value is retained. It must not duplicate another non-deleted account in the namespace. Changing username does not automatically synchronize email; provide email at the same time as needed. Do not pass null.
Null allowed: False
Example: xxx@guance.com
How to obtain or specify: Use the new login account name; before changing it, confirm that it is not occupied in the same identity namespace.
email string Optional; if omitted, the original value is retained. An empty string clears it; null is invalid. The current modification does not validate email format, so the caller should validate it; maximum length 256 characters.
Null allowed: False
Empty string allowed: True
Max length: 256
Example: xxx@guance.com
How to obtain or specify: Use an email address that can receive notifications.
password string Optional; if omitted, the original password is retained. A non-empty password must be at least 8 characters and contain at least three of the four character types. Currently, an empty string resets it to an empty password hash rather than retaining the original password; clients should disallow empty strings. null is invalid.
Null allowed: False
Example: Changed!2026a
How to obtain or specify: The caller provides a new secure password.
source string Optional enum: local, unknown, oidc, ldap. If omitted, it is retained. Currently it is only assigned; it does not automatically change exterId or check the relationship between source and exterId. An empty string can be written; although null passes the declaration, it may trigger a database 500, so only valid enum values are recommended.
Null allowed: True
Empty string allowed: True
Allowed values: ['local', 'unknown', 'oidc', 'ldap']
Example: oidc
How to obtain or specify: Keep it consistent with the identity provider actually integrated; use local for local accounts and choose unknown, oidc, or ldap for third-party accounts according to the identity system.
tokenHoldTime integer Optional; if omitted, it is retained. Account idle session duration in seconds, range 1800 to 604800; cannot be null.
Null allowed: False
Empty string allowed: False
$minValue: 1800
$maxValue: 604800
Example: 86400
How to obtain or specify: Choose the number of seconds according to the organization's account security policy, from 1800 to 604800.
tokenMaxValidDuration integer Optional; if omitted, it is retained. Maximum account session validity period in seconds, range 60 to 2592000; cannot be null.
Null allowed: False
Empty string allowed: False
$minValue: 60
$maxValue: 2592000
Example: 604800
How to obtain or specify: Choose the number of seconds according to the organization's security policy, from 60 to 2592000.
attributes json Optional; if omitted, it is retained. When provided, the entire object is replaced; {} clears it; this is not a merge patch. Subsequent SSO logins may overwrite it; cannot be null.
Null allowed: False
Example: {"部门": "研发部"}
How to obtain or specify: Map the complete target object for the organization according to SSO account attributes.
customAttributes json Optional; if omitted, it is retained. When provided, the entire object is replaced; {} clears it; this is not a merge patch; cannot be null.
Null allowed: False
Example: {"costCenter": "CC-1001"}
How to obtain or specify: Use the complete attribute KV object that needs to be stored on the business side.

Additional Parameter Notes

Use site-level External API credentials; for authentication, see External API Signature Authentication. The following example uses signature version v20240417; the signature path, Query encoding, and raw request body must exactly match what is actually sent. The returned account profile does not include the password field; mfaSecret is only a fixed mask and is not a key that can be used for login. Modifying source does not switch the identity provider configuration; avoid directly marking third-party accounts as local. New session duration values take effect through the authentication flow and should not be used as a substitute for forced logout.

In the table, null/empty strings should be distinguished from omission. Current string type validation does not uniformly prevent empty strings; callers should provide meaningful non-empty content for login names, nicknames, etc., and should not rely on empty values to obtain implicit defaults.

Request Example

import hashlib
import hmac
import json
import time
import uuid
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError

# Replace with the target site address and the External API AK/SK assigned by the administrator.
server = "https://external-api.guance.com"
access_key = "<external-access-key>"
secret_key = "<external-secret-key>"
method = 'POST'
path = '/api/v1/account/acnt_example001/modify'
query = {}
data = {'name': '示例成员新名称', 'email': 'xxx@guance.com', 'customAttributes': {'costCenter': 'CC-1001'}}
full_path = path + ("?" + urlencode(query) if query else "")
body = "" if data is None else json.dumps(data, ensure_ascii=False, separators=(",", ":"))
timestamp = str(int(time.time()))
nonce = uuid.uuid4().hex
string_to_sign = " ".join([method, nonce, full_path, timestamp, body])
signature = hmac.new(secret_key.encode("utf-8"), string_to_sign.encode("utf-8"), hashlib.sha256).hexdigest()
headers = {
    "X-Df-Access-Key": access_key,
    "X-Df-Timestamp": timestamp,
    "X-Df-Nonce": nonce,
    "X-Df-Signature": signature,
    "X-Df-SVersion": "v20240417",
}
if data is not None:
    headers["Content-Type"] = "application/json"
request = Request(server + full_path, data=None if data is None else body.encode("utf-8"), headers=headers, method=method)
try:
    with urlopen(request, timeout=30) as result:
        payload = json.loads(result.read().decode("utf-8"))
except HTTPError as error:
    detail = error.read().decode("utf-8")
    print("HTTP", error.code, detail)  # Check errorCode, message, content, and traceId; do not print AK/SK.
    raise SystemExit(1)
except (URLError, TimeoutError):
    print("请求结果未知;写操作请先查询账号现状,确认后再决定是否重试。")
    raise SystemExit(1)
print(json.dumps(payload, ensure_ascii=False, indent=2))

Response

HTTP 200, application/json unified envelope; External does not automatically add declaration. content is the modified account profile object.

Field Type Description
content.id integer Account record sequence number within the site, returned only as profile data; use uuid when calling other APIs.
content.uuid string Account UUID; use this field for subsequent queries, modifications, disabling, and deletion.
content.status integer Account status: 0 normal, 2 disabled; list filtering uses 3 for deleted, and other historical statuses may appear.
content.creator string Creator identity identifier; External creation is usually SYS.
content.updator string Identity identifier of the most recent modification; may be empty if there has been no modification.
content.createAt number Creation time in Unix seconds.
content.updateAt number Update time in Unix seconds; may be -1 if there is no update time yet.
content.deleteAt number Status operation time field, initially usually -1; enabling/disabling also writes this value, so do not use it alone to determine deletion; use status.
content.name string Display nickname.
content.username string Login account name. Third-party accounts may be empty or duplicate other accounts.
content.email string Account contact email; if it is empty at creation and username is in email format, it is filled with username.
content.mobile string Local mobile number, displayed decrypted, excluding country code; empty string if not set.
content.countryCode string Mobile country/region code as a numeric string, such as 86; empty string if not set.
content.exterId string Unique ID in the third-party identity system; usually empty for local accounts.
content.extend object or null Existing extended profile, which may contain the user_icon avatar URL; extend passed when creating through this API is currently not saved, and the modification API also does not expose this input parameter.
content.extend.user_icon string Optional avatar URL or static resource file name; may appear when reading historical profile data and is not a writable parameter on this page.
content.source string Identity source identifier, such as local, unknown, oidc, ldap; historical internal sources such as agent may also exist.
content.nameSpace string Identity namespace, empty by default for External creation; cannot be set via public parameters of this module.
content.isUsed integer or boolean Flag indicating whether the account has been used.
content.agreeTerms integer Terms agreement flag.
content.canaryPublic boolean Canary flag.
content.enableMFA boolean Whether MFA is enabled.
content.mfaSecret string Fixed mask *********************; does not contain a usable MFA secret.
content.language string Language identifier: zh, en, zh-hant, id, ja, ko.
content.tokenHoldTime integer Account idle session duration in seconds; new accounts are initialized according to the site's secure session configuration and are not guaranteed to be fixed to the example value.
content.tokenMaxValidDuration integer Maximum account session validity period in seconds; new accounts are initialized according to the site's secure session configuration.
content.timezone string Timezone identifier; empty if not set.
content.attributes object SSO-synchronized attribute KV object, which may be overwritten by subsequent SSO logins; keys and values are agreed upon by the integrating party.
content.attributes.{attributeName} any JSON value Custom attribute value; strings are recommended, for example department=R&D.
content.customAttributes object Attribute KV object maintained by the business side.
content.customAttributes.{attributeName} any JSON value Business custom value; strings are recommended, for example costCenter=CC-1001.
content.statusPageSubs integer Status page subscription flag.
content.defaultWorkspace string UUID of the account's default Workspace; empty if not configured.
content.brandKey string Current brand identifier of the account, determined by the set of brands allowed for the site.
content.scheduleMobile string Local number of the mobile phone dedicated to scheduling; empty if not set.
content.scheduleEmail string Email dedicated to scheduling; empty if not set.
content.ifScheduleMobileEnable boolean Whether the scheduling mobile number is enabled.
content.ifScheduleEmailEnable boolean Whether the scheduling email is enabled.
content.accountStatus string Additional account status identifier; empty if not set.
content.userIconUrl string or null URL generated based on the existing avatar configuration; null if there is no avatar.
{
  "code": 200,
  "content": {
    "id": 1001,
    "uuid": "acnt_example001",
    "status": 0,
    "creator": "SYS",
    "updator": "external",
    "createAt": 1785427200,
    "deleteAt": -1,
    "updateAt": -1,
    "name": "示例成员新名称",
    "username": "xxx@guance.com",
    "email": "xxx@guance.com",
    "mobile": "",
    "countryCode": "",
    "exterId": "",
    "extend": null,
    "source": "local",
    "nameSpace": "",
    "isUsed": 0,
    "agreeTerms": 0,
    "canaryPublic": false,
    "enableMFA": false,
    "mfaSecret": "*********************",
    "language": "zh",
    "tokenHoldTime": 86400,
    "tokenMaxValidDuration": 604800,
    "timezone": "",
    "attributes": {
      "部门": "研发部"
    },
    "customAttributes": {
      "costCenter": "CC-1001"
    },
    "statusPageSubs": 0,
    "defaultWorkspace": "",
    "brandKey": "guance",
    "scheduleMobile": "",
    "scheduleEmail": "",
    "ifScheduleMobileEnable": false,
    "ifScheduleEmailEnable": false,
    "accountStatus": "",
    "userIconUrl": null
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Resolution
406 ft.ParameterValidationFailed Request field missing, or field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError Invalid request JSON syntax Request JSON format error Fix the JSON according to content.reason, line, and column.
400 ft.JsonFormatError Top level of request body JSON is not an object Part of the JSON file format is incorrect Use a JSON object; do not send an array, string, or null as the top level.
404 ft.NotFoundAccount No account found matching the query conditions, or the account has been deleted Specified account not found Obtain a valid uuid again from the account list; for two-condition queries, verify that both values belong to the same account.
400 ft.InvalidPasswordRule The non-empty new password provided during modification does not meet the current password strength rules Invalid password rule The password must be at least 8 characters and contain at least three of the four types: digits, uppercase letters, lowercase letters, and special characters.
400 ft.UsernameExterIdExists username is occupied by another non-deleted account in the same namespace username/exterId already exists Choose an unused login name; check the list first to verify existing accounts.
500 ft.InternalServerError Database, cache, asynchronous task delivery, or field exceptions not explicitly handled Internal error Save the traceId and contact the administrator; for write requests, query the current account status again first, and decide whether to retry after confirmation. Do not directly treat a 500 as not having taken effect.

Feedback

Is this page helpful?