const { result, error } = await unkey.keys.get({ keyId: "key_123" });

const { result, error } = await unkey.keys.getVerifications({ keyId: "key_123" });

if (error){
  // error will be undefined if the request was successful
}


// result
{
  verifications: [
    {
      time: 1620000000000,
      success: 100,
      rateLimited: 0,
      usageExceeded: 0
    },
    {
      time: 1640000000000,
      success: 142,
      rateLimited: 11,
      usageExceeded: 20
    },
    // ...
  ]

}

Request

Either ownerId or keyId is required. Not both.

keyId
string
required

The ID of the key you want to check.

ownerId
string
required

The ownerId associated with one or more keys you want to check.

start
integer

The unix timestamp in milliseconds to start the query from. Defaults to 30 days ago.

end
integer

The unix timestamp in milliseconds to end the query at. Defaults to now.

granularity
day
default: "day"

The granularity of the data. Only day is supported at this time.

Response

result
object
verifications
Array
required
time
integer
required

The timestamp of the usage data

success
integer
required

The number of successful requests.

rateLimited
integer
required

The number of requests that were rate limited

usageExceeded
integer
required

The number of requests that exceeded the usage limit.

const { result, error } = await unkey.keys.get({ keyId: "key_123" });

const { result, error } = await unkey.keys.getVerifications({ keyId: "key_123" });

if (error){
  // error will be undefined if the request was successful
}


// result
{
  verifications: [
    {
      time: 1620000000000,
      success: 100,
      rateLimited: 0,
      usageExceeded: 0
    },
    {
      time: 1640000000000,
      success: 142,
      rateLimited: 11,
      usageExceeded: 20
    },
    // ...
  ]

}