Box AI API is available to all customers Business and above.
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 containing your question, use thePOST /2.0/ai/ask endpoint and
provide the mandatory parameters.
Parameters
To make a call, you need to pass the following parameters. Mandatory parameters are in bold.Use cases
Ask questions about an item
This example shows how to ask a question about one or more items using thePOST ask/ai API. When using this endpoint, remember to specify the mode parameter depending on the number of items you want to supply.
Ask questions about a hub
Instead of supplying individual files, you can point Box AI at an entire and ask questions across all of its curated content. This is useful for knowledge bases such as RFP answer banks, policy libraries, and product documentation portals, where you want natural language answers grounded in an approved set of materials without managing file IDs yourself. To query a hub, setitems.type to hubs and items.id to the hub ID. A hub must be supplied as the only item in the request. The example below uses single_item_qa mode, which is the pattern shown in the .
Ask questions with content parameter
If you use the content parameter as the source of input for Box AI, it will use it as the primary source.
content parameter instead of the file’s content:
Ask questions with citations parameter
Setting the citations parameter to true causes the response to include excerpts from source file or files Box AI used to compile the answer.
