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

# Quickstart

> Deploy your first DABAR agent in under 5 minutes: authenticate, create a Policy, run a Project on your primary sources, and expose it as an autonomous agent via MCP.

This guide walks you through your first end-to-end DABAR workflow:

1. Authenticate against the API.
2. Create a **Politic** — the policy that governs how DABAR reasons.
3. Create a **Project** — a run that applies the politic to your sources.
4. Deploy the project so DABAR starts producing verified outputs.

<Note>
  You need a DABAR account and an API token. If you don't have one yet, sign in at [dabarai.com](https://dabarai.com) and copy your token from the dashboard.
</Note>

## 1. Set up your environment

Export your token so the examples below work as-is.

<CodeGroup>
  ```bash Shell theme={null}
  export DABAR_TOKEN="your_api_token_here"
  export DABAR_API="https://api.dabarai.com/v1"
  ```

  ```javascript Node.js theme={null}
  const DABAR_TOKEN = process.env.DABAR_TOKEN;
  const DABAR_API = "https://api.dabarai.com/v1";

  const headers = {
    "api-token": DABAR_TOKEN,
    "Content-Type": "application/json"
  };
  ```

  ```python Python theme={null}
  import os, requests

  DABAR_TOKEN = os.environ["DABAR_TOKEN"]
  DABAR_API = "https://api.dabarai.com/v1"

  headers = {
      "api-token": DABAR_TOKEN,
      "Content-Type": "application/json",
  }
  ```
</CodeGroup>

## 2. Verify authentication

List your existing politics to confirm your token works.

```bash theme={null}
curl "$DABAR_API/politics" \
  -H "api-token: $DABAR_TOKEN"
```

A `200` response with `"success": true` means you're ready. A `401` means the header is missing or the token is invalid — see [Authentication](/authentication).

## 3. Create a Politic

A **Politic** is a reusable set of rules DABAR must follow when reasoning. It defines what sources are authoritative, what to flag, and how answers should be shaped.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "$DABAR_API/politics" \
    -H "api-token: $DABAR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Credit Risk Policy",
      "description": "Evaluate loan applications against internal risk guidelines.",
      "rules": [
        { "name": "Scope",    "description": "Only loans above 50,000 USD." },
        { "name": "Evidence", "description": "Every finding must cite source + page." },
        { "name": "Labels",   "description": "Use CONFIRMED / NOT FOUND / ESTIMATED." }
      ],
      "knowledgeFiles": [
        {
          "url": "https://cdn.example.com/risk-guidelines.pdf",
          "type": "pdf",
          "name": "risk-guidelines.pdf"
        }
      ]
    }'
  ```

  ```javascript Node.js theme={null}
  const politic = await fetch(`${DABAR_API}/politics`, {
    method: "POST",
    headers,
    body: JSON.stringify({
      name: "Credit Risk Policy",
      description: "Evaluate loan applications against internal risk guidelines.",
      rules: [
        { name: "Scope",    description: "Only loans above 50,000 USD." },
        { name: "Evidence", description: "Every finding must cite source + page." },
        { name: "Labels",   description: "Use CONFIRMED / NOT FOUND / ESTIMATED." }
      ],
      knowledgeFiles: [
        {
          url: "https://cdn.example.com/risk-guidelines.pdf",
          type: "pdf",
          name: "risk-guidelines.pdf"
        }
      ]
    })
  }).then(r => r.json());

  const politicId = politic.data._id;
  ```

  ```python Python theme={null}
  politic = requests.post(
      f"{DABAR_API}/politics",
      headers=headers,
      json={
          "name": "Credit Risk Policy",
          "description": "Evaluate loan applications against internal risk guidelines.",
          "rules": [
              {"name": "Scope",    "description": "Only loans above 50,000 USD."},
              {"name": "Evidence", "description": "Every finding must cite source + page."},
              {"name": "Labels",   "description": "Use CONFIRMED / NOT FOUND / ESTIMATED."},
          ],
          "knowledgeFiles": [
              {
                  "url": "https://cdn.example.com/risk-guidelines.pdf",
                  "type": "pdf",
                  "name": "risk-guidelines.pdf",
              }
          ],
      },
  ).json()

  politic_id = politic["data"]["_id"]
  ```
</CodeGroup>

Save the `_id` returned in `data._id` — you'll pass it as `politicsId` in the next step.

## 4. Create a Project

A **Project** applies a Politic to a specific set of input files (documents, URLs, audio, video, or raw text).

```bash theme={null}
curl -X POST "$DABAR_API/projects" \
  -H "api-token: $DABAR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Q1 Loan Batch",
    "description": "Risk analysis for Q1 loan applications.",
    "politicsId": "PASTE_POLITIC_ID_HERE",
    "files": [
      { "name": "application-001.pdf", "type": "document", "url": "https://cdn.example.com/application-001.pdf" },
      { "name": "analyst-notes", "type": "text", "content": "Applicant has prior loan history in 2024..." }
    ]
  }'
```

The project is created in `draft` status. It won't run until you deploy it.

## 5. Deploy the project

```bash theme={null}
curl -X PUT "$DABAR_API/projects/PASTE_PROJECT_ID_HERE" \
  -H "api-token: $DABAR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "status": "deploying" }'
```

DABAR now ingests your files, reasons under the politic's rules, and produces verified outputs labeled **CONFIRMED**, **NOT FOUND**, or **ESTIMATED** with source and page-level citations.

Poll the project with [`GET /projects/{id}`](/api-reference/projects/get) to track progress.

## Next steps

<CardGroup cols={2}>
  <Card title="Policy Engine" icon="scale-balanced" href="/concepts/policy-engine">
    Learn how to structure rules that DABAR can enforce end-to-end.
  </Card>

  <Card title="Primary Sources" icon="database" href="/concepts/primary-sources">
    Understand what kinds of sources DABAR accepts and how they're used.
  </Card>

  <Card title="Autonomous Agents" icon="bolt" href="/concepts/agents">
    Turn a deployed project into an agent that takes action in your systems.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/politics/list">
    Every endpoint, parameter, and response in detail.
  </Card>
</CardGroup>
