{"openapi":"3.1.0","info":{"title":"PDF FlipBook — Agent API","version":"1.0.0","description":"PDF FlipBook biến tệp PDF thành sách lật 3D xem trên web, có link chia sẻ, mã nhúng iframe, kho tài liệu công khai. Agent làm được: xem tài liệu của tài khoản và kho chung, tải PDF lên từ một URL, đổi tên, đặt đường dẫn riêng, bật/tắt đưa vào kho chung và hiệu ứng, thay tệp PDF mà giữ nguyên link, lấy link xem và mã nhúng. Agent không xoá được tài liệu.\n\nCần API key `pdf_ak_…` do người dùng tạo ở https://pdf.innocom.co/settings?tab=ai-connect. Hướng dẫn đầy đủ: https://pdf.innocom.co/api/agent/v1/docs"},"servers":[{"url":"https://pdf.innocom.co/api/agent/v1"}],"security":[{"bearer":[]},{"apiKey":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Authorization: Bearer pdf_ak_…"},"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"ThanhCong":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer","examples":[200]},"message":{"type":"string"},"data":{},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"Loi":{"type":"object","required":["code","message"],"properties":{"code":{"type":"integer","examples":[400]},"message":{"type":"string"},"errors":{"description":"Chi tiết lỗi (nếu có)"}}}},"responses":{"Loi":{"description":"Lỗi — đọc `message`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Loi"}}}}}},"paths":{"/me":{"get":{"operationId":"get_me","summary":"Kiểm tra key","description":"Trả tài khoản sở hữu key, scope và hạn dùng. Gọi đầu tiên.\n\nScope: `agent:read`","tags":["me"],"parameters":[],"x-scope":"agent:read","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}}}},"/overview":{"get":{"operationId":"get_overview","summary":"Tổng quan tài khoản","description":"Số tài liệu, dung lượng đã dùng và hạn mức, 5 tài liệu mới nhất, cỡ kho chung.\n\nScope: `agent:read`","tags":["overview"],"parameters":[],"x-scope":"agent:read","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}}}},"/documents":{"get":{"operationId":"list_documents","summary":"Tài liệu của tôi","description":"Tài liệu của tài khoản, mới nhất trước, kèm link xem, link nhúng, mã iframe. Tìm theo tên bằng q (không dấu cũng được).\n\nScope: `agent:read`","tags":["documents"],"parameters":[{"name":"q","in":"query","required":false,"description":"Tìm trong tên","schema":{"type":"string","description":"Tìm trong tên"}},{"name":"limit","in":"query","required":false,"description":"Số dòng mỗi trang","schema":{"type":"integer","description":"Số dòng mỗi trang","default":20,"minimum":1,"maximum":100}},{"name":"offset","in":"query","required":false,"description":"Bỏ qua bao nhiêu dòng","schema":{"type":"integer","description":"Bỏ qua bao nhiêu dòng","default":0,"minimum":0}}],"x-scope":"agent:read","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}}},"post":{"operationId":"upload_pdf","summary":"Tải PDF lên từ URL","description":"Tải tệp PDF từ một URL công khai về thành sách lật mới (mặc định riêng tư). dry_run = tải thử và kiểm, chưa lưu.\n\nScope: `agent:write`","tags":["documents"],"parameters":[{"name":"dry_run","in":"query","required":false,"description":"true = chỉ kiểm tra và xem trước, KHÔNG ghi gì. Nên gọi trước rồi xác nhận với người dùng.","schema":{"type":"boolean"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Chuỗi duy nhất cho lệnh này; gọi lại cùng chuỗi trong 24h trả lại đúng kết quả cũ, không làm hai lần.","schema":{"type":"string"}}],"x-scope":"agent:write","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"URL trỏ thẳng tới tệp PDF","format":"uri","examples":["https://example.com/bao-gia.pdf"]},"name":{"type":"string","description":"Tên hiển thị (mặc định lấy từ URL)","maxLength":200},"public":{"type":"boolean","description":"Đưa vào kho chung ngay (hỏi người dùng trước)","default":false}},"required":["url"]}}}}}},"/documents/{id}":{"get":{"operationId":"get_document","summary":"Chi tiết một tài liệu","description":"Tên, đường dẫn, trạng thái kho chung, link xem/nhúng/tệp, mã iframe.\n\nScope: `agent:read`","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","schema":{"type":"string","description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","examples":["0123456789ab"]}}],"x-scope":"agent:read","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}}}},"/library":{"get":{"operationId":"list_library","summary":"Kho tài liệu chung","description":"Tài liệu mọi người đã đưa vào kho chung.\n\nScope: `agent:read`","tags":["library"],"parameters":[{"name":"q","in":"query","required":false,"description":"Tìm trong tên","schema":{"type":"string","description":"Tìm trong tên"}},{"name":"limit","in":"query","required":false,"description":"Số dòng mỗi trang","schema":{"type":"integer","description":"Số dòng mỗi trang","default":20,"minimum":1,"maximum":100}},{"name":"offset","in":"query","required":false,"description":"Bỏ qua bao nhiêu dòng","schema":{"type":"integer","description":"Bỏ qua bao nhiêu dòng","default":0,"minimum":0}}],"x-scope":"agent:read","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}}}},"/documents/{id}/rename":{"post":{"operationId":"rename_document","summary":"Đổi tên tài liệu","description":"Đổi tên hiển thị (không đổi link).\n\nScope: `agent:write`","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","schema":{"type":"string","description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","examples":["0123456789ab"]}},{"name":"dry_run","in":"query","required":false,"description":"true = chỉ kiểm tra và xem trước, KHÔNG ghi gì. Nên gọi trước rồi xác nhận với người dùng.","schema":{"type":"boolean"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Chuỗi duy nhất cho lệnh này; gọi lại cùng chuỗi trong 24h trả lại đúng kết quả cũ, không làm hai lần.","schema":{"type":"string"}}],"x-scope":"agent:write","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Tên mới","maxLength":200}},"required":["name"]}}}}}},"/documents/{id}/slug":{"post":{"operationId":"set_document_slug","summary":"Đặt đường dẫn riêng","description":"Đặt /v/<đường-dẫn> (chữ thường không dấu, số, gạch ngang, 3-80 ký tự). Bỏ trống slug để quay về dạng mã. Đường cũ vẫn mở được.\n\nScope: `agent:write`","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","schema":{"type":"string","description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","examples":["0123456789ab"]}},{"name":"dry_run","in":"query","required":false,"description":"true = chỉ kiểm tra và xem trước, KHÔNG ghi gì. Nên gọi trước rồi xác nhận với người dùng.","schema":{"type":"boolean"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Chuỗi duy nhất cho lệnh này; gọi lại cùng chuỗi trong 24h trả lại đúng kết quả cũ, không làm hai lần.","schema":{"type":"string"}}],"x-scope":"agent:write","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","description":"Đường dẫn mới, vd bao-gia-2026","maxLength":80,"examples":["bao-gia-2026"]}}}}}}}},"/documents/{id}/settings":{"post":{"operationId":"update_document_settings","summary":"Đổi tuỳ chọn tài liệu","description":"Đưa vào/rút khỏi kho chung, âm thanh lật trang, hiệu ứng nền, âm lượng nhạc.\n\nScope: `agent:write`","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","schema":{"type":"string","description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","examples":["0123456789ab"]}},{"name":"dry_run","in":"query","required":false,"description":"true = chỉ kiểm tra và xem trước, KHÔNG ghi gì. Nên gọi trước rồi xác nhận với người dùng.","schema":{"type":"boolean"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Chuỗi duy nhất cho lệnh này; gọi lại cùng chuỗi trong 24h trả lại đúng kết quả cũ, không làm hai lần.","schema":{"type":"string"}}],"x-scope":"agent:write","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"public":{"type":"boolean","description":"Có trong kho chung không"},"flip_sound":{"type":"boolean","description":"Âm thanh lật trang"},"ambient":{"type":"string","description":"Hiệu ứng nền","enum":["none","snow","petals","confetti","stars"]},"music_volume":{"type":"number","description":"Âm lượng nhạc nền (nếu có nhạc)","minimum":0.05,"maximum":1}}}}}}}},"/documents/{id}/replace":{"post":{"operationId":"replace_pdf","summary":"Thay tệp PDF, giữ link","description":"Thay nội dung bằng tệp PDF mới tải từ URL; giữ nguyên mã, link, tên, tuỳ chọn.\n\nScope: `agent:write`","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","schema":{"type":"string","description":"Mã tài liệu (12 ký tự hex, lấy từ list_documents)","examples":["0123456789ab"]}},{"name":"dry_run","in":"query","required":false,"description":"true = chỉ kiểm tra và xem trước, KHÔNG ghi gì. Nên gọi trước rồi xác nhận với người dùng.","schema":{"type":"boolean"}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Chuỗi duy nhất cho lệnh này; gọi lại cùng chuỗi trong 24h trả lại đúng kết quả cũ, không làm hai lần.","schema":{"type":"string"}}],"x-scope":"agent:write","responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThanhCong"}}}},"400":{"$ref":"#/components/responses/Loi"},"401":{"$ref":"#/components/responses/Loi"},"403":{"$ref":"#/components/responses/Loi"},"404":{"$ref":"#/components/responses/Loi"},"409":{"$ref":"#/components/responses/Loi"},"429":{"$ref":"#/components/responses/Loi"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"URL tệp PDF mới","format":"uri"}},"required":["url"]}}}}}}}}