Create Member API Key
/enterprise/v1/sub-accounts/{subAccountId}/api-keysname is required, at most 100 characters. workspaceCode defaults to DEFAULT. Optional expiresAt uses ISO-8601; allowedIps accepts at most 50 IP/CIDR entries. spendLimit is a positive USD amount; omitted means no key budget. limitReset is daily, weekly, monthly, or null for lifetime. apiKey is returned once; retain credential.hash for later management.
Authentication
MANAGEMENT / PROVISIONING key with tenant:keys:write.
Authorization: Bearer <CONTROL_KEY>
Any subAccountId must belong to the authenticated enterprise. hash is a metadata identifier, never a raw key.
Approval and retries
Approval-enabled enterprises require Idempotency-Key and may receive HTTP 409 / APPROVAL_REQUIRED with data.operation.executed=false. Nothing has executed at that point. Other enterprises execute directly; do not assume arbitrary POST requests support idempotent retries.
Path parameters
subAccountIdstringrequired10-digit public member ID / 10 位成员编号
Request body
namestringrequiredAt most 100 characters / 最长 100 字符
workspaceCodestringDefault: DEFAULT / 默认 DEFAULT
expiresAtstringISO-8601
allowedIpsstring[]Up to 50 IP/CIDR entries / 最多 50 个 IP/CIDR
spendLimitnumberUSD > 0 / 美元正数
limitResetstring | nulldaily | weekly | monthly | null (lifetime / 累计)
Fields use camelCase. Required and optional fields are described above.
1{
2 "name": "service-key",
3 "spendLimit": 100,
4 "limitReset": "monthly"
5}Response
HTTP 201; code: 200. Values below are illustrative; fields use camelCase.
codeinteger200
dataobject | nulldata.apiKeystringdata.credentialobjectErrors
Check both HTTP status and code; on failure inspect serviceCode, msg and traceId. Invalid credentials receive no data; missing scopes return API_KEY_SCOPE_DENIED. Cross-tenant resources are inaccessible. Acceptance or pending approval does not mean business completion.