> ## Documentation Index
> Fetch the complete documentation index at: https://docs.factagora.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ask & verify

> Ask questions grounded only in a collection, and verify existing Q&A pairs against it.

Collections let you build a **per-brand private corpus** by ingesting multiple URLs into one unified knowledge graph (TKG).

**Requires a personal access token.** Master keys are rejected.

## POST /api/v1/collections/{id}/answer

Ask a question and get an answer grounded **only** in this collection's knowledge graph. Uses semantic search (pgvector) to retrieve the most relevant content before generating an answer.

If the knowledge graph does not contain enough information to answer, `grounded` is set to `false` to prevent hallucination.

### Request Body

<ParamField body="question" type="string" required>
  The question to answer.
</ParamField>

<ParamField body="language" type="string" default="English">
  Language for the answer (e.g. `"Korean"`, `"Japanese"`).
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.factagora.com/api/v1/collections/5966a861-6952-482a-a9d0-041ad5d2a667/answer" \
    -H "Authorization: Bearer fa_your_personal_token" \
    -H "Content-Type: application/json" \
    -d '{"question": "What is the IONIQ 6 electric range?"}'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "question": "What is the IONIQ 6 electric range?",
    "answer": "The IONIQ 6 has a driving range of up to 338 miles.",
    "grounded": true,
    "sources": [
      {
        "url": "https://www.hyundai.com/uk/en/models/ioniq6.html",
        "title": "IONIQ 6 | Hyundai UK"
      }
    ],
    "meta": {
      "executionTimeMs": 1285
    }
  }
  ```
</ResponseExample>

***

## POST /api/v1/collections/{id}/qa-verify

Verify existing Q\&A pairs against the collection knowledge graph. Each pair receives one of three verdicts:

| Verdict       | Meaning                                                             |
| ------------- | ------------------------------------------------------------------- |
| `correct`     | The answer is supported by the collection's knowledge               |
| `incorrect`   | The answer contradicts the knowledge, so a `correction` is provided |
| `unsupported` | The collection does not have enough information to verify           |

### Request Body

<ParamField body="qa_pairs" type="array" required>
  Array of question/answer pairs to verify (1–50).

  <Expandable title="qa_pairs fields">
    <ParamField body="question" type="string" required>The question</ParamField>
    <ParamField body="answer" type="string" required>The answer to verify</ParamField>
  </Expandable>
</ParamField>

<ParamField body="language" type="string" default="English">
  Language for verdict summaries and corrections.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.factagora.com/api/v1/collections/5966a861-6952-482a-a9d0-041ad5d2a667/qa-verify" \
    -H "Authorization: Bearer fa_your_personal_token" \
    -H "Content-Type: application/json" \
    -d '{
      "qa_pairs": [
        {
          "question": "What is the IONIQ 6 charging time?",
          "answer": "The IONIQ 6 charges from 10% to 80% in 18 to 36 minutes."
        },
        {
          "question": "Is the IONIQ 6 available as a petrol car?",
          "answer": "Yes, the IONIQ 6 is available as a petrol car."
        }
      ]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "results": [
      {
        "question": "What is the IONIQ 6 charging time?",
        "answer": "The IONIQ 6 charges from 10% to 80% in 18 to 36 minutes.",
        "verdict": "correct",
        "confidence": 0.92,
        "correction": null,
        "summary": "The collection confirms IONIQ 6 charges from 10% to 80% in 18–36 minutes on a 350 kW ultra-fast charger."
      },
      {
        "question": "Is the IONIQ 6 available as a petrol car?",
        "answer": "Yes, the IONIQ 6 is available as a petrol car.",
        "verdict": "incorrect",
        "confidence": 0.95,
        "correction": "The IONIQ 6 is a fully electric vehicle. No petrol variant is available.",
        "summary": "The collection describes the IONIQ 6 exclusively as an electric car."
      }
    ],
    "meta": {
      "executionTimeMs": 2100
    }
  }
  ```
</ResponseExample>
