Skip to main content

GenerateAPIKey

Generates a new API key for a user, replacing any existing key.

:::caution Established API The SOAP API is in maintenance mode. For new integrations use the REST equivalent. :::

:::caution Key Replacement Generating a new key immediately invalidates the previous key for this user. Update any integrations that use the old key before or immediately after calling this method. :::

Method Signature

string GenerateAPIKey(string SessionID, int UserID)

Parameters

ParameterTypeRequiredDescription
SessionIDstringYesActive session token from Login()
UserIDintYesID of the user for whom to generate a new API key

Response Object — string

Returns the newly generated API key string.

<!-- Example response XML -->
<GenerateAPIKeyResult>mnp456qrs789tuv012wxy345zab678cd</GenerateAPIKeyResult>

Code Examples

// .NET 10 — dotnet-svcutil generated proxy
// Generate a new API key — the previous key is immediately invalidated
string newKey = await client.GenerateAPIKeyAsync(sessionID, userId);

Console.WriteLine($"New API key generated for user {userId}:");
Console.WriteLine(newKey);
Console.WriteLine("Update all integrations using this user's previous key.");

REST Equivalent

See Generate API KeyPOST /v2/users/key-generate/{id}.