Make a request
Get an API key in the Quickstart. This request reads the first two pages of a research paper and marks where each page starts.Read the response
The text is indata.markdown. Page 2 starts after a --- line and a <!-- page 2 --> marker. This real response is cut. Each page’s text is shortened.
contentType says what the file is. totalPages is the pages in the file, and ocrPages appears when some pages were read from their picture. A PDF always comes back as Markdown.
Options
Send the PDF options inparsers, as "pdf" or as an object.
Stophy reads the picture of at most 20 pages per call, in
auto or ocr mode. Without an API key, only the text layer is read.
Other documents
- A CSV file comes back as a Markdown table, and so does each sheet of an Excel
.xlsxfile. The first row becomes the table header. - A Word
.docxor PowerPoint.pptxfile comes back as Markdown text. - The older
.doc,.xlsand.pptformats cannot be read.
https://data.giss.nasa.gov/gistemp/tabledata_v4/GLB.Ts+dSST.csv, read with "maxChars": 500, returned a table. This real response is cut to the fields that matter. The file’s first line is a title, so the title is the table header.
Limits and errors
- A file larger than 20 MB, or one that is too large once unpacked, returns
400 invalidRequestand says so. - A password-protected file, a file that cannot be opened, and a URL that is an image or another download return
400 invalidRequestand name the problem. - A PDF that takes too long to read returns
400 invalidRequestand suggests a smallermaxPages. - Combine
maxCharsandoffsetto read a long document part by part. See Content filtering.
Price
$1 per 1,000 pages for the read, plus $0.50 per 1,000 pages of PDF text from its text layer and $2.50 per 1,000 pages of text read from its picture, that come back. The example above read 2 pages of a PDF from their text layer and cost $0.002. A PDF read withmaxChars, offset or query is charged for the share of its pages that it returns, at least 1 page. A file that cannot be read costs nothing.
Related
- Parse documents turns a file you upload into Markdown.
- Content filtering cuts a long document into parts.
- Page metadata explains
numPages,totalPagesandocrPages. - Scrape overview lists every format and option.