# Storage accounts

> Save record files to Google Drive, OneDrive, Dropbox, or Box; link cloud files to records; and send the daily backup to the cloud.

Files attached to company, opportunity, quote, contract, and support ticket records are stored on the CRM server. A user who connects a storage account can also save these files to **their own cloud account**, and attach files that already live in the cloud to a record as links.

## Supported providers

| Provider | Permission | File location |
|---|---|---|
| Google Drive | `drive.file` — only files and folders the CRM creates | `CRM/<Company name>/` |
| Microsoft OneDrive | `Files.ReadWrite` (personal OneDrive or OneDrive for Business) | `CRM/<Company name>/` |
| Dropbox | App folder | `Apps/<app>/CRM/<Company name>/` |
| Box | Account | `CRM/<Company name>/` |

You can change the folder name per installation (`STORAGE_ROOT`, default `CRM`). Files for records that aren't linked to a company go to the `CRM/Genel/` ("General") folder.

## Connecting

:::steps
### Choose the account

On the **Settings → Storage accounts** (*Ayarlar → Depolama hesapları*) page (or from the provider's card in Apps), select the provider. On the provider's consent screen, sign in with your account and grant access.

### Set options

On the connected account card:

- **Also save files I add here** (*Eklediğim dosyaları buraya da kaydet*) — when on, every file you upload to records is also sent to the cloud in the background.
- **Daily database backup** (*Günlük veritabanı yedeği*) (admins only) — the nightly backup is compressed and also uploaded to this account.

### Try it

On any record's **Files** (*Dosyalar*) card, select **Save to cloud** (*Buluta kaydet*) next to a file. The file is created in the cloud folder and shows the provider's icon in the file row.
:::

Each user connects their own account; one user's cloud account isn't accessible to other users. A user can connect more than one provider.

## Adding a cloud link

If a file is already in Drive, OneDrive, Dropbox, or Box, don't upload it to the record again — use the **Link** (*Bağlantı*) button on the **Files** (*Dosyalar*) card to paste its sharing URL (https://…). The link appears in the file list with its provider's icon and opens in the cloud when clicked; the CRM doesn't download the file's contents.

## Behavior

- A file saved to the cloud also **stays** in the CRM; the cloud copy is an additional copy. Deleting the file from the CRM doesn't delete the cloud copy.
- The same file isn't saved twice ("already in the cloud", *zaten bulutta*).
- If an upload fails (e.g. the permission was revoked), the account card shows the last error; the file stays in the CRM.
- Disconnecting the account doesn't delete files in the cloud.

## Self-hosted installations

On Solk-managed installations, the provider apps are already set up. On an installation running on your own server, you must add the provider keys to the `.env` file: `GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET` (Drive API enabled, `drive.file` on the consent screen), `MS_CLIENT_ID` / `MS_CLIENT_SECRET` (Graph `Files.ReadWrite`, `User.Read`), `DROPBOX_APP_KEY` / `DROPBOX_APP_SECRET`, `BOX_CLIENT_ID` / `BOX_CLIENT_SECRET`. The redirect URL is the same callback URL used for the email connection.