Supported file formats
POST /ai/extract supports the following file formats. This list matches the Box Extract API file types also used by Custom Extract Agents.
Images
Images
bmp, cr2, crw, dcm, dicm, dicom, dng, gif, heic, jpeg, jpg, nef, png, raf, raw, svg, tga, tif, tiff, webp
Design and CAD
Design and CAD
ai, dwg, eps, ps, psd, xbd, xdw
Documents
Documents
boxcanvas, boxnote, doc, docx, gdoc, msg, odt, pages, pdf, rtf, webdoc, wpd
Presentations
Presentations
gslide, gslides, key, odp, ppt, pptx
Spreadsheets
Spreadsheets
csv, gsheet, numbers, ods, tsv, xls, xlsm, xlsx
Code and text
Code and text
as, as3, asm, bat, c, cc, cmake, cpp, cs, css, cxx, diff, erb, groovy, h, haml, hh, htm, html, java, js, json, less, log, m, make, md, ml, mm, php, pl, plist, properties, py, rb, rst, sass, scala, scm, script, sh, sml, sql, txt, vi, vim, xhtml, xml, xsd, xsl, yaml
The Extract metadata (freeform) endpoint doesn’t apply OCR, so it can’t read text that exists only inside an image or a scanned page. For scanned documents, photos, or documents in languages other than English, use the endpoint, which applies OCR automatically.
Before you start
Make sure you followed the steps listed in to create a platform app and authenticate.Send a request
To send a request, use thePOST /2.0/ai/extract endpoint.
Parameters
To make a call, you must pass the following parameters. Mandatory parameters are in bold. Theitems array can contain up to 25 elements, which are processed together into a single answer. For prompt and file limits, see .
Use cases
This example shows you how to extract metadata from a sample invoice.Create the request
To get the response from Box AI, call thePOST /2.0/ai/extract endpoint with the following parameters:
promptthat can be a query, or a structured or unstructured list of fields to extract.typeandidof the file to extract the data from.
Create the prompt
Depending on the use case and the level of detail, you can construct various prompts.Use plain text
Because this endpoint allows freeform prompts, you can use plain text to get the information.Use specific terms
If you don’t want to write the entire sentence, the prompt can consist of terms that you expect to find in an invoice:Use key-value pairs
The prompt can also be a list of key-value pairs that helps Box AI to come up with the metadata structure. This approach requires listing the key-value pairs within afields array.
fields present in the file, along with their values:
