# API reference

> The Files API: addresses, authentication, errors and limits.

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

For agents: Files API at https://<ref>.files.sypnia.com (content on <ref>.files.sypnia.app); auth apikey header (publishable/secret) + Bearer user JWT; error shape; codes 400 invalid_request/path/transform, 401 unauthorized/invalid_token, 403 policy_denied/secret_key_in_browser, 404 not_found/bucket_not_found, 409 already_exists, 413 too_large, 415 type_not_allowed, 423 scan_pending/infected, 507 insufficient_storage, 429 rate_limited.

API: `https://<ref>.files.sypnia.com` **\[Cloud]**, or your engine's address **\[Engine]**. Content: `https://<ref>.files.sypnia.app`.

## Authentication

| Header                                | Meaning                                            |
| ------------------------------------- | -------------------------------------------------- |
| `apikey: <publishable or secret key>` | which project, and with the secret key full access |
| `Authorization: Bearer <user JWT>`    | who the user is; policies apply                    |

## Errors

```json
{ "error": { "code": "policy_denied", "message": "No policy allows insert on avatars/user-42/photo.jpg." } }
```

| Status | Codes                                                  |
| ------ | ------------------------------------------------------ |
| 400    | `invalid_request`, `invalid_path`, `invalid_transform` |
| 401    | `unauthorized`, `invalid_token`                        |
| 403    | `policy_denied`, `secret_key_in_browser`               |
| 404    | `not_found`, `bucket_not_found`                        |
| 409    | `already_exists`                                       |
| 413    | `too_large`                                            |
| 415    | `type_not_allowed`                                     |
| 423    | `scan_pending`, `infected`                             |
| 507    | `insufficient_storage`                                 |
| 429    | `rate_limited`                                         |

- [Endpoints](/api/endpoints/): Buckets, objects, uploads, signed URLs, policies and S3 keys.
