Skip to main content

List Keys

Returns all API keys associated with a user, optionally filtered by visibility level.

Endpoint

POST /v2/keys/list

Request Body

FieldTypeRequiredConstraintsDescription
userIdintYesMust be a valid user IDThe ID of the user whose keys should be listed
visibilitystringNoMust be a valid KeyVisibility valueFilter results to keys with this visibility level
{
"userId": 12345,
"visibility": "Private"
}

Response

Returns an array of key records matching the specified criteria.

{
"success": true,
"data": [
{
"keyId": 9001,
"userId": 12345,
"key": "ek_live_abc123xyz789...",
"visibility": "Private",
"created": "2025-01-15T10:30:00Z"
},
{
"keyId": 9002,
"userId": 12345,
"key": "ek_shared_def456uvw...",
"visibility": "Shared",
"created": "2025-03-20T14:00:00Z"
}
]
}

Response Fields

FieldTypeDescription
keyIdintUnique identifier for this key record
userIdintThe user this key belongs to
keystringThe API key string used for authentication
visibilitystringScope of the key — see KeyVisibility enum
createddatetimeUTC timestamp when the key was created

ENUMs

KeyVisibility

See KeyVisibility in the Appendix for the full list of values.

ValueDescription
PrivateKey is accessible only to the owning user
SharedKey is shared within the mailbox or network
PublicKey is publicly accessible
SessionKey is tied to a single session

Code Examples

curl -X POST "https://rest.ecgrid.io/v2/keys/list" \
-H "X-API-Key: $ECGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "userId": 12345, "visibility": "Private" }'

See Also