# Upload Files

> Upload files to Aerostack Storage via REST or the SDK. Supports direct client uploads, server-side uploads, and public CDN URLs.

## REST endpoint

```
POST /api/v1/projects/{slug}/storage/upload
```

**Headers:**
```
Authorization: Bearer {accessToken}
Content-Type: multipart/form-data
```

**Form fields:**

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `file` | File | Yes | The file to upload |
| `path` | string | No | Custom storage path (default: `{uuid}.{ext}`) |
| `contentType` | string | No | Override MIME type |
| `public` | boolean | No | Make publicly accessible (default: true) |

**Response:**

```json
{
  "url": "https://cdn.aerostack.dev/projects/{slug}/{path}",
  "key": "projects/{slug}/{path}",
  "size": 204800,
  "contentType": "image/jpeg",
  "createdAt": "2026-03-04T12:00:00Z"
}
```

## Errors

| Status | Error | Description |
|--------|-------|-------------|
| `400` | `MISSING_FILE` | No file provided in form data |
| `400` | `FILE_TOO_LARGE` | File exceeds 100 MB limit |
| `401` | `UNAUTHORIZED` | Missing or invalid token |
| `413` | — | Request body too large |

The upload endpoint requires authentication. Ensure your `AerostackProvider` is configured with a valid `apiKey`, or pass a user `accessToken` in the `Authorization` header.
