إنتقل إلى المحتوى الرئيسي

Get Key Metadata

Returns masked metadata, lifecycle status, configured caps (perRequestCap, monthlySpendCap), expiration timestamp, and UTC calendar-month spend for the currently presented API key only.

Never exposes keyHash or the plaintext secret.

GET/api/v1/key
Target: https://api.example.com
curl -sS -X GET "https://api.example.com/api/v1/key" \
-H "x-api-key: YOUR_API_KEY" \
-H "Accept: application/json"

Parameters & Headers​

LocationNameRequiredDescription
Headerx-api-keyConditionalYour customer API key (YOUR_API_KEY), or pass Authorization: Bearer YOUR_API_KEY.

Success Response (200 OK)​

{
"apiKey": {
"id": "key_mock_01",
"userId": "usr_mock_01",
"name": "Production Storefront",
"keyPrefix": "gpk_live_mock0001",
"lastFour": "0001",
"maskedKey": "gpk_live_mock0001...0001",
"status": "ACTIVE",
"monthlySpendCap": "250.000000",
"perRequestCap": "50.000000",
"monthlySpent": "12.000000",
"expiresAt": null,
"lastUsedAt": "2026-11-30T18:10:00.000Z",
"lastUsedIp": "127.0.0.1",
"disabledAt": null,
"revokedAt": null,
"revokedReason": null,
"createdAt": "2026-11-01T10:00:00.000Z",
"updatedAt": "2026-11-30T18:10:00.000Z"
}
}

Error Responses​

HTTPerror.codeExample Reason
401UNAUTHORIZEDMissing/malformed, unknown, revoked, or expired key
402INSUFFICIENT_BALANCEAccount balance negative
403FORBIDDENKey disabled or owning user account suspended
403FRAUD_DETECTEDIP blocked or multi-IP anomaly triggered
429RATE_LIMITEDGeneral per-key (60/min) or per-user (120/min) limit exceeded
500INTERNAL_ERRORUnexpected server error
{
"error": {
"code": "UNAUTHORIZED",
"message": "API key has been revoked"
}
}