# Listing Files

This guide will show you how to list files pinned to IPFS using Filebase. We offer three methods for listing files: our JavaScript SDK, our S3 Compatible API, and our web application dashboard. Choose the method that best suits your needs.

### Using the JavaScript SDK

#### Installation

First, you need to install the Filebase SDK. You can do this using npm:

```bash
npm install @filebase/sdk
```

#### Usage

Once you have the SDK installed, you can use it to list files pinned to IPFS. Here’s a simple example to get you started:

```javascript
import { ObjectManager } from "@filebase/sdk";
const objectManager = new ObjectManager(S3_KEY, S3_SECRET, {
  bucket: bucketName
});

const fileList = await objectManager.list({
  MaxKeys: 1000
});

console.log(fileList);
```

#### API Reference

* `S3_KEY` and `S3_SECRET`: Your Filebase API credentials.
* `objectManager.list()`: List the files in the specified bucket.

For more details, refer to the [Filebase SDK documentation](https://filebase.github.io/filebase-sdk/global.html#listObjectOptions).

### Using the S3 Compatible API

#### Authentication

Before you can start listing files using the S3 Compatible API, you need to authenticate using your API key and secret.

#### Listing Files

You can list files using standard S3 operations. Here’s an example using the AWS SDK for JavaScript:

```javascript
const AWS = require('aws-sdk');

const s3 = new AWS.S3({
  endpoint: 'https://s3.filebase.com',
  region: 'us-east-1',
  signatureVersion: 'v4',
  accessKeyId: 'YOUR_API_KEY',
  secretAccessKey: 'YOUR_API_SECRET',
});

const params = {
  Bucket: 'YOUR_BUCKET_NAME',
};

s3.listObjectsV2(params, (err, data) => {
  if (err) {
    console.error('Error listing files:', err);
  } else {
    console.log('Files listed successfully:', data.Contents);
  }
});
```

#### API Reference

* `endpoint`: Filebase S3 Compatible API endpoint.
* `Bucket`: The name of your S3 bucket.

For more details, refer to the [Filebase S3 API documentation](https://docs.filebase.com).

### Using the Web Application Dashboard

#### Step-by-Step Guide

1. **Login**: Start by logging into your Filebase account.
2. **Navigate to the Dashboard**: Once logged in, navigate to the dashboard.
3. **Select Your Bucket**: Choose the bucket from which you want to list the files.
4. **View Files**: The files pinned to IPFS will be displayed in the dashboard. You can browse through them as needed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.filebase.com/ipfs-pinning/listing-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
