swap.quickswap.v1.QuickSwapBrokerService
CreateKey
CreateKey creates an API key. A broker has at most two working keys. Session token and step-up proof only. Errors: - NOT_FOUND: BROKER_NOT_FOUND. - PERMISSION_DENIED: ACTION_DENIED or STEP_UP_REQUIRED. - FAILED_PRECONDITION: KEY_LIMIT.
Request
curl --request POST \ \
--url 'https://api.testnet.polyester.com/swap.quickswap.v1.QuickSwapBrokerService/CreateKey' \
--header 'Content-Type: application/json' \
--header 'Connect-Protocol-Version: 1' \
--data '{
"broker": "value",
"label": "Name Of My Subaccount"
}'Responses
{
"key": {
"active": false,
"createdAt": "2025-01-01T00:00:00Z",
"createdByAccountId": "7563897446546",
"expiresAt": "2025-01-01T00:00:00Z",
"keyId": "3f9c2a7b5d1e4f8a9b0c6d2e7f1a3b5c",
"label": "Name Of My Subaccount",
"revokedAt": "2025-01-01T00:00:00Z",
"rotatedFrom": "value"
},
"token": "qsk_3f9c2a7b5d1e4f8a9b0c6d2e7f1a3b5c_8e1d4b7a2c9f6e3d0b5a8c1f4e7d2a9b6c3f0e5d8a1b4c7e2f9d6a3b0c5e8f1d4a"
}swap.quickswap.v1.CreateKeyRequestswap.quickswap.v1.CreateKeyResponseBroker name.
Label, 1 to 64 characters without leading or trailing whitespace.
Public key ID: the part of the token between "qsk_" and the second "_".
Label given at creation; empty for a key created by rotation.
When the key was created.
Public account ID of the member who created the key; 0 for a key that a key created by rotating itself.
Key this key replaced by rotation; empty otherwise.
End of the key's rotation overlap; the key stops working then. Unset while the key works until revoked.
When the key was revoked; unset while not revoked.
Whether the key works now: neither revoked nor past expires_at.
Bearer token qsk_<key id>_<secret>. Store it as a server secret.
| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |