# Endpoints

> Buckets, objects, uploads, signed URLs, policies and S3 keys.

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

For agents: Files API endpoints: buckets GET/POST/PATCH/DELETE /bucket; objects POST/GET/HEAD /object/{bucket}/{path} (x-upsert), POST /object/list/{bucket}, move/copy, DELETE /object/{bucket} {paths}, PATCH metadata; POST /upload/resumable (tus); POST /object/sign/… (signed download), POST /object/upload/sign/… (signed upload); GET /object/public/… on content host; policies endpoints (secret key); S3 keys; /s3 API.

## Buckets

| Method and path                                                 | Does                                                                           |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| `GET /bucket`                                                   | List buckets                                                                   |
| `POST /bucket`                                                  | `{ id, public?, maxFileSize?, allowedTypes?, scan?, cacheControl?, storage? }` |
| `GET /bucket/{id}`, `PATCH /bucket/{id}`, `DELETE /bucket/{id}` | Read, change, delete (only when empty, or with `?empty=true`)                  |

## Objects

| Method and path                          | Does                                        |
| ---------------------------------------- | ------------------------------------------- |
| `POST /object/{bucket}/{path}`           | Upload (`x-upsert: true` to replace)        |
| `GET /object/{bucket}/{path}`            | Download as the user (policies apply)       |
| `HEAD /object/{bucket}/{path}`           | Metadata only                               |
| `POST /object/list/{bucket}`             | `{ prefix, limit, offset, sortBy, search }` |
| `POST /object/move`, `POST /object/copy` | `{ bucket, from, to }`                      |
| `DELETE /object/{bucket}`                | `{ paths: [...] }`                          |
| `PATCH /object/{bucket}/{path}/metadata` | Change your metadata                        |

## Uploads and signed URLs

| Method and path                                          | Does                                                         |
| -------------------------------------------------------- | ------------------------------------------------------------ |
| `POST /upload/resumable`                                 | Start a tus upload (then `PATCH` its location)               |
| `POST /object/sign/{bucket}/{path}`                      | `{ expiresIn, transform?, download? }` → signed download URL |
| `POST /object/upload/sign/{bucket}/{path}`               | `{ expiresIn }` → signed upload URL and token                |
| `GET /object/public/{bucket}/{path}` on the content host | Public download, with transform options                      |

## Policies, keys and S3

| Method and path                                              | Does                                            |
| ------------------------------------------------------------ | ----------------------------------------------- |
| `GET /policies`, `POST /policies`, `DELETE /policies/{name}` | Policies on `sypnia_files.objects` (secret key) |
| `POST /s3-keys`, `GET /s3-keys`, `DELETE /s3-keys/{id}`      | S3 access keys                                  |
| `/s3/...`                                                    | The S3-compatible API                           |

The OpenAPI document is in the engine's repository, at `spec/openapi.yaml`.
