Get¶
GET /api/v1/workspace/accesskey/{ak_uuid}/get
Overview¶
Reads the credential, bound identity, and currently effective permissions by API Key record UUID.
Before Calling and Usage Steps¶
Although this endpoint is a GET, it requires an External credential with w permission. Obtain the UUID from the API Key list or the create response; it is not restricted by an additional workspaceUUID, so first verify the returned content.workspaceUUID. Both manual keys and non-system bound account keys with known UUIDs can be queried. The permissions of a manual key are based on its role relationships; when there is no effective role relationship, it can fall back to administrator. The permissions of a bound account key change with the account's workspace role. The returned roles/permissions/rolePermissions are the effective permission summary; do not infer that there are no permissions merely from the empty roleInfo array at creation or modification. Reading does not consume or destroy the key.
Route Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| ak_uuid | string | Y | API Key record UUID (usually with a wsak_ prefix), not the ak/sk calling credential; this External path locates the record by UUID across workspaces, so verify workspaceUUID before execution.Example: wsak_example001How to obtain or fill in: Obtain it from content.data[].uuid in the API Key list or from content.uuid in the creation success response. |
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-Df-SVersion | string | Original path and request body signature version; cannot be omitted and continue using the algorithm on this page. Example: v20240417How to obtain or fill in: The example on this page uses this fixed version, which matches the example signature algorithm. |
|
| X-Df-Access-Key | string | Y | The list in this module can use r or w permission; all other endpoints, including GET details, require an External credential with w permission. Example: <external-access-key>How to obtain or fill in: Assigned by the site administrator as the External API AK; the workspace OpenAPI Key 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 by spaces, then take the hex digest. Example: <hmac-sha256-hex>How to obtain or fill in: Calculate using the paired SK according to External API Signature Authentication; see the complete runnable template below. |
| X-Df-Timestamp | string | Y | Must be within the signature validity window configured for the site; do not reuse the example time. Example: 1785427200How to obtain or fill in: When sending, use str(int(time.time())) to generate the current Unix seconds string. |
| X-Df-Nonce | string | Y | Temporary serial number; when resending after a failure, also generate a new value and recalculate the signature. Example: 97d275ee9f774315a7885ba7347acbd9How to obtain or fill in: Regenerate uuid.uuid4().hex for each request. |
Additional Parameter Notes¶
Use the site-level External API AK/SK; for the signature method, see External API Signature Authentication. The workspace API Key generated on this page and the External signature credential are not the same set of credentials. External currently returns AK/SK in plaintext and does not apply the masking policy of the frontend page; all response examples use placeholders, so actual responses should be stored as credentials.
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 = 'GET'
path = '/api/v1/workspace/accesskey/wsak_example001/get'
query = {}
data = None
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:
print("HTTP", error.code, error.read().decode("utf-8")) # Handle according to errorCode, content, and traceId; do not output AK/SK.
raise SystemExit(1)
except (URLError, TimeoutError):
print('读取失败,可退避后重新签名重试,保留traceId及查询条件。')
raise SystemExit(1)
print(json.dumps(payload, ensure_ascii=False, indent=2))
Response¶
HTTP 200, application/json unified envelope, business result in content; External does not automatically add declaration, and list pagination is in content.pageInfo.
| Field | Type | Description |
|---|---|---|
| content.id | integer or null | Internal record sequence number; the API uses uuid. The creation snapshot is obtained before flush, so this field may be null. |
| content.uuid | string | API Key record UUID, different from the calling credential ak/sk. |
| content.status | integer | Key status: 0 enabled, 2 disabled, 3 deleted. The list/details return only 0; deletion can also handle a disabled Key that has not been deleted. |
| content.creator | string | Creation identity; External creation is usually external. |
| content.updator | string | Update identity; may be empty if not modified. |
| content.createAt | integer | Creation Unix seconds. |
| content.deleteAt | integer | Deletion Unix seconds; usually -1 if not deleted. |
| content.updateAt | integer | Update Unix seconds; usually -1 if not yet modified. |
| content.name | string | API Key display name. |
| content.ak | string | Workspace Access Key calling credential plaintext, which can be used for OpenAPI authentication in that workspace; it is not the X-Df-Access-Key of this External request. |
| content.sk | string | Workspace Secret Key plaintext; should be stored as a sensitive credential; it is not the paired SK for this External request. |
| content.workspaceUUID | string | UUID of the workspace to which it belongs. |
| content.accountUUID | string | Bound account UUID; empty string for a manual workspace Key. For a bound account Key, confirm effective permissions based on the account role. |
| content.createdWay | string | Source identifier, such as manual, user, agent; the list excludes all keys whose accountUUID is non-empty. |
| content.businessType | string | System business type identifier; usually empty for manual keys. |
| content.isSystem | integer | Whether it is a system built-in Key; queries/operations in this module filter system keys. |
| content.isOwnerRole | integer | Whether it is an Owner-only Key, 1 yes, 0 no; a workspace has at most one undeleted Owner Key. |
| content.remark | string | Existing remark; the public create/modify parameters of this External do not include remark. |
| content.isBurnAfterReading | integer | Retained burn-after-reading flag; this module does not perform destruction after reading, and you should not rely on it to revoke credentials. |
| content.callCount | integer or null | Persistent cumulative call count; asynchronously counted, not a real-time count. The creation snapshot may be null before flush. |
| content.lastCallAt | integer or null | Last call Unix seconds; usually -1 means no record yet; the creation snapshot may be null. |
| content.creatorInfo | object | Creation identity summary; {} if it cannot be parsed; fields vary by identity type. |
| content.creatorInfo.uuid | string | Creation identity UUID; may be empty for system identities. |
| content.creatorInfo.status | integer | Creation identity status. |
| content.creatorInfo.wsAccountStatus | integer | Workspace relationship status summary; may be 0 for system identities. |
| content.creatorInfo.username | string | Username or system identity name. |
| content.creatorInfo.name | string | Display name. |
| content.creatorInfo.email | string | Email or system identity identifier. |
| content.creatorInfo.mobile | string | Mobile number; empty for system identities. |
| content.creatorInfo.countryCode | string | Mobile country code available for account identities; may be omitted for system identities. |
| content.creatorInfo.iconUrl | string | Avatar available for account identities; may be omitted for system identities. |
| content.creatorInfo.acntWsNickname | string | Workspace nickname available for account identities; may be omitted for system identities. |
| content.effectiveAccountUUID | string | Subject of the authorization role; for a manual Key, it is the Key's own uuid; for a bound account Key, it is accountUUID. |
| content.accountInfo | object or null | When an account is bound, returns account profile with password/mfaSecret removed; null for manual keys. |
| content.accountInfo.id | integer | Account record sequence number within the site, returned only as profile data; other APIs use uuid. |
| content.accountInfo.uuid | string | Account UUID; subsequent queries, modifications, disabling, and deletion use this field. |
| content.accountInfo.status | integer | Bound account status: success may return 0 or another non-disabled historical status; 2 first triggers ft.AgentMemberDisabled; 3 or nonexistence first triggers ft.AgentMemberNotFound. |
| content.accountInfo.creator | string | Creation identity identifier; External creation is usually SYS. |
| content.accountInfo.updator | string | Most recent modification identity identifier; may be empty if not modified yet. |
| content.accountInfo.createAt | number | Creation time, Unix seconds. |
| content.accountInfo.updateAt | number | Update time, Unix seconds; may be -1 if there is no update time yet. |
| content.accountInfo.deleteAt | number | Status operation time field, initially usually -1; enabling/disabling also writes this value, so it should not be used alone to determine deletion; use status. |
| content.accountInfo.name | string | Display nickname. |
| content.accountInfo.username | string | Login account name. Third-party accounts may be empty or duplicate other accounts. |
| content.accountInfo.email | string | Account contact email; if empty at creation and username is in email format, it will be filled with username. |
| content.accountInfo.mobile | string | Local mobile number, displayed decrypted, excluding country code; empty string if not set. |
| content.accountInfo.countryCode | string | Country/region code for the mobile number as a pure numeric string, such as 86; empty string if not set. |
| content.accountInfo.exterId | string | Unique ID in the third-party identity system; usually empty for local accounts. |
| content.accountInfo.extend | object or null | Existing extended profile of the bound account, possibly including the user_icon avatar address; this page only returns it and it cannot be modified through Key parameters. |
| content.accountInfo.extend.user_icon | string | Optional avatar URL or static resource file name; may appear when reading historical profile data; it is not a writable parameter on this page. |
| content.accountInfo.source | string | Identity source identifier, such as local, unknown, oidc, ldap; historical internal sources such as agent may also exist. |
| content.accountInfo.nameSpace | string | Identity namespace; default empty for External creation; cannot be set through public parameters of this module. |
| content.accountInfo.isUsed | integer or boolean | Flag indicating whether the account has been used. |
| content.accountInfo.agreeTerms | integer | Terms agreement flag. |
| content.accountInfo.canaryPublic | boolean | Canary flag. |
| content.accountInfo.enableMFA | boolean | Whether MFA is enabled. |
| content.accountInfo.language | string | Language identifier, zh, en, zh-hant, id, ja, ko. |
| content.accountInfo.tokenHoldTime | integer | Account inactivity session retention duration, in seconds; new accounts are initialized according to the site security session configuration and are not guaranteed to be fixed at the example value. |
| content.accountInfo.tokenMaxValidDuration | integer | Maximum account session validity period, in seconds; new accounts are initialized according to the site security session configuration. |
| content.accountInfo.timezone | string | Time zone identifier; empty if not set. |
| content.accountInfo.attributes | object | SSO sync attribute KV object, which may be overwritten by subsequent SSO logins; keys and values are agreed by the integrating party. |
| content.accountInfo.attributes.{attribute name} | any JSON value | Custom attribute value; strings are recommended, for example Department=R&D. |
| content.accountInfo.customAttributes | object | Attribute KV object maintained by the business side. |
| content.accountInfo.customAttributes.{attribute name} | any JSON value | Business custom value; strings are recommended, for example costCenter=CC-1001. |
| content.accountInfo.statusPageSubs | integer | Status page subscription flag. |
| content.accountInfo.defaultWorkspace | string | Account default workspace UUID; empty if not configured. |
| content.accountInfo.brandKey | string | Account current brand identifier, determined by the set of brands allowed for the site. |
| content.accountInfo.scheduleMobile | string | Local mobile number dedicated to On-Call scheduling; empty if not set. |
| content.accountInfo.scheduleEmail | string | Email dedicated to On-Call scheduling; empty if not set. |
| content.accountInfo.ifScheduleMobileEnable | boolean | Whether the scheduling mobile number is enabled. |
| content.accountInfo.ifScheduleEmailEnable | boolean | Whether the scheduling email is enabled. |
| content.accountInfo.accountStatus | string | Account additional status identifier; empty if not set. |
| content.roles | array of objects | Current effective role summary; an Owner-only Key has the Owner role. |
| content.roles[].uuid | string | Role UUID. |
| content.roles[].name | string | Role name. |
| content.permissions | array of strings | Current effective permission identifiers; order is not guaranteed. |
| content.permissions[] | string | One effective permission ID. |
| content.rolePermissions | object | Complete effective permission mapping keyed by role UUID. |
| content.rolePermissions.{role UUID} | array of strings | List of currently effective permission IDs for that role; dynamic role keys come from roles[].uuid. |
| content.rolePermissions.{role UUID}[] | string | A single permission ID. |
{
"code": 200,
"content": {
"id": 1001,
"uuid": "wsak_example001",
"status": 0,
"creator": "external",
"updator": "",
"createAt": 1785427200,
"deleteAt": -1,
"updateAt": -1,
"name": "示例只读API Key",
"ak": "<workspace-api-key>",
"sk": "<workspace-secret-key>",
"workspaceUUID": "wksp_example001",
"accountUUID": "",
"createdWay": "manual",
"businessType": "",
"isSystem": 0,
"isOwnerRole": 0,
"remark": "",
"isBurnAfterReading": 0,
"callCount": 0,
"lastCallAt": -1,
"creatorInfo": {
"uuid": "",
"status": 0,
"name": "SYS",
"wsAccountStatus": 0,
"username": "SYS",
"email": "SYS",
"mobile": ""
},
"effectiveAccountUUID": "wsak_example001",
"accountInfo": null,
"roles": [
{
"uuid": "role_example001",
"name": "示例最小权限角色"
}
],
"permissions": [
"routine.defaultAccess"
],
"rolePermissions": {
"role_example001": [
"routine.defaultAccess"
]
}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Structure example for a bound account Key (actual permissions vary with the bound account):
{
"code": 200,
"content": {
"id": 1001,
"uuid": "wsak_example001",
"status": 0,
"creator": "external",
"updator": "",
"createAt": 1785427200,
"deleteAt": -1,
"updateAt": -1,
"name": "示例只读API Key",
"ak": "<workspace-api-key>",
"sk": "<workspace-secret-key>",
"workspaceUUID": "wksp_example001",
"accountUUID": "acnt_example001",
"createdWay": "agent",
"businessType": "",
"isSystem": 0,
"isOwnerRole": 0,
"remark": "",
"isBurnAfterReading": 0,
"callCount": 0,
"lastCallAt": -1,
"creatorInfo": {
"uuid": "",
"status": 0,
"name": "SYS",
"wsAccountStatus": 0,
"username": "SYS",
"email": "SYS",
"mobile": ""
},
"effectiveAccountUUID": "acnt_example001",
"accountInfo": {
"id": 1001,
"uuid": "acnt_example001",
"status": 0,
"creator": "SYS",
"updator": "",
"createAt": 1785427200,
"deleteAt": -1,
"updateAt": -1,
"name": "示例Agent",
"username": "agent-example",
"email": "",
"mobile": "",
"countryCode": "",
"exterId": "",
"extend": null,
"source": "agent",
"nameSpace": "",
"isUsed": 0,
"agreeTerms": 0,
"canaryPublic": false,
"enableMFA": false,
"language": "zh",
"tokenHoldTime": 86400,
"tokenMaxValidDuration": 604800,
"timezone": "",
"attributes": {
"部门": "研发部"
},
"customAttributes": {
"costCenter": "CC-1001"
},
"statusPageSubs": 0,
"defaultWorkspace": "",
"brandKey": "guance",
"scheduleMobile": "",
"scheduleEmail": "",
"ifScheduleMobileEnable": false,
"ifScheduleEmailEnable": false,
"accountStatus": ""
},
"roles": [
{
"uuid": "role_example001",
"name": "示例最小权限角色"
}
],
"permissions": [
"routine.defaultAccess"
],
"rolePermissions": {
"role_example001": [
"routine.defaultAccess"
]
}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
The table below lists confirmed request and business branches. Common database/cache/audit 5xx errors are globally wrapped as ft.InternalServerError; when a write API returns an error, the name, Owner flag, role, or deletion status may already have been saved, so query the current state before deciding the next step.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 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. |
| 404 | ft.AKNotExistOrDelete | The UUID does not correspond to an active non-system API Key, or the Key has been deleted/disabled | The specified AK does not exist, or has been deleted | Obtain the target uuid again from the list; note that the list does not show bound account keys, and system built-in keys cannot be managed through this entry. |
| 404 | ft.AgentMemberNotFound | The account corresponding to the bound account UUID no longer exists or has been deleted | The user corresponding to the agent was not found | Check the account and Key binding from the corresponding account management entry; do not treat it as a manual key. |
| 403 | ft.AgentMemberDisabled | The bound account is disabled | The user corresponding to the agent has been disabled | First handle the status through the corresponding account management process. |
| 404 | ft.WorkspaceAgentMemberNotFound | The bound account has no active direct membership in the workspace | The agent did not find the corresponding agent user | Check the workspace member binding through the corresponding account/Agent management entry. |
| 500 | ft.InternalServerError | Database, cache invalidation, audit, or unhandled field exceptions | Internal error | Keep the traceId and verify the Key's current name, role, and status. Data may be committed first and then fail; do not assume it did not take effect just because of a 500. |