A P I Keys
Create a workspace API key
Creates an API key scoped to a workspace with the given policies and optional expiry. The full key is returned only once at creation and must be stored immediately. A recent two-factor re-verification is required.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://loading/accounts.v1.Accounts/CreateAPIKey" \ -H "Content-Type: application/json" \ -d '{ "name": "CI deploy key", "workspaceId": "AAECAwQFBgcICQoLDA0ODw==", "expiresAt": "2027-06-29T00:00:00Z", "policies": [ "trading", "analytics" ] }'{
"apiKey": {
"id": "CgsMDQ4PEBESExQVFhcYGQ==",
"name": "CI deploy key",
"keyPrefix": "gm_live_8f3a",
"workspaceId": "AAECAwQFBgcICQoLDA0ODw==",
"expiresAt": "2027-06-29T00:00:00Z",
"createdAt": "2026-06-29T12:00:00Z",
"policies": [
"trading",
"analytics"
]
},
"rawKey": "gm_live_8f3a2b1c9d4e5f60718293a4b5c6d7e8"
}{
"code": "failed_precondition",
"message": "The request cannot be carried out in the current system state."
}{
"code": "unauthenticated",
"message": "The request lacks a valid API key in the Authorization header."
}{
"code": "permission_denied",
"message": "The API key is not allowed to perform this action on this workspace."
}{
"code": "resource_exhausted",
"message": "The request was rate limited. Slow down and retry later."
}{
"code": "internal",
"message": "An internal server error occurred."
}