> ## 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.

# Build RAG over enterprise documents stored in Box

> Build retrieval-augmented generation (RAG) over documents in Box. Start with Box Hubs and Box AI Ask for permission-aware answers. Export to Pinecone or Weaviate, or use LangChain, when you need a custom retrieval stack.

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const SignupCTA = ({children}) => {
  return <div className="flex flex-wrap items-center gap-4 p-5 rounded-lg border border-gray-200 dark:border-gray-700 my-6" style={{
    background: "linear-gradient(135deg, rgba(0, 97, 213, 0.06), rgba(0, 97, 213, 0.02))"
  }}>
      <div className="flex-1 text-sm leading-relaxed text-gray-700 dark:text-gray-300" style={{
    minWidth: "280px"
  }}>
        {children}
      </div>
      <div className="flex flex-col items-center gap-2">
        <a href="https://account.box.com/signup/developer#ty9l3" className="signup-cta-button inline-flex items-center whitespace-nowrap px-5 py-2 text-sm font-semibold text-white no-underline">
          {translate("Get started for free")}
        </a>
        <a href="https://account.box.com/developers/console" className="signup-cta-login text-xs text-gray-500 dark:text-gray-400 no-underline whitespace-nowrap">
          {translate("Already have an account? Log in")}
        </a>
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

Start with **Box-managed retrieval**: add files to a <Link href="/guides/hubs-api">Box Hub</Link> and call <Link href="/guides/box-ai/ai-tutorials/ask-questions#ask-questions-about-a-hub">Box AI Ask</Link>. Box retrieves content, grounds the answer, and checks the requesting user's permissions. You do not operate your own embedding pipeline or vector database for that path.

Build your own pipeline (chunk, embed, store, generate) only when Box-managed retrieval does not cover your use case.

<SignupCTA>
  A free developer account gives you access to the Box AI API, Hubs, and the content APIs you need to test both paths.
</SignupCTA>

## Which approach to use

| If you need…                                                                                         | Do this                                                                                                         |
| ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| Answers on documents already in Box, with citations and the same permissions as the web app          | Hub + <Link href="/reference/post-ai-ask">`POST /2.0/ai/ask`</Link>                                             |
| A governed knowledge base (staging, approval, then query)                                            | <Link href="/guides/hubs-api/access-controlled-knowledge-base">Access-controlled AI knowledge base</Link>       |
| An index that mixes Box with other sources, a custom embedding model, or custom chunking and ranking | Export Box content to LangChain, LlamaIndex, Pinecone, or Weaviate. Enforce permissions in your retrieval layer |

## Box-managed retrieval

Box AI Ask with a hub as the item:

* Indexes hub content. No vector store to host.
* Returns answers only from files the calling user or app can access.
* Includes citations to source files.
* Stays current as files and hub items change. No re-index job to run.

For a full walkthrough, see <Link href="/guides/hubs-api/access-controlled-knowledge-base">Access-controlled AI knowledge base</Link>. For working apps, see the <Link href="/tutorials/sales-rfp-answer-bank">RFP answer bank</Link> and <Link href="/tutorials/company-brain">company brain</Link> tutorials.

## Your own RAG pipeline

Export from Box when you need:

* A retrieval engine or embedding model Box AI does not offer.
* A single index that combines Box documents with other sources.
* Custom chunking, ranking, or evaluation.
* Model hosting you control.

Typical flow:

1. Choose folders or files the application can read. Do not index the enterprise root.
2. Pull text with Box representations or your own parsers. See the <Link href="/ai/vector-databases/pinecone">Pinecone</Link> and <Link href="/ai/vector-databases/weaviate">Weaviate</Link> tutorials.
3. Chunk text, generate embeddings, and store vectors with Box file IDs and permission metadata.
4. At query time, embed the question, search the index, then drop chunks the current user cannot access in Box.
5. Send the question plus allowed chunks to an LLM. Cite Box file IDs in the answer.

Framework loaders: <Link href="/ai/integrations">LangChain, LangChain.js, and LlamaIndex</Link>.

## Keep an exported index permission-aware

Box does not enforce permissions inside Pinecone, Weaviate, or your LLM prompt. After you copy text out of Box, your service is responsible for access control.

At a minimum:

* Store the Box file ID and version ID on every vector.
* Before returning results, check the querying user's Box permissions. Drop chunks from files the user cannot open.
* Refresh the index when files, collaborations, or sharing change. Use <Link href="/guides/events">events</Link> or <Link href="/guides/webhooks">webhooks</Link>, not a one-time crawl.
* Re-check access at query time even if you cached permissions at index time. Sharing changes faster than most batch jobs.

If your main requirement is permission-aware answers and the content is already in Box, use hubs and Ask instead. See <Link href="/guides/getting-started/why-box#box-managed-retrieval-or-your-own-rag-pipeline">Box-managed retrieval or your own RAG pipeline</Link>.

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Access-controlled AI knowledge base"), href: "/guides/hubs-api/access-controlled-knowledge-base", badge: "GUIDE" },
{ label: translate("AI integrations"), href: "/ai/integrations", badge: "GUIDE" },
{ label: translate("Box and Pinecone"), href: "/ai/vector-databases/pinecone", badge: "GUIDE" },
{ label: translate("Box and Weaviate"), href: "/ai/vector-databases/weaviate", badge: "GUIDE" },
{ label: translate("Permission-aware agent access"), href: "/guides/box-mcp/permission-aware-access", badge: "GUIDE" }
]}
/>
