Assets: Files

API reference for uploading and creating file assets in Fileflare via the API.

Beka Rice Avatar

Written by

Last updated


Uploading a file is a three-step flow:

  1. request a signed S3 upload URL
  2. PUT the file directly to S3
  3. confirm the upload.

This avoids streaming large files through Fileflare’s servers.

Requires Bearer authentication with your Fileflare key. Rate-limited to 60 requests per minute.

Endpoint

POST https://app.digital-downloads.com/api/v1/assets/signed

Parameters

Body (JSON)

  • filename (string, required) — the name customers will see
  • size (integer, required) — file size in bytes
  • mime_type (string, optional) — MIME type, e.g. application/pdf

Example request

# 1. Request a signed upload URL
curl -X POST https://app.digital-downloads.com/api/v1/assets/signed \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"filename": "my-book.pdf", "size": 10485760, "mime_type": "application/pdf"}'

# 2. PUT the file to the returned signed URL
curl -X PUT "$SIGNED_URL" --data-binary @my-book.pdf

# 3. Confirm the upload
curl -X POST https://app.digital-downloads.com/api/v1/assets/$ASSET_ID/uploaded \
  -H "Authorization: Bearer YOUR_API_KEY"

Example response — 200 OK

{
  "asset": {
    "id": "82664d96-6dfd-4343-96b0-05c46f412a5b",
    "filename": "my-book.pdf",
    "size": 10485760
  },
  "upload_url": "https://s3.amazonaws.com/...?X-Amz-Signature=..."
}

Notes

  • If the upload fails or you want to abandon it, call POST /api/v1/assets/{asset}/cancel to free the placeholder.
  • For very large files, use S3 multipart upload against the signed URL — refer to AWS S3 docs.

Common errors

  • 402 — your storage quota is full. Free up space, upgrade, or connect your own S3.
  • 422 — invalid filename, size, or unsupported mime_type.

Keep learning