# Deleting Files

This guide will show you how to delete files pinned to IPFS using Filebase. We offer three methods for deleting 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 delete files from 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
});

await objectManager.delete(`delete-object-example`);
```

#### API Reference

* `S3_KEY` and `S3_SECRET`: Your Filebase API credentials.
* `objectManager.delete()`: Delete the specified file from the bucket.

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

### Using the S3 Compatible API

#### Authentication

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

#### Deleting a File

You can delete 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',
  Key: 'path/to/your/file',
};

s3.deleteObject(params, (err, data) => {
  if (err) {
    console.error('Error deleting file:', err);
  } else {
    console.log('File deleted successfully:', data);
  }
});
```

#### API Reference

* `endpoint`: Filebase S3 Compatible API endpoint.
* `Bucket`: The name of your S3 bucket.
* `Key`: The path of the file to be deleted.

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 delete the files.
4. **Delete Files**: Click on the "Delete" button next to the file you wish to remove.

#### Tips

* Ensure you have selected the correct files before deleting.
* Deleted files cannot be recovered, so double-check before confirming.


---

# 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/deleting-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.
