Skip to content
Browse all functions

RAG – Ask Knowledge Base (AI Answer with Sources)

rag/ask

ask (RAG – Ask Knowledge Base (AI Answer with Sources)) is a 1001fx API function in the group Knowledge bases (RAG): POST https://api.1001fx.com/rag/ask, 4 credits per 1,000 tokens (minimum 4). It works as a ready-made module in Make or as a plain HTTP call.

Part of the app Knowledge Bases – Store documents and get AI answers with sources – no vector database, no AI account.

Answers a question from the documents of a knowledge base, with the passages used as sources. The AI answers only from the documents and the context of the knowledge base (set in the 1001fx app) and says when the answer is not in them; text in documents that addresses an AI is not followed (sources[].injectionSuspected). 1001fxGUARD, the fixed system prompt of every knowledge base, refuses attacks such as jailbreaks or questions for the system prompt or secrets: the chat is ended (ended = true), the owner gets an email with the questions, and after 5 ended chats in 24 hours the knowledge base is locked (error 423) until the owner unlocks it in the app. Questions and answers are kept 30 days, ended chats 12 months. Send chatId to keep a conversation together, and show notice below the answer. 4 credits per started 1,000 tokens (question, passages and answer), twice that with gpt-6.1-terra.

Try it in the 1001fx app

Run ask in your browser with your API key – fill the form, click Run and get the answer or the file.

ask in the 1001fx app: the form with example values
RAG – Ask Knowledge Base (AI Answer with Sources) in the 1001fx app

Endpoint

POSThttps://api.1001fx.com/rag/ask
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
application/json

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
  • questionstringrequired
    Example:
    How do I cancel my subscription?
  • topKnumberoptional

    Passages given to the AI, 1-20 (default 5).

    Default:
    5
    Min:
    1
    Max:
    20
  • modelenumoptional

    gpt-6-luna (default) or gpt-6.1-terra for harder questions (twice the credits).

    Values:
    gpt-6-luna
    gpt-6.1-terra
    Default:
    gpt-6-luna
  • systemMessagestringoptional

    Tone, format, length or language of the answer, e.g. "Answer in two sentences, formal German."

  • maxTokensnumberoptional

    Limits the length of the answer.

    Min:
    16
    Max:
    8000
  • minScorenumberoptional

    Leave out passages below this similarity (0-1).

    Min:
    0
    Max:
    1
  • includeMetadataInPromptanyoptional

    Off by default. Sends the metadata of the found documents to the AI together with the text, e.g. so the answer can mention the validity or the product. `true` sends all keys, a list sends only these keys, e.g. ["validUntil", "product"]. Every key costs tokens (credits) and is sent to the AI (Azure OpenAI, EU) – only include what helps the answer. Filtering does not need it.

  • citationsbooleanoptional

    Marks each statement of the answer with the sources it comes from, e.g. [1] or [2][3] – [n] is sources[n-1].

    Default:
    false
  • chatIdstringoptional

    chatId of the previous answer, to keep the questions of one conversation together. Empty starts a new chat. When 1001fxGUARD ended the chat (ended = true), start a new one.

  • filteranyoptional

    Only documents whose metadata match. Object {"department": "billing", "lastModified": {"$gte": "2026-01-01"}} (operators $eq $ne $in $nin $gt $gte $lt $lte $exists $contains, $and $or $not) or array [{"key", "operator", "value", "type"}] (all must match).

  • filterJsonstringoptional

    The filter as JSON text, e.g. for OR conditions from Make: {"$or": [{"department": "billing"}, {"department": "sales"}]}.

Examples

RAG – Ask Knowledge Base (AI Answer with Sources)

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

Input

Expects a json body
{
  "knowledgeBase": "Support FAQ",
  "question": "How do I cancel my subscription?"
}

Output · HTTP 200

Response
{
  "statusCode": 200
}
Show curl command
curl -X POST 'https://api.1001fx.com/rag/ask' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"knowledgeBase":"Support FAQ","question":"How do I cancel my subscription?"}'

Use cases

Try ask now

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

Changelog

  • 1.0.002.11.2026created
Ask 1001fx