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

# File Access

> File visibility, direct links, slugs, and CDN usage

## Visibility

Files uploaded to Stashy are **private by default**. Access depends on visibility:

| Visibility            | URL access           |
| --------------------- | -------------------- |
| **Private** (default) | Logged-in users only |
| **Published**         | Anyone with the link |

Use the [Publish](/api-reference/files/publish) and [Unpublish](/api-reference/files/unpublish) API endpoints to control visibility.

## Direct Links

Every file gets a permanent URL based on its ID:

```
https://stashy.example.com/V1StGXR8_Z5jdHi6B-myT
```

The URL is returned in the `url` field when you [upload a file](/api-reference/files/upload). The response includes the original `Content-Type` header, so browsers render images, PDFs, etc. natively.

## Slugs

You can attach a human-readable slug to any file. The slug becomes the last segment of the canonical URL:

```
https://stashy.example.com/V1StGXR8_Z5jdHi6B-myT/banner
```

The ID-only URL (`/{id}`) continues to work after a slug is set — both forms resolve to the same file. Use the [Update](/api-reference/files/update) endpoint to set or clear a slug:

```http theme={null}
PATCH /v1/files/V1StGXR8_Z5jdHi6B-myT
Content-Type: application/json

{ "slug": "banner" }
```

The response returns the updated canonical URL. Slugs are limited to 128 characters and may only contain `A–Z a–z 0–9 . _ ~ -`.

To clear a slug, send an empty string:

```http theme={null}
PATCH /v1/files/V1StGXR8_Z5jdHi6B-myT
Content-Type: application/json

{ "slug": "" }
```

## CDN Usage

Published files are ideal for CDN or subdomain mapping:

```
https://cdn.example.com/V1StGXR8_Z5jdHi6B-myT/banner
```

Point your CDN or reverse proxy at Stashy's `/{id}` or `/{id}/{slug}` path. No auth headers needed for published files — ideal for edge caching.
