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

# Quickstart

> Make your first authenticated request in under five minutes.

## 1. Generate an API key

**1. Sign in to casebyte.ai**

Go to [casebyte.ai/dashboard](https://casebyte.ai/dashboard) and sign in
with your Casebyte account. API access is currently in private beta — if
you don't see the **API keys** section, [email us](mailto:support@casebyte.ai)
for access.

**2. Open the API keys section**

From your dashboard, open **Settings** and scroll to **API keys**.

**3. Create a key**

Click **New API key**, give it a descriptive name (e.g. `local-dev` or
`production-worker`), and click **Create**.

> [!WARNING]
>
> You'll see the full key value **once**. Copy it now and store it in a
> secret manager. Casebyte only ever stores a hash of the key, so we cannot
> show it to you again. If you lose it, revoke it and issue a new one.

API keys look like this:

```
cb_live_8f2a3b4c5d6e7f1a9b8c7d6e5f4a3b2c
```

The `cb_live_` prefix is part of the key — include it in your `Authorization`
header.

## 2. Make your first request

Search for the phrase **"wednesbury unreasonable"** across all of HK case law,
returning at most 5 results:

```bash cURL theme={null}
curl -G https://api.casebyte.ai/v1/cases/search \
  -H "Authorization: Bearer $CASEBYTE_API_KEY" \
  --data-urlencode 'q="wednesbury unreasonable"' \
  --data-urlencode 'limit=5'
```

```typescript Node.js theme={null}
const res = await fetch(
  "https://api.casebyte.ai/v1/cases/search?" +
    new URLSearchParams({
      q: '"wednesbury unreasonable"',
      limit: "5",
    }),
  {
    headers: {
      Authorization: `Bearer ${process.env.CASEBYTE_API_KEY}`,
    },
  },
);
const data = await res.json();
console.log(data.results);
```

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

res = requests.get(
    "https://api.casebyte.ai/v1/cases/search",
    headers={"Authorization": f"Bearer {os.environ['CASEBYTE_API_KEY']}"},
    params={"q": '"wednesbury unreasonable"', "limit": 5},
)
res.raise_for_status()
print(res.json()["results"])
```

```go Go theme={null}
req, _ := http.NewRequest("GET", "https://api.casebyte.ai/v1/cases/search", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("CASEBYTE_API_KEY"))

q := req.URL.Query()
q.Set("q", `"wednesbury unreasonable"`)
q.Set("limit", "5")
req.URL.RawQuery = q.Encode()

res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
```

You should get a response like:

```json theme={null}
{
  "total": 47,
  "limit": 5,
  "offset": 0,
  "results": [
    {
      "case_id": "HKCFA_2021_12",
      "case_name": "Kwok Cheuk Kin v Director of Lands",
      "court": "HKCFA",
      "neutral_citation": "[2021] HKCFA 12",
      "action_number": ["FACV 4/2020"],
      "publish_date": "2021-04-21",
      "score": 14.82,
      "highlights": {
        "doc_text": [
          "...the test of <em>Wednesbury</em> <em>unreasonable</em>ness applied..."
        ],
        "case_name": []
      }
    }
  ]
}
```

## 3. Retrieve the full judgment

Take a `case_id` from the search results and fetch the judgment text:

```bash theme={null}
curl https://api.casebyte.ai/v1/cases/HKCFA_2021_12 \
  -H "Authorization: Bearer $CASEBYTE_API_KEY"
```

The response includes metadata plus the full plain-text judgment:

```json theme={null}
{
  "case_id": "HKCFA_2021_12",
  "case_name": "Kwok Cheuk Kin v Director of Lands",
  "court": "HKCFA",
  "neutral_citation": "[2021] HKCFA 12",
  "action_numbers": ["FACV 4/2020"],
  "publish_date": "2021-04-21",
  "case_url": "https://www.hklii.hk/...",
  "doc_text": "JUDGMENT...",
  "matched_by": "case_id"
}
```

## 4. See who cites it

Find later judgments that cite this case:

```bash theme={null}
curl https://api.casebyte.ai/v1/cases/HKCFA_2021_12/cited-by \
  -H "Authorization: Bearer $CASEBYTE_API_KEY"
```

```json theme={null}
{
  "case_id": "HKCFA_2021_12",
  "total": 8,
  "citing_cases": [
    {
      "case_id": "HKCA_2023_487",
      "case_name": "...",
      "neutral_citation": "[2023] HKCA 487",
      "publish_date": "2023-09-15",
      "citation_text": "[2021] HKCFA 12"
    }
  ]
}
```

## What's next

> **[Search syntax](https://docs.casebyte.ai/guides/search-syntax.md)**
>
> Boolean operators, phrases, fuzzy matching, and field scoping.

> **[Identifiers](https://docs.casebyte.ai/guides/identifiers.md)**
>
> Three ways to look up a case — and which one to use.

> **[Errors](https://docs.casebyte.ai/guides/errors.md)**
>
> Every error code the API can return, and what to do about it.

> **[Rate limits](https://docs.casebyte.ai/guides/rate-limits.md)**
>
> Understand the limits and how to back off cleanly.

## Read recent Daily summaries

For news and video integrations, use [Daily summaries](https://docs.casebyte.ai/guides/daily-summaries.md)
to list the last seven Hong Kong calendar days, filter by publication day or area
of law, and retrieve a summary by case ID or neutral citation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.