ส่งไฟล์เป็น base64 ในฟิลด์ document รูปภาพนับเป็นหนึ่งหน้า รูปแบบผลลัพธ์ทั้งสองแบบ ชนิดของบล็อก และขีดจำกัดจำนวนหน้ากับขนาดไฟล์อยู่ในคู่มือ OCR
เฮดเดอร์#
authorizationBearer pxa_...จำเป็นAuthorization: Bearer pxa_... (recommended).
x-api-keypxa_...Alternative to the Authorization header. Ignored when Authorization is present.
idempotency-keystringMakes a retry safe. Two requests carrying the same key charge once and synthesize the same content. One request per key runs at a time. A concurrent duplicate answers 409 idempotency_in_flight. Reuse a key only to retry an identical request. A changed payload is rejected with 422. Accepts up to 200 printable ASCII characters.
เนื้อหา#
documentstringจำเป็นThe document to read, as the base64 encoding of a PDF, PNG, JPEG, or WebP file. An image counts as one page. Cost is 6.5 credits per page, charged before reading and refunded automatically when reading fails. A PDF may carry up to 50 pages, and more answers 400 too_many_pages. The decoded file may be up to 10,485,760 bytes, and larger answers 413 document_too_large. A file that cannot be read as one of the four formats answers 400 document_invalid, and a PDF that needs a password to open answers 400 document_password_required. GET /v1/models reports the ceilings as max_pages and max_bytes.
modelstringจำเป็นOCR model id, for example paxa-ocr-lite-v1. GET /v1/models lists the served catalog.
output"markdown" or "structured"Shape of the result. "markdown", the default, returns each page as GitHub-flavored Markdown. "structured" returns each page as typed layout blocks, for callers that feed the reading into a pipeline.
การตอบกลับ#
The recognized document.
pagesarray of objectsจำเป็นOne entry per page of the document, in page order.
ดูฟิลด์ย่อยซ่อนฟิลด์ย่อย
pages[].pageintegerจำเป็นPage number, starting at 1. An image request has exactly one page.
pages[].markdownstringThe page's content as GitHub-flavored Markdown, in reading order. Present when output is "markdown". Join pages with a blank line to rebuild the document.
pages[].blocksarray of objectsThe page's content as typed blocks in reading order. Present when output is "structured".
ดูฟิลด์ย่อยซ่อนฟิลด์ย่อย
pages[].blocks[].typestringจำเป็นWhat the block is: "heading", "paragraph", "list", "table", or "figure". Blocks arrive in reading order.
pages[].blocks[].textstringThe block's text. Present on "heading", "paragraph", and "figure" blocks. A figure's text is its caption or nearby label, and is empty when it has none.
pages[].blocks[].levelintegerHeading depth, starting at 1 for the most prominent. Present on "heading" blocks.
pages[].blocks[].itemsarray of stringsThe list entries in order. Present on "list" blocks.
pages[].blocks[].rowsarray of array of stringssThe table cells as rows of column values, first row first. Present on "table" blocks.
usageobjectจำเป็นWhat the request was billed for.
ดูฟิลด์ย่อยซ่อนฟิลด์ย่อย
usage.pagesintegerจำเป็นPages this request was billed for.
usage.creditsnumberจำเป็นWhat this delivery cost, in credits, exact to a hundredth. An idempotent replay reports the ORIGINAL request's charge, since that one charge is what paid for this delivery too; your balance moves only once.