Skip to main content

Manage Credentials

List, rotate, and revoke your exchange credentials.

List Credentials

Retrieve all credentials associated with your account:

response = credential_api.list_trading_account_credentials()
credentials = response.data

for credential in credentials:
print(f"{credential.credential_id}: {credential.venue} - {credential.status}")
print(f" Nickname: {credential.nickname}")
print(f" Accounts: {credential.identities}")

Filter by Status

# List only verified credentials
response = credential_api.list_trading_account_credentials(
credential_status=cadenza_client.CredentialStatus.VERIFIED
)

Filter by Type

# List only exchange credentials (not broker)
response = credential_api.list_trading_account_credentials(
credential_type=cadenza_client.CredentialType.EXCHANGE
)

Rotate Credential

Update the API keys for an existing credential without disconnecting trading accounts:

response = credential_api.rotate_trading_account_credential(
cadenza_client.RotateTradingAccountCredentialRequest(
credential_id=credential_id,
api_key="new-api-key",
api_secret="new-api-secret"
)
)

credential = response.data
print(f"Credential rotated: {credential.status}")

When to Rotate

Rotate credentials when:

  • API keys are compromised or exposed
  • Exchange requires periodic key rotation
  • You want to update permissions on the exchange side
  • As part of regular security maintenance

Rotation Process

  1. Generate new API keys on your exchange
  2. Call the rotate endpoint with new keys
  3. Old keys are immediately invalidated
  4. All connected trading accounts continue working with new keys

Revoke Credential

Permanently revoke a credential. This will disconnect all trading accounts using this credential.

response = credential_api.revoke_trading_account_credential(
cadenza_client.RevokeTradingAccountCredentialRequest(
credential_id=credential_id
)
)

print(f"Credential revoked: {response.data.status}") # REVOKED

Revocation Effects

When you revoke a credential:

EffectDescription
Status changesCredential status becomes REVOKED
Trading accountsAll connected accounts are disconnected
Open ordersExisting orders remain on exchange
API keysKeys are deleted from Cadenza (not from exchange)
warning

Revocation is permanent. To reconnect accounts, you must create a new credential.

Response Reference

List Response

{
"data": [
{
"credentialId": "550e8400-e29b-41d4-a716-446655440000",
"venue": "BINANCE",
"credentialType": "EXCHANGE",
"nickname": "My Binance API",
"status": "VERIFIED",
"identities": ["spot", "margin", "futures"],
"createdAt": 1704067200000,
"updatedAt": 1704153600000
}
],
"success": true,
"errno": 0,
"error": null,
"pagination": {
"offset": 0,
"limit": 50,
"total": 1
}
}

Error Handling

Error CodeDescription
400Invalid request parameters
401Authentication required
404Credential not found
409Cannot revoke credential with active trading accounts

Best Practices

  1. Regular Audits - Periodically list and review all credentials
  2. Remove Unused - Revoke credentials that are no longer needed
  3. Rotate Proactively - Don't wait for a security incident
  4. Monitor Status - Watch for credentials that become FAILED
  5. Use Nicknames - Give meaningful names to identify credentials easily