{"openapi":"3.1.0","info":{"title":"Innocom Hub Agent API","version":"1.0.0","description":"API cho AI agent thao tác với Innocom Hub (cổng ứng dụng nội bộ): tổng quan ngày, lịch, việc cần làm, thông báo, bookmark, ứng dụng, danh bạ, tin công ty. Đọc hướng dẫn đầy đủ (quy trình, múi giờ, luật cho agent) tại https://api-hub.innocom.co/api/agent/v1/docs trước khi dùng. Mọi thời gian trả ra là giờ Việt Nam (+07:00)."},"servers":[{"url":"https://api-hub.innocom.co/api/agent/v1"},{"url":"https://hub.innocom.co/api/agent/v1"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"tags":[{"name":"Key"},{"name":"Workspace"},{"name":"Tổng quan"},{"name":"Ứng dụng"},{"name":"Bookmark"},{"name":"Việc cần làm"},{"name":"Lịch"},{"name":"Thông báo"},{"name":"Danh bạ"},{"name":"Tin công ty"}],"paths":{"/me":{"get":{"operationId":"get_me","summary":"Thông tin key đang dùng","description":"Tên key, scopes, chủ sở hữu (người dùng Hub), giới hạn tốc độ, hạn dùng. Gọi đầu tiên để biết key được phép làm gì.\n\nScope: `(mọi key hợp lệ)`.","tags":["Key"],"x-scope":null,"parameters":[],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Thông tin API key","data":{"key":{"id":"5b0e…","name":"Trợ lý Claude","prefix":"hub_ak_Ab12Cd","scopes":["read","write"],"rate_limit_per_minute":120,"expires_at":null,"created_at":"2026-10-07T09:12:00.000+07:00"},"owner":{"user_id":"8f3c…","email":"nhanvien@innocom.vn","full_name":"Nguyễn Văn A"}}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/workspaces":{"get":{"operationId":"list_workspaces","summary":"Các workspace (pháp nhân / đơn vị) chủ key thuộc về","description":"Workspace = pháp nhân hoặc đơn vị kinh doanh trong tập đoàn (Innocom, WorkGPT, ABMS…). Workspace quyết định lưới ứng dụng, tin công ty, danh bạ và sự kiện chung mà agent thấy. Mọi người đều thuộc workspace mặc định. `active: true` = workspace chủ key đang chọn trên Hub (được dùng khi không truyền `workspace_id`).\n\nScope: `read`.","tags":["Workspace"],"x-scope":"read","parameters":[],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Có 2 workspace","total":2,"limit":2,"offset":0,"data":[{"id":"0d1c…","slug":"innocom","name":"Innocom","type":"entity","is_default":true,"role":"member","member_count":9,"active":true},{"id":"7a2b…","slug":"workgpt","name":"WorkGPT","type":"business_unit","is_default":false,"role":"admin","member_count":4,"active":false}]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/summary":{"get":{"operationId":"get_summary","summary":"Tổng quan một ngày (lịch, việc cần làm, thông báo, tin công ty)","description":"Một lần gọi trả đủ bức tranh \"hôm nay\": sự kiện trong ngày, số việc đang mở/quá hạn và danh sách việc đến hạn trong ngày, thông báo chưa đọc, 3 tin công ty mới nhất. Dùng cho câu hỏi \"hôm nay tôi có gì?\" thay vì gọi từng endpoint.\n\nScope: `read`.","tags":["Tổng quan"],"x-scope":"read","parameters":[{"name":"date","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Ngày theo giờ VN, YYYY-MM-DD. Mặc định: hôm nay"},{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Tuỳ chọn. Workspace (lấy từ list_workspaces). Bỏ trống = workspace đang chọn của chủ key"}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Tổng quan ngày 2026-10-07","data":{"date":"2026-10-07","events":[{"id":"ac87…","title":"Daily Standup Meeting","type":"meeting","location":"Meeting Room A","attendees":8,"priority":"high","start_time":"2026-10-07T09:00:00.000+07:00","end_time":"2026-10-07T09:30:00.000+07:00","scope":"company"}],"tasks":{"open":5,"overdue":1,"due_today":[{"id":"1d2e…","title":"Báo cáo tiến độ tuần","status":"open","completed":false,"priority":"high","due_date":"2026-10-07T14:00:00.000+07:00","is_overdue":false}]},"notifications":{"unread":2,"latest_unread":[{"id":"77aa…","title":"Chào mừng đến Innocom Hub","type":"info","created_at":"2026-10-01T08:44:29.674+07:00"}]},"news":[{"id":"1c4e…","title":"Lịch nghỉ lễ Quốc khánh","category":"general","published_at":"2026-08-25T10:00:00.000+07:00"}]}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/overview":{"get":{"operationId":"get_overview","summary":"Tổng quan một ngày (tên chuẩn của /summary): lịch, việc cần làm, thông báo, tin công ty","description":"Một lần gọi trả đủ bức tranh \"hôm nay\": sự kiện trong ngày, số việc đang mở/quá hạn và danh sách việc đến hạn trong ngày, thông báo chưa đọc, 3 tin công ty mới nhất. Dùng cho câu hỏi \"hôm nay tôi có gì?\" thay vì gọi từng endpoint.\n\nScope: `read`.","tags":["Tổng quan"],"x-scope":"read","parameters":[{"name":"date","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Ngày theo giờ VN, YYYY-MM-DD. Mặc định: hôm nay"},{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Tuỳ chọn. Workspace (lấy từ list_workspaces). Bỏ trống = workspace đang chọn của chủ key"}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Tổng quan ngày 2026-10-07","data":{"date":"2026-10-07","events":[{"id":"ac87…","title":"Daily Standup Meeting","type":"meeting","location":"Meeting Room A","attendees":8,"priority":"high","start_time":"2026-10-07T09:00:00.000+07:00","end_time":"2026-10-07T09:30:00.000+07:00","scope":"company"}],"tasks":{"open":5,"overdue":1,"due_today":[{"id":"1d2e…","title":"Báo cáo tiến độ tuần","status":"open","completed":false,"priority":"high","due_date":"2026-10-07T14:00:00.000+07:00","is_overdue":false}]},"notifications":{"unread":2,"latest_unread":[{"id":"77aa…","title":"Chào mừng đến Innocom Hub","type":"info","created_at":"2026-10-01T08:44:29.674+07:00"}]},"news":[{"id":"1c4e…","title":"Lịch nghỉ lễ Quốc khánh","category":"general","published_at":"2026-08-25T10:00:00.000+07:00"}]}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/apps":{"get":{"operationId":"list_apps","summary":"Danh sách ứng dụng trên Hub của người dùng (kể cả thư mục)","description":"Lưới ứng dụng của chủ key theo đúng thứ tự trên Hub. Thư mục có `is_folder: true` và `children` (ứng dụng con). `q` lọc theo tên/URL/mô tả (khớp cả ứng dụng con). Dùng khi người dùng hỏi \"link ABMS là gì\", \"mở app kế toán ở đâu\".\n\nScope: `read`.","tags":["Ứng dụng"],"x-scope":"read","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Từ khoá tên/URL/mô tả"},{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Tuỳ chọn. Workspace (lấy từ list_workspaces). Bỏ trống = workspace đang chọn của chủ key"}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Tìm thấy 2 ứng dụng","total":2,"limit":2,"offset":0,"data":[{"id":"abms","name":"ABMS","url":"https://abms.innocom.co","icon":"Workflow","description":null,"is_folder":false,"children":[]},{"id":"websites","name":"Websites","url":null,"icon":"Folder","description":null,"is_folder":true,"children":[{"id":"abms-site","name":"Abms.co","url":"https://abms.co","description":"Business Management Portal"}]}]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/bookmarks":{"get":{"operationId":"list_bookmarks","summary":"Tìm/liệt kê bookmark của người dùng","description":"Bookmark (đường dẫn đã lưu) của chủ key. `q` khớp tiêu đề hoặc URL; `category` lọc chính xác.\n\nScope: `read`.","tags":["Bookmark"],"x-scope":"read","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Từ khoá tiêu đề/URL"},{"name":"category","in":"query","required":false,"schema":{"type":"string"},"description":"Lọc theo nhóm"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Tìm thấy 1 bookmark","total":1,"limit":50,"offset":0,"data":[{"id":"3f1a…","title":"Drive công ty","url":"https://drive.innocom.co","icon":null,"category":"Công cụ","sort_order":0,"created_at":"2026-10-02T15:20:11.000+07:00"}]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"create_bookmark","summary":"Lưu bookmark mới","description":"Lưu một đường dẫn vào Bookmark của chủ key (giống nút \"Thêm bookmark\" trên Hub). URL phải bắt đầu bằng `http://` hoặc `https://`. Đã có bookmark cùng URL → `409` kèm bookmark cũ, không tạo trùng.\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Bookmark"],"x-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"dry_run: chỉ kiểm tra, không thay đổi dữ liệu"},"201":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":201,"message":"Đã lưu bookmark","data":{"id":"3f1a…","title":"Drive công ty","url":"https://drive.innocom.co","icon":null,"category":"Công cụ","sort_order":0,"created_at":"2026-10-07T10:13:02.000+07:00"}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","url"],"properties":{"title":{"type":"string","maxLength":255,"description":"Tiêu đề hiển thị"},"url":{"type":"string","maxLength":512,"description":"http(s)://…"},"category":{"type":"string","maxLength":100,"description":"Nhóm (tuỳ chọn)"},"dry_run":{"type":"boolean","description":"true = chỉ kiểm tra, không lưu"}}}}}}}},"/tasks":{"get":{"operationId":"list_tasks","summary":"Tìm/liệt kê việc cần làm (checklist)","description":"Checklist cá nhân của chủ key. Mặc định chỉ việc **đang mở**, sắp theo hạn gần nhất. `overdue=true` = việc mở đã quá hạn. `due_from`/`due_to` lọc theo hạn (ISO có múi giờ).\n\nScope: `read`.","tags":["Việc cần làm"],"x-scope":"read","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Từ khoá tiêu đề/mô tả"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","done","all"],"default":"open"}},{"name":"overdue","in":"query","required":false,"schema":{"type":"boolean"},"description":"true = chỉ việc mở đã quá hạn"},{"name":"due_from","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Hạn ≥ mốc này (ISO +07:00)"},{"name":"due_to","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Hạn < mốc này (ISO +07:00)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Tìm thấy 1 việc","total":1,"limit":50,"offset":0,"data":[{"id":"1d2e…","title":"Nộp báo cáo tháng 9","description":null,"status":"open","completed":false,"priority":"high","due_date":"2026-10-05T17:00:00.000+07:00","is_overdue":true,"created_at":"2026-09-28T08:00:00.000+07:00","updated_at":"2026-09-28T08:00:00.000+07:00"}]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"create_task","summary":"Thêm việc cần làm","description":"Thêm một việc vào checklist của chủ key. `due_date` là ISO 8601 **có múi giờ** (giờ VN → `+07:00`).\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Việc cần làm"],"x-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"dry_run: chỉ kiểm tra, không thay đổi dữ liệu"},"201":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":201,"message":"Đã thêm việc","data":{"id":"9c0b…","title":"Gọi lại khách Minh Phát","description":null,"status":"open","completed":false,"priority":"high","due_date":"2026-10-08T10:00:00.000+07:00","is_overdue":false,"created_at":"2026-10-07T10:13:02.000+07:00","updated_at":"2026-10-07T10:13:02.000+07:00"}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title"],"properties":{"title":{"type":"string","maxLength":255},"description":{"type":"string","maxLength":5000},"due_date":{"type":"string","format":"date-time","description":"Hạn, ISO 8601 +07:00"},"priority":{"type":"string","enum":["low","medium","high"],"default":"medium"},"dry_run":{"type":"boolean"}}}}}}}},"/tasks/{id}":{"patch":{"operationId":"update_task","summary":"Cập nhật / đánh dấu xong một việc","description":"Sửa việc của chủ key: `completed: true` = đánh dấu xong (như tick trên Hub), `false` = mở lại; hoặc đổi `title`, `description`, `due_date`, `priority`. Chỉ gửi trường cần đổi (không xoá được hạn đã đặt). Lấy `id` từ `list_tasks`.\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Việc cần làm"],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"id việc"},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Đã cập nhật việc","data":{"id":"1d2e…","title":"Nộp báo cáo tháng 9","description":null,"status":"done","completed":true,"priority":"high","due_date":"2026-10-05T17:00:00.000+07:00","is_overdue":false,"created_at":"2026-09-28T08:00:00.000+07:00","updated_at":"2026-10-07T10:13:02.000+07:00"}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Không tìm thấy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"completed":{"type":"boolean"},"title":{"type":"string","maxLength":255},"description":{"type":"string","maxLength":5000},"due_date":{"type":"string","format":"date-time"},"priority":{"type":"string","enum":["low","medium","high"]},"dry_run":{"type":"boolean"}}}}}}}},"/events":{"get":{"operationId":"list_events","summary":"Lịch sự kiện (cá nhân + toàn công ty) theo ngày hoặc khoảng thời gian","description":"Sự kiện của chủ key (`scope: personal`) và sự kiện chung công ty (`scope: company`), sắp theo giờ bắt đầu. Dùng `date` (một ngày VN) **hoặc** `from`+`to` (ISO có múi giờ, tối đa 92 ngày). Không truyền gì = hôm nay.\n\nScope: `read`.","tags":["Lịch"],"x-scope":"read","parameters":[{"name":"date","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Một ngày VN, YYYY-MM-DD"},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Bắt đầu ≥ (ISO +07:00)"},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Bắt đầu < (ISO +07:00)"},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Từ khoá tiêu đề/địa điểm"},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["meeting","call","training","event","other"]}},{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Tuỳ chọn. Workspace (lấy từ list_workspaces). Bỏ trống = workspace đang chọn của chủ key"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Có 1 sự kiện","total":1,"limit":50,"offset":0,"range":{"from":"2026-10-05T00:00:00.000+07:00","to":"2026-10-12T00:00:00.000+07:00"},"data":[{"id":"a26d…","title":"Team Training Session","type":"training","location":"Hội trường","attendees":12,"priority":"medium","start_time":"2026-10-07T16:30:00.000+07:00","end_time":"2026-10-07T17:15:00.000+07:00","scope":"company"}]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"create_event","summary":"Tạo sự kiện cá nhân trên lịch","description":"Thêm sự kiện vào lịch cá nhân của chủ key (hiện ở widget Lịch hôm nay trên Hub). Không tạo được sự kiện toàn công ty qua API. `start_time`/`end_time` ISO 8601 **có múi giờ**; `end_time` phải sau `start_time`. Kết quả dry_run có `conflicts` = các sự kiện khác chồng giờ (để agent hỏi lại người dùng).\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Lịch"],"x-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"dry_run: chỉ kiểm tra, không thay đổi dữ liệu"},"201":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":201,"message":"Đã tạo sự kiện","data":{"id":"4e9d…","title":"Họp với khách Minh Phát","type":"meeting","location":"Phòng họp B","attendees":0,"priority":"normal","start_time":"2026-10-08T14:00:00.000+07:00","end_time":"2026-10-08T15:00:00.000+07:00","scope":"personal"},"conflicts":[]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","start_time"],"properties":{"title":{"type":"string","maxLength":255},"start_time":{"type":"string","format":"date-time","description":"ISO 8601 +07:00"},"end_time":{"type":"string","format":"date-time","description":"ISO 8601 +07:00, sau start_time"},"type":{"type":"string","enum":["meeting","call","training","event","other"],"default":"meeting"},"location":{"type":"string","maxLength":255},"attendees":{"type":"integer","minimum":0,"maximum":10000,"description":"Số người tham dự"},"priority":{"type":"string","enum":["low","normal","medium","high"],"default":"normal"},"dry_run":{"type":"boolean"}}}}}}}},"/notifications":{"get":{"operationId":"list_notifications","summary":"Thông báo của người dùng (mới nhất trước)","description":"Thông báo trong chuông Hub của chủ key. `unread_only=true` chỉ lấy chưa đọc; `since` = từ mốc thời gian. Phản hồi có thêm `unread_count` (tổng chưa đọc, không phụ thuộc bộ lọc).\n\nScope: `read`.","tags":["Thông báo"],"x-scope":"read","parameters":[{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"ISO +07:00"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Có 1 thông báo","total":1,"limit":20,"offset":0,"unread_count":1,"data":[{"id":"77aa…","title":"Chào mừng đến Innocom Hub","body":"Cổng ứng dụng nội bộ đã sẵn sàng…","type":"info","link":null,"read":false,"created_at":"2026-10-01T08:44:29.674+07:00"}]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/notifications/mark-read":{"post":{"operationId":"mark_notifications_read","summary":"Đánh dấu thông báo đã đọc","description":"Gửi `ids` (danh sách id từ `list_notifications`, tối đa 100) **hoặc** `all: true` (tất cả chưa đọc — như nút \"Đánh dấu đã đọc tất cả\"). id không thuộc chủ key → `404`.\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Thông báo"],"x-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Đã đánh dấu 2 thông báo là đã đọc","data":{"marked":2,"ids":["77aa…","81bc…"]}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100},"all":{"type":"boolean"},"dry_run":{"type":"boolean"}}}}}}}},"/contacts":{"get":{"operationId":"search_contacts","summary":"Tra cứu danh bạ nội bộ","description":"Danh bạ của workspace: liên hệ do quản trị nhập + thành viên workspace (workspace mặc định = mọi nhân viên đã đăng nhập Hub). `q` khớp tên, email, SĐT, chức danh; `department` lọc phòng ban (khớp một phần).\n\nScope: `read`.","tags":["Danh bạ"],"x-scope":"read","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"}},{"name":"department","in":"query","required":false,"schema":{"type":"string"}},{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Tuỳ chọn. Workspace (lấy từ list_workspaces). Bỏ trống = workspace đang chọn của chủ key"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Tìm thấy 1 liên hệ","total":1,"limit":50,"offset":0,"data":[{"id":"0fff…","name":"Nguyễn Văn An","email":"an.nguyen@example.com","phone":null,"department":"Kinh doanh","position":"Chuyên viên","status":"offline","is_ai_bot":false}]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/news":{"get":{"operationId":"list_news","summary":"Tin tức nội bộ công ty (mới nhất trước)","description":"Bảng tin công ty. Danh sách trả `content_preview` (300 ký tự); đọc toàn văn bằng `get_news`. `q` khớp tiêu đề/tóm tắt/nội dung; `since` = đăng từ mốc đó.\n\nScope: `read`.","tags":["Tin công ty"],"x-scope":"read","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"}},{"name":"category","in":"query","required":false,"schema":{"type":"string"}},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"ISO +07:00"},{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"Tuỳ chọn. Workspace (lấy từ list_workspaces). Bỏ trống = workspace đang chọn của chủ key"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Có 1 tin","total":1,"limit":10,"offset":0,"data":[{"id":"1c4e…","title":"Lịch nghỉ lễ Quốc khánh","category":"general","author":"HCNS","summary":"Công ty nghỉ 2 ngày…","content_preview":"Thông báo lịch nghỉ…","tags":[],"priority":"normal","image_url":null,"published_at":"2026-10-01T10:00:00.000+07:00"}]}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"create_news","summary":"Đăng tin công ty (quản trị workspace)","description":"Tạo tin trong bản tin của workspace. **Chỉ key của quản trị workspace** (hoặc quản trị Hub) — key khác nhận `403`. Tin đăng ngay (`is_published` mặc định true, `published_at` bỏ trống) sẽ gửi thông báo trong Hub cho mọi thành viên. Ảnh bìa chỉ tải lên được qua giao diện Hub.\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Tin công ty"],"x-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"dry_run: chỉ kiểm tra, không thay đổi dữ liệu"},"201":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":201,"message":"Đã đăng tin","data":{"id":"1c4e…","title":"Lịch nghỉ lễ 2/9","category":"Thông báo","author":"Nguyễn Văn A","summary":"Công ty nghỉ 2 ngày","content":"Toàn công ty nghỉ **thứ Ba 2/9**…","tags":[],"priority":"normal","image_url":null,"pinned":false,"published_at":"2026-10-07T10:13:02.000+07:00","is_published":true,"visible":true,"updated_at":"2026-10-07T10:13:02.000+07:00","workspace":{"id":"0d1c…","slug":"innocom","name":"Innocom"}}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title"],"properties":{"title":{"type":"string","maxLength":255},"summary":{"type":"string","maxLength":1000,"description":"Tóm tắt 1–2 câu (hiện trong danh sách)"},"content":{"type":"string","maxLength":20000,"description":"Nội dung, Markdown đơn giản (**đậm**, *nghiêng*, - danh sách, # tiêu đề, [link](https://…)). Không nhận HTML — HTML hiển thị như chữ thường"},"category":{"type":"string","maxLength":100},"pinned":{"type":"boolean","description":"Ghim lên đầu bản tin"},"is_published":{"type":"boolean","description":"false = bản nháp (chỉ quản trị thấy). Mặc định true khi tạo"},"published_at":{"type":"string","format":"date-time","description":"Ngày đăng (ISO +07:00). Tương lai = hẹn giờ; bỏ trống = ngay bây giờ"},"workspace_id":{"type":"string","format":"uuid","description":"Tuỳ chọn. Workspace (từ list_workspaces); bỏ trống = workspace đang chọn của chủ key"},"dry_run":{"type":"boolean"}}}}}}}},"/news/{id}":{"get":{"operationId":"get_news","summary":"Đọc toàn văn một tin","description":"Toàn bộ nội dung (`content`) của một tin lấy từ `list_news`.\n\nScope: `read`.","tags":["Tin công ty"],"x-scope":"read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Chi tiết tin","data":{"id":"1c4e…","title":"Lịch nghỉ lễ Quốc khánh","category":"general","author":"HCNS","summary":"Công ty nghỉ 2 ngày…","content":"Thông báo lịch nghỉ… (toàn văn)","tags":[],"priority":"normal","image_url":null,"published_at":"2026-10-01T10:00:00.000+07:00"}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"read\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Không tìm thấy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"update_news","summary":"Sửa / đăng / gỡ một tin (quản trị workspace)","description":"Chỉ gửi trường cần đổi. `is_published: false` = gỡ tin (thành nháp), `true` = đăng (gửi thông báo nếu trước đó là nháp). Tin phải thuộc workspace (`workspace_id`, mặc định workspace đang chọn) mà chủ key quản trị.\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Tin công ty"],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Đã cập nhật tin","data":{"id":"1c4e…","title":"Lịch nghỉ lễ 2/9","is_published":false,"visible":false,"pinned":false}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Không tìm thấy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":255},"summary":{"type":"string","maxLength":1000,"description":"Tóm tắt 1–2 câu (hiện trong danh sách)"},"content":{"type":"string","maxLength":20000,"description":"Nội dung, Markdown đơn giản (**đậm**, *nghiêng*, - danh sách, # tiêu đề, [link](https://…)). Không nhận HTML — HTML hiển thị như chữ thường"},"category":{"type":"string","maxLength":100},"pinned":{"type":"boolean","description":"Ghim lên đầu bản tin"},"is_published":{"type":"boolean","description":"false = bản nháp (chỉ quản trị thấy). Mặc định true khi tạo"},"published_at":{"type":"string","format":"date-time","description":"Ngày đăng (ISO +07:00). Tương lai = hẹn giờ; bỏ trống = ngay bây giờ"},"workspace_id":{"type":"string","format":"uuid","description":"Tuỳ chọn. Workspace (từ list_workspaces); bỏ trống = workspace đang chọn của chủ key"},"dry_run":{"type":"boolean"}}}}}}}},"/company-events":{"post":{"operationId":"create_company_event","summary":"Tạo sự kiện chung cho cả workspace (quản trị workspace)","description":"Khác `create_event` (sự kiện cá nhân): sự kiện này hiện trên lịch của **mọi thành viên** workspace và gửi thông báo. Chỉ key của quản trị workspace (`403` nếu không).\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Lịch"],"x-scope":"write","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"dry_run: chỉ kiểm tra, không thay đổi dữ liệu"},"201":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":201,"message":"Đã tạo sự kiện chung","data":{"id":"5f1e…","title":"Họp toàn công ty","type":"meeting","location":"Hội trường","attendees":0,"priority":"normal","start_time":"2026-10-10T16:00:00.000+07:00","end_time":"2026-10-10T17:00:00.000+07:00","scope":"company","notes":null,"workspace":{"id":"0d1c…","slug":"innocom","name":"Innocom"}}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","start_time"],"properties":{"title":{"type":"string","maxLength":255},"start_time":{"type":"string","format":"date-time","description":"ISO 8601 +07:00"},"end_time":{"type":"string","format":"date-time","description":"ISO 8601 +07:00, sau start_time"},"type":{"type":"string","enum":["meeting","call","training","event","other"],"default":"meeting"},"location":{"type":"string","maxLength":255},"attendees":{"type":"integer","minimum":0,"maximum":10000},"priority":{"type":"string","enum":["low","normal","medium","high"],"default":"normal"},"notes":{"type":"string","maxLength":5000},"workspace_id":{"type":"string","format":"uuid","description":"Tuỳ chọn. Workspace (từ list_workspaces); bỏ trống = workspace đang chọn của chủ key"},"dry_run":{"type":"boolean"}}}}}}}},"/company-events/{id}":{"patch":{"operationId":"update_company_event","summary":"Sửa sự kiện chung của workspace (quản trị workspace)","description":"Chỉ gửi trường cần đổi (`end_time: null` = bỏ giờ kết thúc). Lấy `id` từ `list_events` (mục có `scope: company`).\n\nScope: `write`. Hỗ trợ `dry_run` và `Idempotency-Key`.","tags":["Lịch"],"x-scope":"write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Chuỗi duy nhất (UUID). Gọi lại cùng key trong 24h → nhận lại kết quả lần đầu, không tạo trùng."}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"},"example":{"code":200,"message":"Đã cập nhật sự kiện chung","data":{"id":"5f1e…","title":"Họp toàn công ty","location":"Phòng họp lớn","scope":"company"}}}}},"400":{"description":"Tham số sai — đọc message, sửa rồi gọi lại","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Thiếu/sai/đã thu hồi/hết hạn key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Key không có scope \"write\"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Không tìm thấy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Trùng dữ liệu hoặc Idempotency-Key đang xử lý / đã dùng cho yêu cầu khác","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Vượt giới hạn tốc độ — chờ theo header Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":255},"start_time":{"type":"string","format":"date-time","description":"ISO 8601 +07:00"},"end_time":{"type":"string","format":"date-time","description":"ISO 8601 +07:00, sau start_time"},"type":{"type":"string","enum":["meeting","call","training","event","other"],"default":"meeting"},"location":{"type":"string","maxLength":255},"attendees":{"type":"integer","minimum":0,"maximum":10000},"priority":{"type":"string","enum":["low","normal","medium","high"],"default":"normal"},"notes":{"type":"string","maxLength":5000},"workspace_id":{"type":"string","format":"uuid","description":"Tuỳ chọn. Workspace (từ list_workspaces); bỏ trống = workspace đang chọn của chủ key"},"dry_run":{"type":"boolean"}}}}}}}},"/docs":{"get":{"operationId":"get_docs","summary":"Tài liệu cho agent (Markdown)","security":[],"tags":["Tài liệu"],"description":"Chỉ truy cập được từ IP nội bộ (allowlist).","responses":{"200":{"description":"Markdown","content":{"text/markdown":{"schema":{"type":"string"}}}},"403":{"description":"Ngoài mạng nội bộ","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"operationId":"get_openapi","summary":"Tài liệu OpenAPI 3.1 này","security":[],"tags":["Tài liệu"],"description":"Chỉ truy cập được từ IP nội bộ (allowlist).","responses":{"200":{"description":"OpenAPI JSON"},"403":{"description":"Ngoài mạng nội bộ","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"hub_ak_…","description":"Authorization: Bearer hub_ak_…"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"Envelope":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer","examples":[200]},"message":{"type":"string"},"data":{},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"Error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer","examples":[400]},"message":{"type":"string","description":"Lý do lỗi (tiếng Việt)"}}}}}}