# Local Office **Intégration monorepo** : ce code provient de l’ancien dépôt `git.4nkweb.com/4nk/local_office`, **fusionné dans `smart_ide`** sous **`services/local-office/`** (service HTTP au même titre que les autres dossiers de `services/`). Le dépôt distant peut être supprimé ; l’historique Git d’origine n’est pas conservé dans ce chemin (copie de fichiers). Documentation projet : [docs/features/local-office.md](../docs/features/local-office.md) · [docs/services.md](../docs/services.md). API for third-party applications to upload and edit Office documents (docx, xlsx, pptx) on this machine. ## Architecture See [docs/architecture-proposal.md](docs/architecture-proposal.md). ## Run on this machine 1. Create a virtualenv and install dependencies: ```bash python3 -m venv .venv source .venv/bin/activate # or .venv\Scripts\activate on Windows pip install -r requirements.txt ``` 2. Set environment variables (no secrets in repo). Copy `.env.example` to `.env` and set at least `API_KEYS`. For a quick local run you can use `export API_KEYS=dev-key`. 3. Run the API: ```bash uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 ``` 4. Open http://localhost:8000/docs for Swagger UI. ## API (summary) - **POST /documents** — Upload file (multipart). Header: `X-API-Key`. Request must send correct `Content-Type` for the part (e.g. docx: `application/vnd.openxmlformats-officedocument.wordprocessingml.document`). Returns `document_id`. - **GET /documents** — List documents for the API key. - **GET /documents/{id}** — Metadata. - **GET /documents/{id}/file** — Download file. - **POST /documents/{id}/commands** — Apply commands (docx: `replaceText`, `insertParagraph`). Body: `{"commands": [{"type": "replaceText", "search": "foo", "replace": "bar"}]}`. - **DELETE /documents/{id}** — Delete document and file. All routes require header `X-API-Key` and are rate-limited per key.