Get a list of keys belonging to an API
const { result, error } = await unkey.apis.listKeys({
apiId: "api_QUGih1EMtBy9eSSf3vujmF",
limit: 100,
})
if (error) {
// handle potential network or bad request error
// a link to our docs will be in the `error.docs` field
console.error(error.message);
return;
}
console.log(result)
{
"result": {
"keys": [
{
"id": "key_HPnfviesBEKHnZBFFiY4fg",
"apiId": "api_QUGih1EMtBy9eSSf3vujmF",
"workspaceId": "ws_o17fS1LvwtRswPdncAcUM",
"start": "key_Crg",
"createdAt": 1687642066782,
"expires": null,
"ratelimit": {
"type": "fast",
"limit": 11,
"refillRate": 11,
"refillInterval": 11
}
},
...
],
"total": 4
}
}
const { result, error } = await unkey.apis.listKeys({
apiId: "api_QUGih1EMtBy9eSSf3vujmF",
limit: 100,
})
if (error) {
// handle potential network or bad request error
// a link to our docs will be in the `error.docs` field
console.error(error.message);
return;
}
console.log(result)
{
"result": {
"keys": [
{
"id": "key_HPnfviesBEKHnZBFFiY4fg",
"apiId": "api_QUGih1EMtBy9eSSf3vujmF",
"workspaceId": "ws_o17fS1LvwtRswPdncAcUM",
"start": "key_Crg",
"createdAt": 1687642066782,
"expires": null,
"ratelimit": {
"type": "fast",
"limit": 11,
"refillRate": 11,
"refillInterval": 11
}
},
...
],
"total": 4
}
}
4
will skip the first 4 keys and return keys starting at the 5th position.ownerId
.If provided, this will only return keys where the ownerId
matches.Hide properties
Show child attributes
{
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
}
Show properties
const { result, error } = await unkey.apis.listKeys({
apiId: "api_QUGih1EMtBy9eSSf3vujmF",
limit: 100,
})
if (error) {
// handle potential network or bad request error
// a link to our docs will be in the `error.docs` field
console.error(error.message);
return;
}
console.log(result)
{
"result": {
"keys": [
{
"id": "key_HPnfviesBEKHnZBFFiY4fg",
"apiId": "api_QUGih1EMtBy9eSSf3vujmF",
"workspaceId": "ws_o17fS1LvwtRswPdncAcUM",
"start": "key_Crg",
"createdAt": 1687642066782,
"expires": null,
"ratelimit": {
"type": "fast",
"limit": 11,
"refillRate": 11,
"refillInterval": 11
}
},
...
],
"total": 4
}
}