TsgcWSAPIKeyManagerMethods › GrantScope

GrantScope Method

Adds a scope to an existing key.

Syntax

procedure GrantScope(const aKey, aScope: string);

Parameters

NameTypeDescription
aKeyconst stringRaw plaintext key whose scope list will be extended.
aScopeconst stringCase-sensitive scope identifier to add (for example write:shipments). Must already exist in the Scopes catalog when Scopes.Enabled is True.

Remarks

Attaches an additional scope to an issued key without re-issuing it — the customer keeps the same key string but can now hit endpoints that require the new scope. No-op when the scope is already present. Appends a kaaScopeGranted audit entry (with the scope name in Details when Audit.IncludePayload is True) and persists the change when StorageType is kstFile. Use it to upgrade a customer's plan in-flight.

Example

// Upgrade: customer also needs to create shipments now
sgcWSAPIKeyManager1.GrantScope(vKey, 'write:shipments');

Back to Methods