{"openapi":"3.1.0","info":{"title":"PereStruct API","description":"Разбор сканов советских газет на логические статьи. Сервис выполняет детекцию блоков YOLO, OCR, коррекцию OCR через YandexGPT, ML-сборку статей и создаёт цветную визуализацию результата.","contact":{"name":"PereStruct"},"version":"1.0.0"},"paths":{"/api/auth/me":{"get":{"tags":["Авторизация"],"summary":"Auth Me","operationId":"auth_me_api_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Auth Me Api Auth Me Get"}}}}}}},"/api/health":{"get":{"tags":["Сервис"],"summary":"Health","operationId":"health_api_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Api Health Get"}}}}}}},"/api/info":{"get":{"tags":["Сервис"],"summary":"Info","operationId":"info_api_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Info Api Info Get"}}}}}}},"/api/example":{"get":{"tags":["Сервис"],"summary":"Example Image","operationId":"example_image_api_example_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"object","title":"Response Example Image Api Example Get"}}}}}}},"/api/examples":{"get":{"tags":["Сервис"],"summary":"Example Gallery","description":"Return curated, quota-free examples with fresh signed artifact links.","operationId":"example_gallery_api_examples_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Example Gallery Api Examples Get"}}}}}}},"/api/examples/{example_id}/result":{"get":{"tags":["Сервис"],"summary":"Example Result","operationId":"example_result_api_examples__example_id__result_get","parameters":[{"name":"example_id","in":"path","required":true,"schema":{"type":"string","title":"Example Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/uploads":{"post":{"tags":["Обработка"],"summary":"Prepare Upload","operationId":"prepare_upload_api_uploads_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/batches/uploads":{"post":{"tags":["Обработка"],"summary":"Подготовить параллельную загрузку нескольких газетных полос","operationId":"prepare_batch_upload_api_batches_uploads_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchUploadRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/batches/{batch_id}/process":{"post":{"tags":["Обработка"],"summary":"Запустить отдельную DataSphere Job для каждой полосы","operationId":"process_batch_api_batches__batch_id__process_post","parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","title":"Batch Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchProcessRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/batches/{batch_id}":{"get":{"tags":["Обработка"],"summary":"Получить агрегированный статус всех полос","operationId":"get_batch_api_batches__batch_id__get","parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","title":"Batch Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/process":{"post":{"tags":["Обработка"],"summary":"Запустить обработку загруженной газетной полосы","operationId":"process_api_process_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/jobs/{job_id}":{"get":{"tags":["Обработка"],"summary":"Get Job","operationId":"get_job_api_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/jobs/{job_id}/reprocess":{"post":{"tags":["Редактирование"],"summary":"Исправить разметку и повторно запустить распознавание","operationId":"reprocess_job_api_jobs__job_id__reprocess_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReprocessRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReprocessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/jobs/{job_id}/edits":{"put":{"tags":["Редактирование"],"summary":"Сохранить пользовательскую редакцию распознанного текста","operationId":"save_text_edits_api_jobs__job_id__edits_put","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveTextEditsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ArtifactLinks":{"properties":{"source_image":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Image"},"layout_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Layout Json"},"layout_png":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Layout Png"},"ocr_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ocr Json"},"corrected_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Corrected Json"},"assembly_scores_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assembly Scores Json"},"result_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result Json"},"edited_result_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Edited Result Json"},"visualization_png":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visualization Png"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["expires_in"],"title":"ArtifactLinks"},"BatchProcessRequest":{"properties":{"threshold":{"type":"number","maximum":0.95,"minimum":0.05,"title":"Threshold","default":0.5}},"type":"object","title":"BatchProcessRequest"},"BatchResponse":{"properties":{"batch_id":{"type":"string","title":"Batch Id"},"status":{"type":"string","enum":["queued","running","completed","failed"],"title":"Status"},"total":{"type":"integer","title":"Total"},"queued":{"type":"integer","title":"Queued"},"running":{"type":"integer","title":"Running"},"completed":{"type":"integer","title":"Completed"},"failed":{"type":"integer","title":"Failed"},"progress_percent":{"type":"number","title":"Progress Percent"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threshold"},"jobs":{"items":{"$ref":"#/components/schemas/JobResponse"},"type":"array","title":"Jobs"}},"type":"object","required":["batch_id","status","total","queued","running","completed","failed","progress_percent","jobs"],"title":"BatchResponse"},"BatchUploadItem":{"properties":{"job_id":{"type":"string","title":"Job Id"},"object_key":{"type":"string","title":"Object Key"},"upload_url":{"type":"string","title":"Upload Url"},"status_url":{"type":"string","title":"Status Url"},"method":{"type":"string","const":"PUT","title":"Method","default":"PUT"},"expires_in":{"type":"integer","title":"Expires In"},"filename":{"type":"string","title":"Filename"},"page_index":{"type":"integer","title":"Page Index"}},"type":"object","required":["job_id","object_key","upload_url","status_url","expires_in","filename","page_index"],"title":"BatchUploadItem"},"BatchUploadRequest":{"properties":{"files":{"items":{"$ref":"#/components/schemas/UploadRequest"},"type":"array","maxItems":20,"minItems":1,"title":"Files"}},"type":"object","required":["files"],"title":"BatchUploadRequest"},"BatchUploadResponse":{"properties":{"batch_id":{"type":"string","title":"Batch Id"},"uploads":{"items":{"$ref":"#/components/schemas/BatchUploadItem"},"type":"array","title":"Uploads"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["batch_id","uploads","total"],"title":"BatchUploadResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"JobResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"batch_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Batch Id"},"page_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page Index"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Filename"},"status":{"type":"string","enum":["queued","running","completed","failed"],"title":"Status"},"stage":{"anyOf":[{"type":"string","enum":["upload","layout","ocr","correction","assembly","completed","failed"]},{"type":"null"}],"title":"Stage"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"deadline_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deadline At"},"execution_timeout_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Execution Timeout Seconds"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds"},"pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Pages"},"blocks":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Blocks"},"articles":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Articles"},"edited_blocks":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Edited Blocks"},"edited_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Edited At"},"threshold":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Threshold"},"source_job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Job Id"},"rotation_degrees":{"anyOf":[{"type":"integer","enum":[0,90,180,270]},{"type":"null"}],"title":"Rotation Degrees"},"manual_merge_groups":{"anyOf":[{"items":{"items":{"type":"integer"},"type":"array"},"type":"array"},{"type":"null"}],"title":"Manual Merge Groups"},"cache_hit":{"type":"boolean","title":"Cache Hit","default":false},"cached_from_job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cached From Job Id"},"pipeline":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Pipeline"},"stages":{"anyOf":[{"additionalProperties":{"additionalProperties":true,"type":"object"},"type":"object"},{"type":"null"}],"title":"Stages"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"artifacts":{"anyOf":[{"$ref":"#/components/schemas/ArtifactLinks"},{"type":"null"}]}},"type":"object","required":["job_id","status"],"title":"JobResponse"},"ProcessRequest":{"properties":{"job_id":{"type":"string","pattern":"^[0-9a-f]{32}$","title":"Job Id"},"object_key":{"type":"string","pattern":"^uploads/[0-9a-f]{32}\\.jpg$","title":"Object Key"},"threshold":{"type":"number","maximum":0.95,"minimum":0.05,"title":"Threshold","default":0.5}},"type":"object","required":["job_id","object_key"],"title":"ProcessRequest"},"ReprocessRequest":{"properties":{"rotation_degrees":{"type":"integer","enum":[0,90,180,270],"title":"Rotation Degrees","default":0},"merge_groups":{"items":{"items":{"type":"integer"},"type":"array"},"type":"array","maxItems":100,"title":"Merge Groups"},"threshold":{"type":"number","maximum":0.95,"minimum":0.05,"title":"Threshold","default":0.5}},"type":"object","title":"ReprocessRequest"},"ReprocessResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"source_job_id":{"type":"string","title":"Source Job Id"},"status":{"type":"string","const":"queued","title":"Status","default":"queued"},"status_url":{"type":"string","title":"Status Url"}},"type":"object","required":["job_id","source_job_id","status_url"],"title":"ReprocessResponse"},"SaveTextEditsRequest":{"properties":{"edits":{"items":{"$ref":"#/components/schemas/TextEdit"},"type":"array","maxItems":1000,"title":"Edits"}},"type":"object","required":["edits"],"title":"SaveTextEditsRequest"},"TextEdit":{"properties":{"page_index":{"type":"integer","minimum":0.0,"title":"Page Index"},"label_index":{"type":"integer","minimum":0.0,"title":"Label Index"},"text":{"type":"string","maxLength":100000,"title":"Text"}},"type":"object","required":["page_index","label_index","text"],"title":"TextEdit"},"UploadRequest":{"properties":{"filename":{"type":"string","maxLength":255,"minLength":1,"title":"Filename","examples":["page.jpg"]},"content_type":{"type":"string","enum":["image/jpeg","image/jpg"],"title":"Content Type","default":"image/jpeg"},"size_bytes":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Size Bytes"}},"type":"object","required":["filename"],"title":"UploadRequest"},"UploadResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"object_key":{"type":"string","title":"Object Key"},"upload_url":{"type":"string","title":"Upload Url"},"status_url":{"type":"string","title":"Status Url"},"method":{"type":"string","const":"PUT","title":"Method","default":"PUT"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["job_id","object_key","upload_url","status_url","expires_in"],"title":"UploadResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}