Skip to content

GET /api/keys

Summary

Retrieves all API keys associated with a specific customer.

Intent

Allows callers to list the API keys belonging to a given customer, including metadata such as creation time, last usage, and revocation status, enabling key management and auditing workflows.

Parameters

NameTypeRequiredDescription
customerIdstringYesThe unique identifier of the customer whose API keys should be listed.

Request example

Terminal window
curl -X GET "https://maps.google.com/api/keys?customerId=cust-456" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"

Response example

{
"keys": [
{
"keyId": "key_abc123",
"keyPrefix": "sk_live_",
"name": "Production Key",
"createdAt": "2024-01-15T10:30:00.000Z",
"lastUsedAt": "2024-06-01T08:22:11.000Z",
"revokedAt": null
},
{
"keyId": "key_def456",
"keyPrefix": "sk_live_",
"name": "CI/CD Key",
"createdAt": "2024-03-10T14:00:00.000Z",
"lastUsedAt": null,
"revokedAt": "2024-05-20T09:00:00.000Z"
}
]
}

Error cases

  • 400 — customerId query parameter is missing or empty

Gotchas

  • customerId is a required query parameter even though the endpoint parameters list may appear empty — omitting it returns a 400 error immediately.
  • revokedAt and lastUsedAt are explicitly nullable; expect null (not undefined or a missing field) when a key has never been used or has not been revoked.
  • The response wraps the array under a ‘keys’ property — do not expect a top-level array.
  • Revoked keys are still returned in the list; callers must check revokedAt to determine whether a key is still active.