Getting Started

Your first query in five steps

Everything below is copy-pasteable. Replace dq_live_YOUR_KEY with your real key and run each snippet in order. The examples target a local instance at http://localhost:3000.

  1. 1

    Create an API key

    Open the app and go to Settings → API Keys. Click Create key, give it a name, and copy the value — it starts with dq_live_ and is shown only once. The key inherits your knowledge-base access.

    Open the app to mint a key
  2. 2

    Verify your key

    Confirm the key works by calling /me. A valid key returns your account identity.

    bash
    curl http://localhost:3000/api/v1/me \
      -H "Authorization: Bearer dq_live_YOUR_KEY"

    Response

    json
    {
      "id": "3f29a9e1-7c44-4b6a-9e21-8a1b6d0f2c77",
      "email": "you@example.com"
    }
  3. 3

    Create a knowledge base

    A knowledge base groups related documents. Create one and note the returned id — you’ll use it when ingesting and querying.

    bash
    curl -X POST http://localhost:3000/api/v1/knowledge-bases \
      -H "Authorization: Bearer dq_live_YOUR_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Product Docs",
        "description": "Internal product documentation"
      }'

    Response (201 Created)

    json
    {
      "knowledge_base": {
        "id": "b9993782-087d-482c-861e-3cc0fad3cbca",
        "name": "Product Docs",
        "description": "Internal product documentation",
        "is_default": false,
        "created_at": "2026-06-22T09:14:02Z"
      }
    }
  4. 4

    Add a document

    Ingest raw text or markdown into the KB you just created. docuQ chunks and embeds the content automatically; the response tells you how many chunks were produced. You must own the KB to write to it.

    bash
    curl -X POST http://localhost:3000/api/v1/documents \
      -H "Authorization: Bearer dq_live_YOUR_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "kb_id": "b9993782-087d-482c-861e-3cc0fad3cbca",
        "filename": "refunds.md",
        "content": "# Refund policy\nRefunds are issued within 14 days of purchase."
      }'

    Response (201 Created)

    json
    {
      "document": {
        "id": "6e2f0a8c-9b41-4d7e-8a3f-c05e9b1d7264",
        "filename": "refunds.md",
        "title": "refunds",
        "chunks": 1,
        "total_chunks": 1
      }
    }
  5. 5

    Ask a question

    Send a natural-language query scoped to your KB. docuQ runs hybrid retrieval, answers with DeepSeek, and returns the citations behind the answer. Omit knowledge_base_ids to search across every KB your key can reach.

    bash
    curl -X POST http://localhost:3000/api/v1/query \
      -H "Authorization: Bearer dq_live_YOUR_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "query": "How long do customers have to request a refund?",
        "knowledge_base_ids": ["b9993782-087d-482c-861e-3cc0fad3cbca"]
      }'

    Response

    json
    {
      "answer": "Customers can request a refund within 14 days of purchase.",
      "citations": [
        {
          "document_id": "6e2f0a8c-9b41-4d7e-8a3f-c05e9b1d7264",
          "title": "refunds.md",
          "snippet": "Refunds are issued within 14 days of purchase.",
          "similarity": 0.91
        }
      ],
      "model": "deepseek-chat",
      "knowledge_base_ids": ["b9993782-087d-482c-861e-3cc0fad3cbca"]
    }