Skip to main content

Read File

POST 

/v1/files/:file_id/read

What a file says, one bounded page at a time; never the file's bytes.

By kind:

  • table (CSV, Excel): sheets, each with its name, rowCount, columns with an inferred type (integer, number, boolean, date, datetime, text) and a page of rows. sheet narrows a workbook to one sheet; headerRow names the row that holds the column names when it is not the first.
  • text (Word, PowerPoint, plain text): a page of the text, with totalChars and hasMore.
  • ocr (a photo, a scan, a screenshot, a PDF): ocr holds the reading of a vision model, as data: pages (the text), tables (header and rows) and fields (dates, amounts, totals, names, typed). The first read of a picture runs the model, chosen as the cheapest that can see among the model sets the account offers, and is billed in credits like an assistant model call (402 no_credits when the account has none); the reading is kept with the file, and every later read answers it at no cost (cached: true). With ocr: false only a kept reading is answered. OCR reads images: a PDF is answered with status: unavailable and how to read its pages as images.

offset and limit page rows (20 by default, at most 500) or characters (20000 by default, at most 100000). Needs the right to see the file: its folder's datasets, or having uploaded it. A sheet that is not in the workbook is 422 sheet_not_found, naming the sheets that are.

Request​

Responses​

Successful Response