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

# Quickstart

> From zero to a real response in under 10 minutes.

This walkthrough takes you from "I've heard of Seyn" to "I've made my first real API call." Five minutes, three steps.

## 1. Create an API key

1. Sign in at [app.seynlabs.com](https://app.seynlabs.com).
2. Open **Settings → API Keys**.
3. Click **Create**. Give the key a label (e.g. "local-dev").
4. Copy the `sk_live_*` token shown once. Store it somewhere safe: only the first 8 characters are kept on the server after this screen closes.

<Warning>
  Treat API keys like passwords. Don't commit them, don't ship them to browsers, don't paste them in chat. Use a `.env` file or your secret store.
</Warning>

## 2. Install the SDK

<Note>
  Both SDKs are pre-release: the TypeScript SDK is in private beta, the Python SDK in early alpha. Neither is on a public registry yet. Email [support@seynlabs.com](mailto:support@seynlabs.com) to request access: we'll send you the current builds along with install instructions.
</Note>

<CodeGroup>
  ```bash Python (early alpha) theme={null}
  # After receiving seyn_sdk-0.1.0.tar.gz from the team:
  pip install ./seyn_sdk-0.1.0.tar.gz
  ```

  ```bash TypeScript theme={null}
  # After receiving seyn-sdk-0.1.0.tgz from the team:
  npm install ./seyn-sdk-0.1.0.tgz
  ```
</CodeGroup>

TypeScript requires Node.js 18+ (uses native `fetch`); Python requires 3.10+.

## 3. Run your first query

Set your API key as an environment variable and run a script:

```bash theme={null}
export SEYN_API_KEY="sk_live_..."
```

<CodeGroup>
  ```python Python theme={null}
  import os
  from seyn import SeynClient

  seyn = SeynClient(api_key=os.environ["SEYN_API_KEY"])

  rules = seyn.rules.list(limit=5)
  print(f"Got {len(rules)} rules:")
  for rule in rules:
      print(f"  [{rule.confidence:.2f}] {rule.description}")
  ```

  ```ts TypeScript theme={null}
  import { SeynClient } from "@seyn/sdk";

  const seyn = new SeynClient({ apiKey: process.env.SEYN_API_KEY! });

  const rules = await seyn.rules.list({ limit: 5 });
  console.log(`Got ${rules.length} rules:`);
  for (const rule of rules) {
    console.log(`  [${rule.confidence.toFixed(2)}] ${rule.description}`);
  }
  ```

  ```bash curl theme={null}
  curl -s -H "Authorization: Bearer $SEYN_API_KEY" \
    "https://api.seynlabs.com/v1/rules?limit=5" | jq
  ```
</CodeGroup>

You should see a response like:

```json theme={null}
{
  "success": true,
  "data": [
    {
      "id": "7f3cb37f-7d67-43f1-a3eb-a95ffdafb6b9",
      "description": "Deals above $30M or flagged by finance require CEO-level approval before advancing to contract stage",
      "processId": "ceo-review",
      "appliesAtStep": "contract_stage",
      "confidence": 0.95,
      "frequency": 0.12,
      "reviewStatus": "confirmed",
      "createdAt": null
    }
  ],
  "meta": {
    "requestId": "a7678548-57ee-4f1a-8a80-a355a911b6f4",
    "pagination": { "total": 1, "limit": 5, "offset": 0 }
  }
}
```

That's a real rule extracted by Seyn from a real organisation's operational data.

## Try one more: ask Seyn a question

The `knowledge.query` method takes a natural-language question and returns ranked rule hits:

<CodeGroup>
  ```python Python theme={null}
  result = seyn.knowledge.query(
      q="When does a deal need senior approval?",
      top_k=3,
  )

  for hit in result.results:
      print(f"[{hit.score:.2f}] {hit.description}")
  ```

  ```ts TypeScript theme={null}
  const result = await seyn.knowledge.query({
    q: "When does a deal need senior approval?",
    topK: 3,
  });

  for (const hit of result.results) {
    console.log(`[${hit.score.toFixed(2)}] ${hit.description}`);
  }
  ```

  ```bash curl theme={null}
  curl -s -H "Authorization: Bearer $SEYN_API_KEY" \
    "https://api.seynlabs.com/v1/knowledge/query?q=When%20does%20a%20deal%20need%20senior%20approval%3F&topK=3" | jq
  ```
</CodeGroup>

## Where to go next

<CardGroup cols={2}>
  <Card title="Core Concepts" icon="book" href="/core-concepts">
    What's a Rule? A Library? Provenance? Get the mental model first.
  </Card>

  <Card title="How Seyn works" icon="layer-group" href="/platform/architecture">
    The five-layer architecture behind the API you just called.
  </Card>

  <Card title="SDK Reference" icon="code" href="/sdk-reference">
    Every method with full TypeScript signatures and examples.
  </Card>

  <Card title="Authentication" icon="key" href="/authentication">
    Key management, rotation, error codes, rate limits.
  </Card>
</CardGroup>

## Something's not working?

* **`MISSING_AUTH_HEADER`**: you forgot the `Authorization: Bearer ...` header, or it's a curl typo.
* **`INVALID_API_KEY`**: the key doesn't match anything on our side. Re-check what you pasted.
* **`KEY_REVOKED`**: the key was valid but an admin revoked it. Generate a new one in the dashboard.
* **`RATE_LIMITED`**: you've burnt 60 requests in a minute. Wait or [request a higher limit](mailto:support@seynlabs.com).
* **Stuck on anything else**: email [support@seynlabs.com](mailto:support@seynlabs.com).
