# Direct uploads

> One request per file, for files up to the direct-upload limit.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://files.docs.sypnia.com/uploads/direct-uploads/

For agents: Files direct uploads: upload(path, file, {contentType sniffed, upsert (needs update policy), cacheControl, metadata}) → POST /object/{bucket}/{path}; response id, size, checksum, scan_status; checks in order: auth + bucket, path format, maxFileSize and direct-upload limit (413 → resumable), type sniffing vs allowedTypes, insert/update policy, storage quota; row written only after bytes stored.

```ts
await files.bucket('menu').upload('pan-masa-madre.jpg', file, {
  contentType: 'image/jpeg',   // checked against the bytes
  upsert: false,               // true replaces an existing file (needs an update policy)
  cacheControl: '3600',
  metadata: { product: 'pan-masa-madre' },
});
```

The SDK sends `POST /object/{bucket}/{path}` with the file as the body. The response has the file's `id`, `size`, `checksum` and `scan_status`.

## What is checked, in order

1. The token or key, and that the bucket exists.
2. The path's format.
3. The size against the bucket's `maxFileSize` and the direct-upload limit (`413` above it: use [resumable uploads](https://files.docs.sypnia.com/uploads/resumable-uploads)).
4. The type, sniffed from the first bytes, against `allowedTypes`.
5. Your `insert` policy (and `update` with `upsert`).
6. The project's storage quota.

The object is written to storage with a SHA-256 checksum; the metadata row is written only after the bytes are stored, so a failed upload never leaves a row pointing at nothing.
