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

# Migrating to API v2

> Migration guide from v1 to v2 API

## Overview

API v2 is a performance-optimized version of v1 with the following changes:

* Base URL: `/api/v1` → `/api/v2`
* New `isPublic` parameter on upload
* New `_perf` field in responses
* Fully backward compatible

***

## Endpoint Mapping

| v1 Endpoint                       | v2 Endpoint                       |
| --------------------------------- | --------------------------------- |
| `POST /api/v1/upload`             | `POST /api/v2/upload`             |
| N/A                               | `POST /api/v2/upload/bulk` (NEW)  |
| `GET /api/v1/files`               | `GET /api/v2/files`               |
| `GET /api/v1/files/{id}`          | `GET /api/v2/files/{id}`          |
| `GET /api/v1/files/{id}/download` | `GET /api/v2/files/{id}/download` |
| `DELETE /api/v1/files/{id}`       | `DELETE /api/v2/files/{id}`       |
| N/A                               | `DELETE /api/v2/files/bulk` (NEW) |

***

## Upload Changes

### New Parameter: `isPublic`

```bash theme={null}
POST /api/v2/upload
Content-Type: multipart/form-data

file: <binary>          # Required
isPublic: true|false    # Optional, defaults to true
```

**Example:**

```bash theme={null}
curl -X POST https://nulldrop.xyz/api/v2/upload \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@document.pdf" \
  -F "isPublic=false"
```

***

## Response Changes

### v1 Response

```json theme={null}
{
  "success": true,
  "data": {
    "id": "abc123",
    "filename": "image.png",
    "size": 102400,
    "mimeType": "image/png",
    "downloadUrl": "https://nulldrop.xyz/api/v1/files/abc123/download",
    "shareUrl": "https://nulldrop.xyz/share/xyz789",
    "uploadedAt": "2025-10-09T12:00:00.000Z"
  }
}
```

### v2 Response

```json theme={null}
{
  "success": true,
  "data": {
    "id": "abc123",
    "filename": "image.png",
    "size": 102400,
    "mimeType": "image/png",
    "downloadUrl": "https://nulldrop.xyz/api/v2/files/abc123/download",
    "shareUrl": "https://nulldrop.xyz/share/xyz789",
    "isPublic": true,
    "uploadedAt": "2025-10-09T12:00:00.000Z"
  },
  "_perf": 45
}
```

**New fields:**

* `isPublic` (boolean): File visibility status
* `_perf` (number): Request duration in milliseconds

***

## Breaking Changes

None. v2 is fully backward compatible.

***
