{ "openapi": "3.1.0", "info": { "title": "AiRead API", "version": "0.1.0" }, "paths": { "/healthz": { "get": { "summary": "Healthz", "operationId": "healthz_healthz_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Response Healthz Healthz Get" } } } } } } }, "/readyz": { "get": { "summary": "Readyz", "operationId": "readyz_readyz_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "additionalProperties": { "type": "string" }, "type": "object", "title": "Response Readyz Readyz Get" } } } } } } }, "/library/items": { "get": { "summary": "List Library Items", "operationId": "list_library_items_library_items_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/LibraryItemView" }, "type": "array", "title": "Response List Library Items Library Items Get" } } } } } }, "post": { "summary": "Import Library Item", "operationId": "import_library_item_library_items_post", "requestBody": { "content": { "multipart/form-data": { "schema": { "$ref": "#/components/schemas/Body_import_library_item_library_items_post" } } }, "required": true }, "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ImportResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/library/items/{item_id}": { "get": { "summary": "Get Library Item", "operationId": "get_library_item_library_items__item_id__get", "parameters": [ { "name": "item_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Item Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LibraryItemDetail" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/library/items/{item_id}/editions": { "get": { "summary": "List Editions", "operationId": "list_editions_library_items__item_id__editions_get", "parameters": [ { "name": "item_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Item Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/EditionView" }, "title": "Response List Editions Library Items Item Id Editions Get" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/documents/{source_id}/parse": { "post": { "summary": "Parse Document", "operationId": "parse_document_documents__source_id__parse_post", "parameters": [ { "name": "source_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Source Id" } } ], "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PipelineRunView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/documents/{document_id}": { "get": { "summary": "Get Document", "operationId": "get_document_documents__document_id__get", "parameters": [ { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Document Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ParsedDocumentDetail" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/sources/{source_id}/documents": { "get": { "summary": "List Source Documents", "operationId": "list_source_documents_sources__source_id__documents_get", "parameters": [ { "name": "source_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Source Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ParsedDocumentView" }, "title": "Response List Source Documents Sources Source Id Documents Get" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/documents/{document_id}/blocks": { "get": { "summary": "Get Document Blocks", "operationId": "get_document_blocks_documents__document_id__blocks_get", "parameters": [ { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Document Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ContentBlockView" }, "title": "Response Get Document Blocks Documents Document Id Blocks Get" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/documents/{document_id}/chapters": { "get": { "summary": "Get Document Chapters", "operationId": "get_document_chapters_documents__document_id__chapters_get", "parameters": [ { "name": "document_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Document Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ContentBlockView" }, "title": "Response Get Document Chapters Documents Document Id Chapters Get" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/editions/{edition_id}": { "get": { "summary": "Get Edition", "operationId": "get_edition_editions__edition_id__get", "parameters": [ { "name": "edition_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Edition Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EditionView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/editions/{edition_id}/audio": { "post": { "summary": "Create Audio", "operationId": "create_audio_editions__edition_id__audio_post", "parameters": [ { "name": "edition_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Edition Id" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAudioRequest" } } } }, "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAudioResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/audio-renders/{render_id}": { "get": { "summary": "Get Audio Render", "operationId": "get_audio_render_audio_renders__render_id__get", "parameters": [ { "name": "render_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Render Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AudioRenderView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/editions/{edition_id}/audio-renders": { "get": { "summary": "List Audio Renders", "operationId": "list_audio_renders_editions__edition_id__audio_renders_get", "parameters": [ { "name": "edition_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Edition Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/AudioRenderView" }, "title": "Response List Audio Renders Editions Edition Id Audio Renders Get" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/audio-parts/{part_id}/retry": { "post": { "summary": "Retry Audio Part", "operationId": "retry_audio_part_audio_parts__part_id__retry_post", "parameters": [ { "name": "part_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Part Id" } } ], "responses": { "202": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": { "type": "string" }, "title": "Response Retry Audio Part Audio Parts Part Id Retry Post" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/audio-parts/{part_id}/stream": { "get": { "summary": "Stream Audio Part", "operationId": "stream_audio_part_audio_parts__part_id__stream_get", "parameters": [ { "name": "part_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Part Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/jobs/{run_id}": { "get": { "summary": "Get Job", "operationId": "get_job_jobs__run_id__get", "parameters": [ { "name": "run_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Run Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PipelineRunView" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "AudioChunkView": { "properties": { "id": { "type": "string", "title": "Id" }, "position": { "type": "integer", "title": "Position" }, "status": { "type": "string", "title": "Status" }, "attempt_count": { "type": "integer", "title": "Attempt Count" }, "duration_ms": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Duration Ms" }, "error_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error Code" }, "error_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error Message" } }, "type": "object", "required": [ "id", "position", "status", "attempt_count", "duration_ms", "error_code", "error_message" ], "title": "AudioChunkView" }, "AudioPartView": { "properties": { "id": { "type": "string", "title": "Id" }, "position": { "type": "integer", "title": "Position" }, "batch_index": { "type": "integer", "title": "Batch Index" }, "title": { "type": "string", "title": "Title" }, "status": { "type": "string", "title": "Status" }, "duration_ms": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Duration Ms" }, "retry_count": { "type": "integer", "title": "Retry Count" }, "error_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error Code" }, "error_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error Message" }, "chunks": { "items": { "$ref": "#/components/schemas/AudioChunkView" }, "type": "array", "title": "Chunks" } }, "type": "object", "required": [ "id", "position", "batch_index", "title", "status", "duration_ms", "retry_count", "error_code", "error_message", "chunks" ], "title": "AudioPartView" }, "AudioRenderView": { "properties": { "id": { "type": "string", "title": "Id" }, "edition_id": { "type": "string", "title": "Edition Id" }, "status": { "type": "string", "title": "Status" }, "voice": { "type": "string", "title": "Voice" }, "rate": { "type": "string", "title": "Rate" }, "pitch": { "type": "string", "title": "Pitch" }, "provider": { "type": "string", "title": "Provider" }, "batch_size": { "type": "integer", "title": "Batch Size" }, "batch_count": { "type": "integer", "title": "Batch Count" }, "next_batch_index": { "type": "integer", "title": "Next Batch Index" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "parts": { "items": { "$ref": "#/components/schemas/AudioPartView" }, "type": "array", "title": "Parts" } }, "type": "object", "required": [ "id", "edition_id", "status", "voice", "rate", "pitch", "provider", "batch_size", "batch_count", "next_batch_index", "created_at", "parts" ], "title": "AudioRenderView" }, "Body_import_library_item_library_items_post": { "properties": { "title": { "type": "string", "maxLength": 500, "minLength": 1, "title": "Title" }, "content_type": { "type": "string", "enum": [ "novel", "technical", "article", "unknown" ], "title": "Content Type", "default": "unknown" }, "author": { "anyOf": [ { "type": "string", "maxLength": 300 }, { "type": "null" } ], "title": "Author" }, "file": { "anyOf": [ { "type": "string", "contentMediaType": "application/octet-stream" }, { "type": "null" } ], "title": "File" }, "pasted_text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Pasted Text" } }, "type": "object", "required": [ "title" ], "title": "Body_import_library_item_library_items_post" }, "ContentBlockView": { "properties": { "id": { "type": "string", "title": "Id" }, "parsed_document_id": { "type": "string", "title": "Parsed Document Id" }, "parent_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Parent Id" }, "position": { "type": "integer", "title": "Position" }, "block_type": { "type": "string", "title": "Block Type" }, "text": { "type": "string", "title": "Text" }, "source_start": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Source Start" }, "source_end": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Source End" }, "block_metadata": { "additionalProperties": true, "type": "object", "title": "Block Metadata" } }, "type": "object", "required": [ "id", "parsed_document_id", "parent_id", "position", "block_type", "text", "source_start", "source_end", "block_metadata" ], "title": "ContentBlockView" }, "CreateAudioRequest": { "properties": { "voice": { "type": "string", "title": "Voice", "default": "zh-CN-XiaoxiaoNeural" }, "rate": { "type": "string", "pattern": "^[+-]\\d+%$", "title": "Rate", "default": "+0%" }, "pitch": { "type": "string", "pattern": "^[+-]\\d+Hz$", "title": "Pitch", "default": "+0Hz" } }, "type": "object", "title": "CreateAudioRequest" }, "CreateAudioResponse": { "properties": { "render": { "$ref": "#/components/schemas/AudioRenderView" }, "run_id": { "type": "string", "title": "Run Id" } }, "type": "object", "required": [ "render", "run_id" ], "title": "CreateAudioResponse" }, "EditionBlockView": { "properties": { "id": { "type": "string", "title": "Id" }, "position": { "type": "integer", "title": "Position" }, "kind": { "type": "string", "title": "Kind" }, "text": { "type": "string", "title": "Text" }, "source_block_ids": { "items": { "type": "string" }, "type": "array", "title": "Source Block Ids" }, "section_title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Section Title" }, "audio_status": { "type": "string", "title": "Audio Status" } }, "type": "object", "required": [ "id", "position", "kind", "text", "source_block_ids", "section_title", "audio_status" ], "title": "EditionBlockView" }, "EditionView": { "properties": { "id": { "type": "string", "title": "Id" }, "library_item_id": { "type": "string", "title": "Library Item Id" }, "parsed_document_id": { "type": "string", "title": "Parsed Document Id" }, "edition_type": { "type": "string", "title": "Edition Type" }, "title": { "type": "string", "title": "Title" }, "full_text": { "type": "string", "title": "Full Text" }, "script_version": { "type": "string", "title": "Script Version" }, "status": { "type": "string", "title": "Status" }, "blocks": { "items": { "$ref": "#/components/schemas/EditionBlockView" }, "type": "array", "title": "Blocks" } }, "type": "object", "required": [ "id", "library_item_id", "parsed_document_id", "edition_type", "title", "full_text", "script_version", "status", "blocks" ], "title": "EditionView" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "ImportResponse": { "properties": { "item": { "$ref": "#/components/schemas/LibraryItemView" }, "source": { "$ref": "#/components/schemas/SourceDocumentView" }, "run_id": { "type": "string", "title": "Run Id" } }, "type": "object", "required": [ "item", "source", "run_id" ], "title": "ImportResponse" }, "LibraryItemDetail": { "properties": { "id": { "type": "string", "title": "Id" }, "title": { "type": "string", "title": "Title" }, "author": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Author" }, "content_type": { "type": "string", "title": "Content Type" }, "status": { "type": "string", "title": "Status" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "updated_at": { "type": "string", "format": "date-time", "title": "Updated At" }, "sources": { "items": { "$ref": "#/components/schemas/SourceDocumentView" }, "type": "array", "title": "Sources" } }, "type": "object", "required": [ "id", "title", "author", "content_type", "status", "created_at", "updated_at", "sources" ], "title": "LibraryItemDetail" }, "LibraryItemView": { "properties": { "id": { "type": "string", "title": "Id" }, "title": { "type": "string", "title": "Title" }, "author": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Author" }, "content_type": { "type": "string", "title": "Content Type" }, "status": { "type": "string", "title": "Status" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "updated_at": { "type": "string", "format": "date-time", "title": "Updated At" } }, "type": "object", "required": [ "id", "title", "author", "content_type", "status", "created_at", "updated_at" ], "title": "LibraryItemView" }, "ParsedDocumentDetail": { "properties": { "id": { "type": "string", "title": "Id" }, "source_document_id": { "type": "string", "title": "Source Document Id" }, "parser_version": { "type": "string", "title": "Parser Version" }, "document_type": { "type": "string", "title": "Document Type" }, "language": { "type": "string", "title": "Language" }, "status": { "type": "string", "title": "Status" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "blocks": { "items": { "$ref": "#/components/schemas/ContentBlockView" }, "type": "array", "title": "Blocks" } }, "type": "object", "required": [ "id", "source_document_id", "parser_version", "document_type", "language", "status", "created_at", "blocks" ], "title": "ParsedDocumentDetail" }, "ParsedDocumentView": { "properties": { "id": { "type": "string", "title": "Id" }, "source_document_id": { "type": "string", "title": "Source Document Id" }, "parser_version": { "type": "string", "title": "Parser Version" }, "document_type": { "type": "string", "title": "Document Type" }, "language": { "type": "string", "title": "Language" }, "status": { "type": "string", "title": "Status" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" } }, "type": "object", "required": [ "id", "source_document_id", "parser_version", "document_type", "language", "status", "created_at" ], "title": "ParsedDocumentView" }, "PipelineRunView": { "properties": { "id": { "type": "string", "title": "Id" }, "run_type": { "type": "string", "title": "Run Type" }, "root_entity_type": { "type": "string", "title": "Root Entity Type" }, "root_entity_id": { "type": "string", "title": "Root Entity Id" }, "status": { "type": "string", "title": "Status" }, "progress": { "type": "integer", "title": "Progress" }, "nodes": { "items": { "$ref": "#/components/schemas/TaskNodeView" }, "type": "array", "title": "Nodes" }, "created_at": { "type": "string", "format": "date-time", "title": "Created At" }, "updated_at": { "type": "string", "format": "date-time", "title": "Updated At" } }, "type": "object", "required": [ "id", "run_type", "root_entity_type", "root_entity_id", "status", "progress", "nodes", "created_at", "updated_at" ], "title": "PipelineRunView" }, "SourceDocumentView": { "properties": { "id": { "type": "string", "title": "Id" }, "library_item_id": { "type": "string", "title": "Library Item Id" }, "source_type": { "type": "string", "title": "Source Type" }, "original_filename": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Original Filename" }, "mime_type": { "type": "string", "title": "Mime Type" }, "content_hash": { "type": "string", "title": "Content Hash" }, "encoding": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Encoding" }, "parse_status": { "type": "string", "title": "Parse Status" } }, "type": "object", "required": [ "id", "library_item_id", "source_type", "original_filename", "mime_type", "content_hash", "encoding", "parse_status" ], "title": "SourceDocumentView" }, "TaskNodeView": { "properties": { "id": { "type": "string", "title": "Id" }, "parent_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Parent Id" }, "node_type": { "type": "string", "title": "Node Type" }, "status": { "type": "string", "title": "Status" }, "progress": { "type": "integer", "title": "Progress" }, "attempt_count": { "type": "integer", "title": "Attempt Count" }, "max_attempts": { "type": "integer", "title": "Max Attempts" }, "error_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error Code" }, "error_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Error Message" }, "started_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Started At" }, "heartbeat_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Heartbeat At" }, "finished_at": { "anyOf": [ { "type": "string", "format": "date-time" }, { "type": "null" } ], "title": "Finished At" } }, "type": "object", "required": [ "id", "parent_id", "node_type", "status", "progress", "attempt_count", "max_attempts", "error_code", "error_message", "started_at", "heartbeat_at", "finished_at" ], "title": "TaskNodeView" }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" }, "input": { "title": "Input" }, "ctx": { "type": "object", "title": "Context" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" } } } }