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

# Quickstart

> Make your first OathNet API call in under 5 minutes

## Prerequisites

Before you begin, you'll need:

<Steps>
  <Step title="Create an Account">
    Sign up at [oathnet.org](https://oathnet.org/register) if you haven't already.
  </Step>

  <Step title="Get Your API Key">
    Open [Dashboard > Account](https://oathnet.org/dashboard?tab=account) and generate a new API key.
  </Step>

  <Step title="Store It Securely">
    Keep the key in an environment variable or secret manager.
  </Step>
</Steps>

<Warning>
  Never commit your API key to version control or ship it in client-side code.
</Warning>

## Try the API Playground

The OpenAPI reference includes an interactive playground where you can:

1. enter your API key in the authorization section
2. set request parameters
3. send the request and inspect the live response

<Card title="Try V2 Breach Search" icon="play" href="/guides/breach-search">
  Learn the workflow first, then use OpenAPI for the exact request shape
</Card>

## Your First API Call

Start with the current breach search endpoint:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://oathnet.org/api/service/v2/breach/search?q=test@example.com" \
    -H "x-api-key: YOUR_API_KEY"
  ```

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

  API_KEY = os.environ["OATHNET_API_KEY"]

  response = requests.get(
      "https://oathnet.org/api/service/v2/breach/search",
      params={"q": "test@example.com"},
      headers={"x-api-key": API_KEY},
  )

  payload = response.json()

  if payload["success"]:
      print(f"Found {payload['data']['meta']['total']} results")
      for item in payload["data"]["items"]:
          print(f"- {item.get('email')} in {item.get('dbname', 'unknown source')}")
  else:
      print(payload["message"])
  ```

  ```javascript Node.js theme={null}
  const API_KEY = process.env.OATHNET_API_KEY;

  const response = await fetch(
    "https://oathnet.org/api/service/v2/breach/search?q=test@example.com",
    {
      headers: { "x-api-key": API_KEY },
    }
  );

  const payload = await response.json();

  if (payload.success) {
    console.log(`Found ${payload.data.meta.total} results`);
    payload.data.items.forEach((item) => {
      console.log(`- ${item.email} in ${item.dbname || "unknown source"}`);
    });
  } else {
    console.error(payload.message);
  }
  ```

  ```go Go theme={null}
  package main

  import (
      "encoding/json"
      "fmt"
      "net/http"
      "os"
  )

  func main() {
      apiKey := os.Getenv("OATHNET_API_KEY")

      req, _ := http.NewRequest(
          "GET",
          "https://oathnet.org/api/service/v2/breach/search?q=test@example.com",
          nil,
      )
      req.Header.Add("x-api-key", apiKey)

      resp, err := http.DefaultClient.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      var payload map[string]any
      _ = json.NewDecoder(resp.Body).Decode(&payload)

      if payload["success"].(bool) {
          data := payload["data"].(map[string]any)
          meta := data["meta"].(map[string]any)
          fmt.Printf("Found %.0f results\n", meta["total"])
      }
  }
  ```
</CodeGroup>

### Example Response

```json theme={null}
{
  "success": true,
  "message": "Request completed successfully",
  "data": {
    "items": [
      {
        "id": "rec_01",
        "email": "test@example.com",
        "username": "testuser",
        "password": "p@ssw0rd123",
        "dbname": "example_breach_2023",
        "indexed_at": "2026-04-18T12:00:00Z"
      }
    ],
    "meta": {
      "count": 1,
      "total": 1,
      "took_ms": 4,
      "has_more": false,
      "total_pages": 1
    },
    "next_cursor": null
  }
}
```

## Understanding the Response

| Field              | Description                             |
| ------------------ | --------------------------------------- |
| `success`          | `true` if the request succeeded         |
| `message`          | Human-readable status message           |
| `data.items`       | Array of breach records for this page   |
| `data.meta.total`  | Total number of matching records        |
| `data.meta.count`  | Number of records in this response      |
| `data.next_cursor` | Cursor for the next page when available |

## Search Sessions

Search-session and v2 search endpoints can participate in the same flow when you want related lookups grouped under a shared `search_id`.

<CodeGroup>
  ```python Python theme={null}
  import os
  import requests

  API_KEY = os.environ["OATHNET_API_KEY"]

  session_response = requests.post(
      "https://oathnet.org/api/service/search/init",
      json={"query": "user@company.com"},
      headers={"x-api-key": API_KEY},
  )
  session_id = session_response.json()["data"]["session"]["id"]

  breach_response = requests.get(
      "https://oathnet.org/api/service/v2/breach/search",
      params={"q": "user@company.com", "search_id": session_id},
      headers={"x-api-key": API_KEY},
  )

  stealer_response = requests.get(
      "https://oathnet.org/api/service/v2/stealer/search",
      params={"q": "user@company.com", "search_id": session_id},
      headers={"x-api-key": API_KEY},
  )
  ```

  ```javascript Node.js theme={null}
  const sessionRes = await fetch("https://oathnet.org/api/service/search/init", {
    method: "POST",
    headers: {
      "x-api-key": API_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ query: "user@company.com" }),
  });

  const sessionPayload = await sessionRes.json();
  const searchId = sessionPayload.data.session.id;

  const breachRes = await fetch(
    `https://oathnet.org/api/service/v2/breach/search?q=user@company.com&search_id=${searchId}`,
    { headers: { "x-api-key": API_KEY } }
  );
  ```
</CodeGroup>

## Common Query Types

OathNet automatically detects many common query types from the `q` parameter:

| Query                | Detected Type |
| -------------------- | ------------- |
| `user@example.com`   | Email         |
| `example.com`        | Domain        |
| `192.168.1.1`        | IP            |
| `123456789012345678` | Discord ID    |
| `johndoe`            | Username      |

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/api-reference/overview">
    Explore the generated OpenAPI endpoint reference
  </Card>

  <Card title="Scanners Guide" icon="radar" href="/guides/scanners">
    Learn how to monitor new results automatically
  </Card>
</CardGroup>
