Join us on May 20th for the Content + AI Virtual Summit. Register now
curl -i -L -X POST "https://api.box.com/2.0/ai/ask" \
-H "content-type: application/json" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"mode": "single_item_qa",
"prompt": "What is the value provided by public APIs based on this document?",
"items": [
{
"type": "file",
"id": "9842787262"
}
],
"dialogue_history": [
{
"prompt": "Make my email about public APIs sound more professional",
"answer": "Here is the first draft of your professional email about public APIs",
"created_at": "2013-12-12T10:53:43-08:00"
}
],
"include_citations": true,
"ai_agent": {
"type": "ai_agent_ask",
"long_text": {
"model": "azure__openai__gpt_4o_mini",
"prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?"
},
"basic_text": {
"model": "azure__openai__gpt_4o_mini"
}
}
}'{
"answer": "Public APIs are important because of key and important reasons.",
"created_at": "2012-12-12T10:53:43-08:00",
"completion_reason": "done",
"ai_agent_info": {
"models": [
{
"name": "azure__openai__text_embedding_ada_002",
"provider": "azure",
"supported_purpose": "embedding"
}
],
"processor": "basic_text"
},
"citations": [
{
"content": "Public APIs are key drivers of innovation and growth.",
"id": "123",
"type": "file",
"name": "The importance of public APIs.pdf"
}
]
}Sends an AI request to supported LLMs and returns an answer specifically focused on the user’s question given the provided context.
curl -i -L -X POST "https://api.box.com/2.0/ai/ask" \
-H "content-type: application/json" \
-H "authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"mode": "single_item_qa",
"prompt": "What is the value provided by public APIs based on this document?",
"items": [
{
"type": "file",
"id": "9842787262"
}
],
"dialogue_history": [
{
"prompt": "Make my email about public APIs sound more professional",
"answer": "Here is the first draft of your professional email about public APIs",
"created_at": "2013-12-12T10:53:43-08:00"
}
],
"include_citations": true,
"ai_agent": {
"type": "ai_agent_ask",
"long_text": {
"model": "azure__openai__gpt_4o_mini",
"prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?"
},
"basic_text": {
"model": "azure__openai__gpt_4o_mini"
}
}
}'{
"answer": "Public APIs are important because of key and important reasons.",
"created_at": "2012-12-12T10:53:43-08:00",
"completion_reason": "done",
"ai_agent_info": {
"models": [
{
"name": "azure__openai__text_embedding_ada_002",
"provider": "azure",
"supported_purpose": "embedding"
}
],
"processor": "basic_text"
},
"citations": [
{
"content": "Public APIs are key drivers of innovation and growth.",
"id": "123",
"type": "file",
"name": "The importance of public APIs.pdf"
}
]
}Documentation Index
Fetch the complete documentation index at: https://developer.box.com/llms.txt
Use this file to discover all available pages before exploring further.
The access token received from the authorization server in the OAuth 2.0 flow.
AI ask request object.
Box AI handles text documents with text representations up to 1MB in size, or a maximum of 25 files, whichever comes first. If the text file size exceeds 1MB, the first 1MB of text representation will be processed. Box AI handles image documents with a resolution of 1024 x 1024 pixels, with a maximum of 5 images or 5 pages for multi-page images. If the number of image or image pages exceeds 5, the first 5 images or pages will be processed. If you set mode parameter to single_item_qa, the items array can have one element only. Currently Box AI does not support multi-modal requests. If both images and text are sent Box AI will only process the text.
multiple_item_qa, single_item_qa "multiple_item_qa"
The prompt provided by the client to be answered by the LLM. The prompt's length is limited to 10000 characters.
"What is the value provided by public APIs based on this document?"
The items to be processed by the LLM, often files.
1 - 25 elementsShow child attributes
The history of prompts and answers previously passed to the LLM. This provides additional context to the LLM in generating the response.
Show child attributes
A flag to indicate whether citations should be returned.
true
The AI agent to be used to handle the request.
Show child attributes
A successful response including the answer from the LLM.
AI ask response.
The answer provided by the LLM.
"Public APIs are important because of key and important reasons."
The ISO date formatted timestamp of when the answer to the prompt was created.
"2012-12-12T10:53:43-08:00"
The reason the response finishes.
"done"
The information on the models and processors used in the request.
Show child attributes
The citations of the LLM's answer reference.
Show child attributes
Was this page helpful?