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 item. It works as a ready-made module in Make or as a plain HTTP call.

4 credits per itemHTTP APIMake

Answers a question from the documents of a knowledge base, with the passages used as sources. The AI answers only from the documents and says when the answer is not in them; text in documents that addresses an AI is not followed (sources[].injectionSuspected). 4 credits per started 1,000 tokens (question, passages and answer), twice that with gpt-6.1-terra.

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.

  • 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?"}'

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