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

# Files

> Upload and manage files

The Files API allows you to upload, manage, and transform files.

## List Files

Retrieve all files.

```bash theme={null}
GET /files
```

**Example:**

```bash theme={null}
curl "https://your-directus-instance.com/files" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## Get File

Retrieve a single file.

```bash theme={null}
GET /files/:id
```

## Upload File

Upload a new file.

```bash theme={null}
POST /files
```

**Using multipart/form-data:**

```bash theme={null}
curl -X POST "https://your-directus-instance.com/files" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "file=@/path/to/image.jpg" \
  -F "title=My Image" \
  -F "folder=abc123"
```

**Using JSON:**

```bash theme={null}
curl -X POST "https://your-directus-instance.com/files" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filename_download": "image.jpg",
    "storage": "local",
    "data": "base64encodedcontent..."
  }'
```

## Import from URL

Import a file from a URL.

```bash theme={null}
POST /files/import
```

**Request Body:**

```json theme={null}
{
  "url": "https://example.com/image.jpg"
}
```

## Update File

Update file metadata.

```bash theme={null}
PATCH /files/:id
```

**Request Body:**

```json theme={null}
{
  "title": "Updated Title",
  "description": "Updated description",
  "folder": "def456"
}
```

## Delete File

Delete a file.

```bash theme={null}
DELETE /files/:id
```

## Access Files

Access uploaded files directly:

```
GET /assets/:id
```

### Image Transformations

Apply transformations to images:

```bash theme={null}
# Resize
GET /assets/:id?width=500&height=300

# Fit modes
GET /assets/:id?fit=cover&width=800&height=600

# Format
GET /assets/:id?format=webp&quality=80

# Focal point
GET /assets/:id?width=400&height=400&fit=cover&focal_point_x=0.75&focal_point_y=0.25
```

**Transform parameters:**

* `width`, `height` - Dimensions
* `fit` - `cover`, `contain`, `inside`, `outside`
* `quality` - 0-100
* `format` - `jpg`, `png`, `webp`, `tiff`, `avif`
* `withoutEnlargement` - Don't upscale
* `focal_point_x`, `focal_point_y` - Focal point (0-1)

## File Properties

<ResponseField name="id" type="string">
  Unique file identifier (UUID)
</ResponseField>

<ResponseField name="storage" type="string">
  Storage location name
</ResponseField>

<ResponseField name="filename_disk" type="string">
  Filename on disk
</ResponseField>

<ResponseField name="filename_download" type="string">
  Filename for downloads
</ResponseField>

<ResponseField name="title" type="string">
  File title
</ResponseField>

<ResponseField name="type" type="string">
  MIME type (e.g., `image/jpeg`)
</ResponseField>

<ResponseField name="folder" type="string">
  Folder ID
</ResponseField>

<ResponseField name="uploaded_by" type="string">
  User ID who uploaded the file
</ResponseField>

<ResponseField name="filesize" type="integer">
  File size in bytes
</ResponseField>

<ResponseField name="width" type="integer">
  Image width (for images)
</ResponseField>

<ResponseField name="height" type="integer">
  Image height (for images)
</ResponseField>

## Next Steps

<CardGroup cols={2}>
  <Card title="Folders" icon="folder" href="/api/rest/folders">
    Manage file folders
  </Card>

  <Card title="File Storage" icon="hard-drive" href="/features/file-storage">
    Configure storage
  </Card>
</CardGroup>
