-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.json
1 lines (1 loc) · 14.6 KB
/
openapi.json
1
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/v1/health":{"get":{"tags":["api"],"summary":"Health","description":"This endpoint is used to check the health of the API. Returns a JSON object with the key \"status\" set to \"ok\".","operationId":"health_api_v1_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/v1/marker":{"post":{"tags":["api"],"summary":"Marker","description":"This endpoint is used to submit a PDF file for conversion to markdown. A PDF file must be uploaded, and the X-API-Key header must be set to the team's API key.\nfile is the PDF file to be converted to markdown.\nReturns the converted markdown file and base64 encoded image files.","operationId":"marker_api_v1_marker_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_marker_api_v1_marker_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InitialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/api/v1/marker/{request_id}":{"get":{"tags":["api"],"summary":"Marker Response","operationId":"marker_response_api_v1_marker__request_id__get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"integer","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkerFinalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/layout":{"post":{"tags":["api"],"summary":"Layout","description":"This endpoint is used to submit a PDF or image for layout and reading order detection. The detected layout bboxes on the page will be returned, along with their predicted reading order and layout labels. More information about the return data and labels is here - https://github.com/VikParuchuri/surya?tab=readme-ov-file#layout-analysis .","operationId":"layout_api_v1_layout_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_layout_api_v1_layout_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InitialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/api/v1/layout/{request_id}":{"get":{"tags":["api"],"summary":"Layout Response","operationId":"layout_response_api_v1_layout__request_id__get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"integer","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LayoutFinalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/line_detection":{"post":{"tags":["api"],"summary":"Line Detection","description":"This endpoint is used to submit a PDF or image for line detection. The detected text lines on the page will be returned, along with their bbox and polygon coordinates.","operationId":"line_detection_api_v1_line_detection_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_line_detection_api_v1_line_detection_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InitialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/api/v1/line_detection/{request_id}":{"get":{"tags":["api"],"summary":"Line Detection Response","operationId":"line_detection_response_api_v1_line_detection__request_id__get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"integer","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LineDetectionFinalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ocr":{"post":{"tags":["api"],"summary":"Ocr","description":"This endpoint is used to submit a PDF or image for OCR. The OCR text lines will be returned, along with their bbox and polygon coordinates. You can submit up to 4 languages used in the document for OCR.","operationId":"ocr_api_v1_ocr_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_ocr_api_v1_ocr_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InitialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/api/v1/ocr/{request_id}":{"get":{"tags":["api"],"summary":"Ocr Response","operationId":"ocr_response_api_v1_ocr__request_id__get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"integer","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OCRFinalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_layout_api_v1_layout_post":{"properties":{"max_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Pages","description":"The maximum number of pages in the PDF to convert."},"file":{"type":"string","format":"binary","title":"File","description":"Input PDF, word document, powerpoint, or image file, uploaded as multipart form data. Images must be png, jpg, or webp format."}},"type":"object","required":["file"],"title":"Body_layout_api_v1_layout_post"},"Body_line_detection_api_v1_line_detection_post":{"properties":{"max_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Pages","description":"The maximum number of pages in the PDF to convert."},"file":{"type":"string","format":"binary","title":"File","description":"Input PDF, word document, powerpoint, or image file, uploaded as multipart form data. Images must be png, jpg, or webp format."}},"type":"object","required":["file"],"title":"Body_line_detection_api_v1_line_detection_post"},"Body_marker_api_v1_marker_post":{"properties":{"max_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Pages","description":"The maximum number of pages in the PDF to convert."},"langs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Langs","description":"The languages to use if OCR is needed, comma separated. Must be either the names or codes from https://github.com/VikParuchuri/surya/blob/master/surya/languages.py. Any other inputs will be ignored. Defaults to 'en' if not provided."},"force_ocr":{"type":"boolean","title":"Force Ocr","description":"Force OCR on all pages of the PDF. Defaults to False. This can lead to worse results if you have good text in your PDFs (which is true in most cases).","default":false},"paginate":{"type":"boolean","title":"Paginate","description":"Whether to paginate the output. Defaults to False. If set to True, each page of the output will be separated by a horizontal rule (2 newlines, 16 - characters, 2 newlines).","default":false},"extract_images":{"type":"boolean","title":"Extract Images","description":"Whether to extract images from the PDF. Defaults to True. If set to False, no images will be extracted from the PDF.","default":true},"file":{"type":"string","format":"binary","title":"File","description":"Input PDF, word document, or powerpoint, uploaded as multipart form data."}},"type":"object","required":["file"],"title":"Body_marker_api_v1_marker_post"},"Body_ocr_api_v1_ocr_post":{"properties":{"max_pages":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Pages","description":"The maximum number of pages in the PDF to convert."},"langs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Langs","description":"The languages to use for OCR, comma separated. Can be up to 4 languages. Must be either the names or codes from https://github.com/VikParuchuri/surya/blob/master/surya/languages.py. Any other inputs will be ignored. Defaults to 'en' if not provided."},"file":{"type":"string","format":"binary","title":"File","description":"Input PDF, word document, powerpoint, or image file, uploaded as multipart form data. Images must be png, jpg, or webp format."}},"type":"object","required":["file"],"title":"Body_ocr_api_v1_ocr_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status","description":"The status of the service. Should be 'ok' if the service is running correctly."}},"type":"object","required":["status"],"title":"HealthResponse"},"InitialResponse":{"properties":{"success":{"type":"boolean","title":"Success","description":"Whether the request was successful.","default":true},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"If the request was not successful, this will contain an error message."},"request_id":{"type":"integer","title":"Request Id","description":"The ID of the request. This ID can be used to check the status of the request."},"request_check_url":{"type":"string","title":"Request Check Url","description":"The URL to check the status of the request and get results."}},"type":"object","required":["request_id","request_check_url"],"title":"InitialResponse"},"LayoutFinalResponse":{"properties":{"status":{"type":"string","title":"Status","description":"The status of the request. Should be 'complete' when the request is done."},"pages":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Pages","description":"The detected layout bboxes and reading order. Each item in the list represents all the bboxes in a page, in order. Images have only a single page."},"success":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Success","description":"Whether the conversion was successful."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"If the conversion was not successful, this will contain an error message."},"page_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page Count","description":"The number of pages that had layout run on them."}},"type":"object","required":["status"],"title":"LayoutFinalResponse"},"LineDetectionFinalResponse":{"properties":{"status":{"type":"string","title":"Status","description":"The status of the request. Should be 'complete' when the request is done."},"pages":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Pages","description":"The detected text lines on each page. Each item in the list represents all the bboxes in a page, in order. Images have only a single page."},"success":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Success","description":"Whether the conversion was successful."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"If the conversion was not successful, this will contain an error message."},"page_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page Count","description":"The number of pages that had line detection run on them."}},"type":"object","required":["status"],"title":"LineDetectionFinalResponse"},"MarkerFinalResponse":{"properties":{"status":{"type":"string","title":"Status","description":"The status of the request. Should be 'complete' when the request is done."},"markdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Markdown","description":"The markdown representation of the PDF."},"images":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Images","description":"A dictionary of the images in the PDF, where the key is the filename for the image, and the value is the base64 encoded image. Images should be stored in the same directory as the PDF."},"meta":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Meta","description":"A dictionary of metadata about the PDF and the conversion process."},"success":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Success","description":"Whether the conversion was successful."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"If the conversion was not successful, this will contain an error message."},"page_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page Count","description":"The number of pages that were converted."}},"type":"object","required":["status"],"title":"MarkerFinalResponse"},"OCRFinalResponse":{"properties":{"status":{"type":"string","title":"Status","description":"The status of the request. Should be 'complete' when the request is done."},"pages":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Pages","description":"The detected OCR text on each page. Each page will have the bboxes and detected text within each line."},"success":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Success","description":"Whether the conversion was successful."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"If the conversion was not successful, this will contain an error message."},"page_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page Count","description":"The number of pages that had ocr run on them."}},"type":"object","required":["status"],"title":"OCRFinalResponse"},"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"}},"securitySchemes":{"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"}}}}