# Bucket

File can be grouped into **Bucket**.

> Bucket are created dynamically when you upload a new file.&#x20;

### From API

In the example below, the bucket \`my-super-bucket\` will be created.

```typescript
const resultPreSignUrl = await getPreSignedUrlApplicationFile(
  { applicationId: "my-application-id" },
  {
    type: PreSignUrlType.UPLOAD,
    fileName: fileToUpload.name,
    bucket: `my-super-bucket`
  },
);
```

You can manage buckets using **deleteBucketApplicationFile, renameBucketApplicationFile, and updateBucketApplicationFile**

```typescript
// It will delete bucket `my-bucket` and sub buckets `my-bucket/sub-bucket` and corresponding files
await deleteBucketApplicationFile(
  { applicationId: "my-application-id" },
  { bucket: `my-bucket` },
);
```

```typescript
// It will rename bucket 
// `my-bucket` -> `new-bucket`
// `my-bucket/sub-bucket` -> `new-bucket/sub-bucket/`
await renameBucketApplicationFile(
  { applicationId: "my-application-id" },
  { bucket: `my-bucket`, newBucket: `new-bucket` },
);
```

<pre class="language-typescript"><code class="lang-typescript"><strong>// It will update bucket for corresponding file
</strong><strong>// Before: file.bucket => `old-bucket/sub-bucket`
</strong><strong>// After: file.bucket => `my-bucket/`
</strong><strong>await updateBucketApplicationFile(
</strong>  { applicationId: "my-application-id" },
  { bucket: `my-bucket`, applicationFileIds: ["file-id"] },
);
</code></pre>

### Client App

#### Create new bucket

You can create a new bucket by moving to a specific bucket path and upload a new file.

<figure><img src="https://3485982212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQsI1SDG0D88ckpdt2Y5M%2Fuploads%2FQUWXUiBJEI0XWf0SHta3%2Fbucket.png?alt=media&#x26;token=eb4f27e1-bded-4c00-87cb-c17c6c008c78" alt=""><figcaption></figcaption></figure>

#### Rename bucket

You can update bucket for multiple files

<figure><img src="https://3485982212-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQsI1SDG0D88ckpdt2Y5M%2Fuploads%2FjkCH5XDGYYRkaZ4rWgjx%2Fbucket-rename.png?alt=media&#x26;token=bb701632-258a-4655-8cba-4b63f3d8665b" alt=""><figcaption></figcaption></figure>
