Files

Managing files, listing, updating, and deleting assets.

Files are the core asset type in Tuzzle. Each file belongs to a space and can optionally be organized into folders.

File Properties

FieldDescription
idULID primary key
nameGenerated storage name (e.g., image-01HQ...)
original_nameOriginal filename from upload
mime_typeMIME type (e.g., image/jpeg)
sizeFile size in bytes
storage_pathStorage object key ({handle}/{name})
typeAccess type: upload, private, authenticated
resource_typeimage, video, audio, text, document, archive, other
statusactive or pending
extensionFile extension (derived from MIME type)
refOptional custom reference string
public_idPublic identifier (defaults to name)
folder_pathPath of the containing folder

Listing Files

List files in a space with cursor pagination:

curl "https://api.tzzl.io/api/v1/files?space_id=SPACE_ID&limit=20" \
  -H "Authorization: Bearer sk_a1b2c3d4..."

Query Parameters

ParameterDescription
space_idRequired. The space to list files from
limitNumber of files per page
cursorCursor for pagination

Get a File

curl https://api.tzzl.io/api/v1/files/FILE_ID \
  -H "Authorization: Bearer sk_a1b2c3d4..."

Get a File by Reference

Look up a file by its custom reference:

curl "https://api.tzzl.io/api/v1/files/by-ref?space_id=SPACE_ID&ref=my-custom-ref" \
  -H "Authorization: Bearer sk_a1b2c3d4..."

Update a File

curl -X PUT https://api.tzzl.io/api/v1/files \
  -H "Authorization: Bearer sk_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "id": "01HQ...",
    "name": "new-name",
    "original_name": "renamed-photo.jpg",
    "folder_id": "01HQ...",
    "folder_path": "photos/"
  }'

Updatable Fields

FieldTypeDescription
namestringStorage name (max 255 chars)
original_namestringDisplay name (max 255 chars)
mime_typestringMIME type
sizeintegerFile size
storage_pathstringStorage path
spacestringSpace handle (to move between spaces)
folder_idstringTarget folder ID
folder_pathstringTarget folder path

Delete a File

curl -X DELETE https://api.tzzl.io/api/v1/files/FILE_ID \
  -H "Authorization: Bearer sk_a1b2c3d4..."

Deleting a file removes:

  • The file record from the database
  • The original file from cloud storage
  • All cached transformed variants

File Access Control

Update access control for a specific file:

curl -X PUT https://api.tzzl.io/api/v1/files/FILE_ID/access-control \
  -H "Authorization: Bearer sk_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "access_control": {
      "requires_auth": true
    }
  }'

Reset to inherited defaults:

curl -X DELETE https://api.tzzl.io/api/v1/files/FILE_ID/access-control \
  -H "Authorization: Bearer sk_a1b2c3d4..."

Generate a Signed URL

For private or authenticated files:

curl -X POST https://api.tzzl.io/api/v1/files/FILE_ID/signed-url \
  -H "Authorization: Bearer sk_a1b2c3d4..."

File Metadata

The storage_meta field contains image-specific metadata that is synced by the CDN after the first delivery:

{
  "width": 1920,
  "height": 1080,
  "blur_hash": "LEHV6nWB2yk8...",
  "face_detections": [
    { "left": 150, "top": 80, "width": 200, "height": 250 }
  ]
}

Resource Types

Files are automatically classified by MIME type:

Resource TypeMIME Types
imageimage/*
videovideo/*
audioaudio/*
texttext/*
documentapplication/pdf, application/msword, etc.
archiveapplication/zip, application/gzip, etc.
otherEverything else