FileUploads

Upload a new file

Stores a file, generates a thumbnail if necessary, and returns its details.

post/api/files

Request

Request body multipart/form-data

filestring binary required

The file to upload. Must be a PDF, PPT, PPTX, XLS, XLSX, or CSV. Max size 20MB.

generate_thumbnailboolean

Whether to generate a thumbnail for the uploaded file.

Example request

{
  "generate_thumbnail": true
}

Response

The uploaded file details

idinteger

Unique identifier of the file upload

original_namestring

The original name of the file

stored_namestring

The stored name of the file

mime_typestring

The MIME type of the file

file_sizeinteger

The size of the file in bytes

file_hashstring

A hash of the file for integrity verification

urlstring

The URL where the file can be accessed

created_atstring date-time

Timestamp when the file was created

updated_atstring date-time

Timestamp when the file was last updated

Example response

{
  "id": 1,
  "original_name": "document.pdf",
  "stored_name": "202101_document.pdf",
  "mime_type": "application/pdf",
  "file_size": 204800,
  "file_hash": "abcdef123456",
  "url": "https://example.com/files/document.pdf",
  "user": {
    "id": 1,
    "name": "John Doe"
  },
  "thumbnail": {
    "id": 2,
    "original_url": "https://example.com/thumbnails/original.png",
    "image_url": "https://example.com/thumbnails/image.png",
    "resized_image_url": "https://example.com/thumbnails/resized.png",
    "extension": "png",
    "mime_type": "image/png",
    "file_size": 10240,
    "width": 100,
    "height": 100
  }
}

Changes

No recorded changes to this operation across all 2 revisions of this API.