List¶
GET /api/v1/workspace/accesskey/list
Overview¶
Lists undeleted and enabled manual workspace API Keys with pagination.
Prerequisites and Usage Steps¶
Requires External credentials with r or w permission. Always pass workspaceUUID so that you only view the confirmed target workspace. If omitted or set to an empty string, the query spans all workspaces for all matching Keys of this service and returns plaintext AK/SK; it is not automatically limited to a single logged-in workspace. Only Keys with status=0, non-system, and empty accountUUID are returned; personal/Agent-bound Keys are not listed. Sorted by id in descending order; pageIndex defaults to 1 and pageSize defaults to 20. Search matches only the Key name and trims leading and trailing whitespace. The list returns entity fields directly and does not include roles, permissions, or creatorInfo; if you need effective permissions, call the details endpoint for each Key.
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-Df-SVersion | string | Signature version for the original path and request body; you cannot omit it and keep using the algorithm on this page. Example: v20240417How to obtain or fill in: The examples on this page use this fixed version, which matches the example signature algorithm. |
|
| X-Df-Access-Key | string | Y | The list endpoint in this module accepts r or w permission; all other endpoints, including GET details, require External credentials with w permission. Example: <external-access-key>How to obtain or fill in: Assigned by the site administrator as the External API AK; workspace OpenAPI Keys cannot be used. |
| X-Df-Signature | string | Y | Concatenate the uppercase method, nonce, original full path, timestamp, and original UTF-8 request body with spaces, then compute HMAC-SHA256 and take the hex digest. Example: <hmac-sha256-hex>How to obtain or fill in: Compute it with the matching SK as described in 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 timestamp. Example: 1785427200How to obtain or fill in: Generate a current Unix seconds string with str(int(time.time())) when sending. |
| X-Df-Nonce | string | Y | Temporary serial number; when resending after a failure, generate a new value and recompute the signature. Example: 97d275ee9f774315a7885ba7347acbd9How to obtain or fill in: Regenerate uuid.uuid4().hex for each request. |
Query Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| search | string | Optional; matches names by substring. If omitted or blank, no filtering is applied. Null allowed: False Example: 示例How to obtain or fill in: Enter a keyword from a known API Key name. |
|
| workspaceUUID | string | Optional workspace UUID. If omitted or set to an empty string, all workspaces are queried and no workspace is selected automatically; explicitly providing it is recommended. Null allowed: False Example: wksp_example001How to obtain or fill in: Obtain it from content.data[].uuid in the workspace list and verify the workspace name and status. |
|
| pageIndex | integer | Defaults to 1; minimum is 1. Null allowed: False $minValue: 1 Example: 1How to obtain or fill in: Start from 1 and advance through subsequent pages based on content.pageInfo.totalCount. |
|
| pageSize | integer | Defaults to 20; maximum is 100. Null allowed: False $minValue: 1 $maxValue: 100 Example: 20How to obtain or fill in: Choose a value from 1 to 100 according to client needs. |
Additional Parameter Notes¶
Use site-level External API AK/SK; for the signing method, see External API Signature Authentication. The workspace API Keys generated on this page are not the same set of credentials as the External signing credentials. External currently returns AK/SK in plaintext and does not apply the masking policy of the frontend page; all response examples use placeholder values, so store actual responses as credentials. The list reads persisted call statistics; there is no frontend flow that merges statistics pending refresh from the cache, so statistics may be delayed.
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/list'
query = {'workspaceUUID': 'wksp_example001', 'pageIndex': 1, 'pageSize': 20}
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 based on errorCode, content, and traceId; do not output AK/SK.
raise SystemExit(1)
except (URLError, TimeoutError):
print('Read failed; back off, re-sign, and retry, keeping the traceId and query conditions.')
raise SystemExit(1)
print(json.dumps(payload, ensure_ascii=False, indent=2))
Response¶
HTTP 200 with a unified application/json envelope; the business result is in content. External does not automatically add declaration; list pagination is in content.pageInfo.
| Field | Type | Description |
|---|---|---|
| content.data | array of objects | Keys on the current page; an empty result is []. |
| content.data[].id | integer or null | Internal record sequence number; use uuid when calling the API. A create snapshot taken before flush may have null in this field. |
| content.data[].uuid | string | API Key record UUID, which differs from the calling credentials ak/sk. |
| content.data[].status | integer | Key status: 0 enabled, 2 disabled, 3 deleted. List/details return only 0; delete can also handle a disabled Key that has not been deleted. |
| content.data[].creator | string | Creating identity; External creations are usually external. |
| content.data[].updator | string | Updating identity; may be empty if never modified. |
| content.data[].createAt | integer | Creation time in Unix seconds. |
| content.data[].deleteAt | integer | Deletion time in Unix seconds; usually -1 if not deleted. |
| content.data[].updateAt | integer | Update time in Unix seconds; usually -1 if never modified. |
| content.data[].name | string | API Key display name. |
| content.data[].ak | string | Plaintext workspace Access Key calling credential, usable for OpenAPI authentication in that workspace; not the X-Df-Access-Key of this External request. |
| content.data[].sk | string | Plaintext workspace Secret Key, which should be stored as a sensitive credential; not the matching SK of this External request. |
| content.data[].workspaceUUID | string | UUID of the workspace it belongs to. |
| content.data[].accountUUID | string | Bound account UUID; empty string for manual workspace Keys. For bound-account Keys, confirm effective permissions based on the account role. |
| content.data[].createdWay | string | Source identifier, for example manual, user, agent; the list excludes all Keys with a non-empty accountUUID. |
| content.data[].businessType | string | System business type identifier; usually empty for manual Keys. |
| content.data[].isSystem | integer | Whether this is a system built-in Key; queries/operations in this module filter out system Keys. |
| content.data[].isOwnerRole | integer | Whether this is an Owner-only Key: 1 yes, 0 no. Each workspace has at most one undeleted Owner Key. |
| content.data[].remark | string | Existing remark; the public create/modify parameters of this External API do not include remark. |
| content.data[].isBurnAfterReading | integer | Retained burn-after-reading flag; this module does not destroy credentials after reading, so do not rely on it to revoke credentials. |
| content.data[].callCount | integer or null | Persisted cumulative call count; statistics are asynchronous and not real-time. A create snapshot before flush may be null. |
| content.data[].lastCallAt | integer or null | Last call time in Unix seconds; usually -1 means no record yet. A create snapshot may be null. |
| content.pageInfo.pageIndex | integer | Current page number. |
| content.pageInfo.pageSize | integer | Number of entries per page. |
| content.pageInfo.count | integer | Number of entries on this page. |
| content.pageInfo.totalCount | integer | Total number of entries under the filter. |
{
"code": 200,
"content": {
"data": [
{
"id": 1001,
"uuid": "wsak_example001",
"status": 0,
"creator": "external",
"updator": "",
"createAt": 1785427200,
"deleteAt": -1,
"updateAt": -1,
"name": "Example read-only 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
}
],
"pageInfo": {
"pageIndex": 1,
"pageSize": 20,
"count": 1,
"totalCount": 1
}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
When no Keys match:
{
"code": 200,
"content": {
"data": [],
"pageInfo": {
"pageIndex": 1,
"pageSize": 20,
"count": 0,
"totalCount": 0
}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
The following table lists confirmed request and business branches. Ordinary database/cache/audit 5xx errors are globally wrapped as ft.InternalServerError. When a write endpoint returns an error, the name, Owner flag, role, or deletion status may already have been saved; query the current state before deciding the next step.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | A request field is missing, or a field value violates the declared validation constraints | Parameter parsing failed | Verify the parameter location, field name, type, and value. |
| 500 | ft.InternalServerError | Database, cache invalidation, audit, or unhandled field exception | Internal error | Keep the traceId and verify the Key's current name, role, and status. Data may be committed before the failure, so do not treat a 500 alone as meaning the operation did not take effect. |