> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# list

> `org:write`

List and filter through Keys

## Usage

```typescript theme={null}
import { PinataSDK } from "pinata";

const pinata = new PinataSDK({
  pinataJwt: process.env.PINATA_JWT!,
  pinataGateway: "example-gateway.mypinata.cloud",
});

const keys = await pinata.keys
  .list()
  .name("Admin")
  .revoked(false)
```

## Returns

```typescript theme={null}
type KeyListItem = {
  id: string;
  name: string;
  key: string;
  secret: string;
  max_uses: number;
  uses: number;
  user_id: string;
  scopes: KeyScopes;
  revoked: boolean;
  createdAt: string;
  updatedAt: string;
};
```

## Parameters

Filter response with the following additional methods. All filters are optional.

### name

* Type: `string`

Filter by name, uses "contains" matching

```typescript theme={null}
const keys = await pinata.keys
  .list()
  .name("Greetings");
```

### revoked

* Type: `boolean`

Filter keys by whether or not they have been revoked

```typescript theme={null}
const keys = await pinata.keys
  .list()
  .revoked(false);
```

### exhausted

* Type: `boolean`

Filter keys based on whether they had limited uses that were exhuasted

```typescript theme={null}
const keys = await pinata.keys
  .list()
  .exhausted(false);
```

### offset

* Type: `number`

Offset the number of keys returned to paginate

```typescript theme={null}
const keys = await pinata.keys
  .list()
  .offset(5);
```

## Auto Paginate

The `list` method has an auto pagination feature that is triggered when used inside a `for await` iterator

```typescript theme={null}
for await (const item of pinata.keys.list()) {
  console.log(item.name);
}
```
