TsgcWSAPIKeyManagerMethods › RevokeScope

RevokeScope Method

Removes a scope from an existing key.

Syntax

procedure RevokeScope(const aKey, aScope: string);

Parameters

NameTypeDescription
aKeyconst stringRaw plaintext key whose scope list will be trimmed.
aScopeconst stringCase-sensitive scope identifier to remove. No-op when the scope is not currently attached.

Remarks

Removes a single scope from an issued key without invalidating the key itself — the customer keeps using the same key string but loses access to endpoints that required the dropped scope. Appends a kaaScopeRevoked audit entry and persists the change when StorageType is kstFile. Use it for plan downgrades or targeted permission reductions. To strip every scope at once, call RevokeScope repeatedly or RevokeKey instead when the key should be killed outright.

Example

// Downgrade: customer no longer has write access
sgcWSAPIKeyManager1.RevokeScope(vKey, 'write:shipments');

Back to Methods