Skip to main content
POST
/
v1
/
files
Upload File
curl --request POST \
  --url https://api.unosend.co/v1/files \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "file": {}
}'

Documentation Index

Fetch the complete documentation index at: https://docs.unosend.co/llms.txt

Use this file to discover all available pages before exploring further.

Upload files to Unosend’s file cache and reuse them across multiple email sends without re-uploading. Cached files are referenced by their file_cache_key in subsequent API calls.
name
string
required
The filename including extension (e.g., logo.png, invoice.pdf).
file
binary
required
The file content as multipart/form-data.

Request

curl -X POST "https://api.unosend.co/v1/files?name=logo.png" \
  -H "Authorization: Bearer un_xxxxxxxxxx" \
  -F "file=@/path/to/logo.png"

Response

200
{
  "message": "OK",
  "data": {
    "file_cache_key": "fc_1a2b3c4d5e6f",
    "name": "logo.png",
    "size": 24576,
    "content_type": "image/png",
    "created_at": "2026-01-15T10:30:00.000Z"
  }
}

Using Cached Files in Emails

Reference the file_cache_key when sending emails:
{
  "from": {"address": "hello@yourdomain.com", "name": "Your App"},
  "to": [{"email_address": {"address": "user@example.com"}}],
  "subject": "Your Invoice",
  "htmlbody": "<p>Please find your invoice attached.</p>",
  "attachments": [
    {
      "file_cache_key": "fc_1a2b3c4d5e6f",
      "name": "invoice.pdf"
    }
  ]
}

Inline Images

Use cid to embed images inline in HTML:
{
  "htmlbody": "<img src='cid:logo' />",
  "inline_images": [
    {
      "file_cache_key": "fc_1a2b3c4d5e6f",
      "cid": "logo"
    }
  ]
}
  • Maximum file size: 10 MB
  • Total email size (headers + body + attachments): 15 MB
  • Cached files are stored for 30 days from last use