---
name: schaffa-file
description: Use when the user asks to upload or share a file, or a public file URL is needed.
---

# Schaffa File

Require `SCHAFFA_TOKEN` in the environment. If the token is unset, tell the user instead of guessing.

```sh
curl --fail-with-body --silent --show-error \
  -H "Authorization: Bearer $SCHAFFA_TOKEN" \
  -F "file=@<file>" \
  "https://schaffa.dev/api/files"
```

Read `publicUrl` from the JSON response and return it. On HTTP 401, report that the token is missing or invalid and do not retry.

Use only files the user placed in scope. Treat the URL as public. Schaffa removes the original filename; recognized images are stripped of metadata, resized when needed, converted to WebP, and the original image is discarded. Never write the token value literally or expose request headers.
