const listKeys = await unkey.apis.listKeys({
  apiId: "api_QUGih1EMtBy9eSSf3vujmF",
  limit: 100,
})

console.log(listKeys)

{
  "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
}

Request

apiId
string
required

The ID of the api you want to retrieve.

limit
int
default:100

Limit the number of returned keys, the maximum is 100.

offset
int
default:0

Specify an offset for pagination.

Example: An offset of 4 will skip the first 4 keys and return keys starting at the 5th position.

ownerId
string

Filter by ownerId.

If provided, this will only return keys where the ownerId matches.

Response

result
const listKeys = await unkey.apis.listKeys({
  apiId: "api_QUGih1EMtBy9eSSf3vujmF",
  limit: 100,
})

console.log(listKeys)

{
  "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
}