Skip to content
Browse all functions

RAG – Add Document to Knowledge Base

rag/adddocument

adddocument (RAG – Add Document to Knowledge Base) is a 1001fx API function in the group Knowledge bases (RAG): POST https://api.1001fx.com/rag/adddocument, 1 credit per 1,000 tokens (minimum 1). It works as a ready-made module in Make or as a plain HTTP call.

Adds a document (PDF, Word, PowerPoint, Excel, OpenDocument, HTML, text, Markdown, CSV; scans and images with useOcr) to a knowledge base, which is created on first use. The text is split into passages and embedded for rag/search and rag/ask. The same documentId replaces the document; unchanged content is not read again (0 credits). Costs 1 credit per 1,000 tokens read, plus the storage until the end of the month (1 credit per MB and month above 10 MB free per account, result.storageCredits). For large documents send the call with the header x-fx-webhook (runs in the background).

Endpoint

POSThttps://api.1001fx.com/rag/adddocument
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
multipart/form-data

Parameters

  • knowledgeBasestringrequired

    Name or ID of the knowledge base, e.g. "Support FAQ" or support-faq (same knowledge base). rag/adddocument creates it if it does not exist.

    Example:
    Support FAQ
  • filefileoptional

    The document. Either file or fileUrl.

  • fileUrlstringoptional

    Public URL of the document. Either file, fileUrl or text.

    Example:
    https://api.1001fx.com/testdata/sample.pdf
  • textstringoptional

    The content as text (or Markdown). Either file, fileUrl or text.

  • titlestringoptional

    Shown in the sources of rag/ask. Default: the title of the file or its name.

  • sourceUrlstringoptional

    Link to the original, e.g. in Google Drive – returned with the sources.

  • lastModifiedstringoptional

    ISO 8601, e.g. modifiedTime of the Drive file. Default: from the file (Last-Modified header, PDF/Office properties) or now.

  • authorstringoptional

    Default: from the file properties.

  • useOcrbooleanoptional

    For scans and images: reads the document with OCR (6 credits per page on top, at most 8 pages).

    Default:
    false
  • documentIdstringoptional

    Optional, e.g. the Google Drive file ID. The same ID replaces the document; without it an ID is generated.

    Example:
    1AbCdriveFileId
  • metadataanyoptional

    Own key-value pairs for filters. Object {"department": "support", "tags": ["billing"]} or array [{"key": "year", "value": "2026", "type": "number"}] (type text, number, boolean or date). At most 50 keys and 8 KB.

  • keepOriginalbooleanoptional

    Stores the file encrypted (counts as storage) so it can be downloaded in the app.

    Default:
    false

Examples

RAG – Add Document to Knowledge Base

Needs an API key of an account (not a test key).

Input

Expects a json body
{
  "knowledgeBase": "Support FAQ",
  "documentId": "faq-billing",
  "title": "FAQ Billing",
  "text": "How do I cancel my subscription? Go to Settings → Subscription and click Cancel.",
  "metadata": {
    "department": "billing"
  }
}

Output · HTTP 200

Response
{
  "statusCode": 200
}
Show curl command
curl -X POST 'https://api.1001fx.com/rag/adddocument' \
  -H 'X-API-KEY: YOURSECRETAPIKEY'

Try adddocument now

Run it in your browser or create a free account and get 100 credits every month.

Changelog

  • 1.0.002.11.2026created