KeyGet
Returns the API key information for a specified user.
:::caution Established API The SOAP API is in maintenance mode. For new integrations use the REST equivalent. :::
Method Signature
KeyIDInfo KeyGet(string SessionID, int UserID)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
SessionID | string | Yes | Active session token from Login() |
UserID | int | Yes | ID of the user whose API key to retrieve |
Response Object — KeyIDInfo
| Field | Type | Description |
|---|---|---|
KeyID | int | Unique identifier for this API key record |
UserID | int | ID of the user that owns this key |
Key | string | The API key string value |
Visibility | KeyVisibility | Scope of visibility for this key |
Created | datetime | Date and time the key was created |
<!-- Example response XML -->
<KeyIDInfo>
<KeyID>1042</KeyID>
<UserID>5001</UserID>
<Key>abc123def456ghi789jkl012mno345pq</Key>
<Visibility>Private</Visibility>
<Created>2025-01-15T08:30:00</Created>
</KeyIDInfo>
ENUMs
KeyVisibility
| Value | Description |
|---|---|
Private | Key is accessible only to the owning user |
Shared | Key is shared within the mailbox or network |
Public | Key is publicly visible |
Session | Key is valid only for the current session |
Code Examples
- C#
- Java
- Node.js
- Python
// .NET 10 — dotnet-svcutil generated proxy
// Retrieve the API key record for a specific user
var keyInfo = await client.KeyGetAsync(sessionID, userId);
Console.WriteLine($"Key ID: {keyInfo.KeyID}");
Console.WriteLine($"Key: {keyInfo.Key}");
Console.WriteLine($"Visibility: {keyInfo.Visibility}");
Console.WriteLine($"Created: {keyInfo.Created:yyyy-MM-dd}");
// JAX-WS generated client
// wsimport -s src https://os.ecgrid.io/v4.1/prod/ECGridOS.asmx?WSDL
ECGridOS service = new ECGridOS();
ECGridOSPortType port = service.getECGridOSPort();
var result = port.KeyGet(sessionID /*, additional params */);
System.out.println(result);
// npm install soap
import soap from 'soap';
const WSDL = 'https://os.ecgrid.io/v4.1/prod/ECGridOS.asmx?WSDL';
const client = await soap.createClientAsync(WSDL);
const [result] = await client.KeyGetAsync({
SessionID: sessionId,
// additional params
});
console.log(result);
# pip install zeep
from zeep import Client
WSDL = 'https://os.ecgrid.io/v4.1/prod/ECGridOS.asmx?WSDL'
client = Client(WSDL)
result = client.service.KeyGet(
SessionID=session_id,
# additional params
)
print(result)
REST Equivalent
See Get Key — POST /v2/keys/get-key.