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

# Legal Research Overview

> Search, analyze, and verify legal sources from authoritative databases

Build legal research into your application. Search case law by topic, find similar authorities, verify citations, and retrieve full document text—all from authoritative sources.

## Capabilities

Legal Research provides a complete toolkit for working with legal sources:

| Capability           | Method                     | What it does                                         |
| -------------------- | -------------------------- | ---------------------------------------------------- |
| **Search**           | `legal.find()`             | Find cases by topic or keyword                       |
| **SEC filings**      | `legal.secFiling()`        | Search EDGAR filings or fetch company filing history |
| **Docket search**    | `legal.docket()`           | Search federal court dockets and filings             |
| **Court lookup**     | `legal.listCourts()`       | Resolve court names to CourtListener IDs             |
| **Patent search**    | `legal.patentSearch()`     | Search US patent applications and grants             |
| **Trademark lookup** | `legal.trademarkSearch()`  | Look up US trademark status and details              |
| **Discover**         | `legal.similar()`          | Find semantically similar cases to a source          |
| **Verify**           | `legal.verify()`           | Confirm citations exist (catch hallucinations)       |
| **Parse**            | `legal.citations()`        | Extract Bluebook components from text                |
| **Extract**          | `legal.citationsFromUrl()` | Pull all citations from a document URL               |
| **Retrieve**         | `legal.fullText()`         | Get full document content with highlights            |
| **Research**         | `legal.research()`         | Deep multi-query research with variations            |
| **Resolve**          | `legal.jurisdictions()`    | Convert jurisdiction names to IDs                    |

These methods work together to create **credible legal workflows**—where every citation is verified and every source is retrievable.

## Quick start

<CodeGroup>
  ```bash title="cURL" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  # Search for cases
  curl -X POST https://api.case.dev/legal/v1/find \
    -H "Authorization: Bearer $CASEDEV_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"query": "qualified immunity excessive force"}'

  # Verify a citation
  curl -X POST https://api.case.dev/legal/v1/verify \
    -H "Authorization: Bearer $CASEDEV_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"text": "531 U.S. 98"}'
  ```

  ```bash title="CLI" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  # Search for cases on a topic
  casedev legal:v1 find \
    --query "qualified immunity excessive force" \
    --jurisdiction us-federal

  # Find similar cases to expand research
  casedev legal:v1 similar \
    --url "https://www.courtlistener.com/opinion/118365/bush-v-gore/" \
    --num-results 5

  # Verify a citation before citing it
  casedev legal:v1 verify --text "531 U.S. 98"

  # Get full document text
  casedev legal:v1 get-full-text \
    --url "https://www.courtlistener.com/opinion/118365/bush-v-gore/" \
    --highlight-query "equal protection"
  ```

  ```typescript title="Typescript" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  import Casedev from 'casedev';

  const client = new Casedev({ apiKey: process.env.CASEDEV_API_KEY });

  // Search for cases on a topic
  const results = await client.legal.find({
    query: 'qualified immunity excessive force',
    jurisdiction: 'us-federal',
  });

  console.log(`Found ${results.found} cases`);
  for (const candidate of results.candidates) {
    console.log(`${candidate.title}: ${candidate.url}`);
  }

  // Find similar cases to expand research
  const similar = await client.legal.similar({
    url: results.candidates[0].url,
    numResults: 5
  });

  // Verify a citation before citing it
  const verification = await client.legal.verify({
    text: '531 U.S. 98'
  });

  if (verification.summary.verified > 0) {
    const citation = verification.citations[0];
    console.log(`Verified: ${citation.case.name}`);  // "Bush v. Gore"
  }

  // Get full document text
  const doc = await client.legal.fullText({
    url: 'https://www.courtlistener.com/opinion/118365/bush-v-gore/',
    highlightQuery: 'equal protection'
  });
  ```

  ```python title="Python" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  import casedev

  client = casedev.Casedev(api_key=os.environ['CASEDEV_API_KEY'])

  # Search for cases on a topic
  results = client.legal.v1.find(
      query='qualified immunity excessive force',
      jurisdiction='us-federal',
  )

  print(f'Found {results.found} cases')
  for candidate in results.candidates:
      print(f'{candidate.title}: {candidate.url}')

  # Find similar cases to expand research
  similar = client.legal.v1.similar(
      url=results.candidates[0].url,
      num_results=5
  )

  # Verify a citation before citing it
  verification = client.legal.v1.verify(text='531 U.S. 98')

  if verification.summary.verified > 0:
      citation = verification.citations[0]
      print(f'Verified: {citation.case.name}')  # "Bush v. Gore"

  # Get full document text
  doc = client.legal.v1.get_full_text(
      url='https://www.courtlistener.com/opinion/118365/bush-v-gore/',
      highlight_query='equal protection'
  )
  ```

  ```go title="Go" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  import casedev "github.com/CaseMark/casedev-go"

  // Search for cases on a topic
  results, _ := client.Legal.V1.Find(ctx, casedev.LegalV1FindParams{
      Query:        casedev.F("qualified immunity excessive force"),
      Jurisdiction: casedev.F("us-federal"),
  })

  fmt.Printf("Found %d cases\n", results.Found)
  for _, candidate := range results.Candidates {
      fmt.Printf("%s: %s\n", candidate.Title, candidate.URL)
  }

  // Find similar cases to expand research
  similar, _ := client.Legal.V1.Similar(ctx, casedev.LegalV1SimilarParams{
      URL:        casedev.F(results.Candidates[0].URL),
      NumResults: casedev.F(int64(5)),
  })

  // Verify a citation before citing it
  verification, _ := client.Legal.V1.Verify(ctx, casedev.LegalV1VerifyParams{
      Text: casedev.F("531 U.S. 98"),
  })

  if verification.Summary.Verified > 0 {
      citation := verification.Citations[0]
      fmt.Printf("Verified: %s\n", citation.Case.Name) // "Bush v. Gore"
  }

  // Get full document text
  doc, _ := client.Legal.V1.GetFullText(ctx, casedev.LegalV1GetFullTextParams{
      URL:            casedev.F("https://www.courtlistener.com/opinion/118365/bush-v-gore/"),
      HighlightQuery: casedev.F("equal protection"),
  })
  ```
</CodeGroup>

## Why verify citations?

AI models hallucinate. They confidently cite "Smith v. Jones, 542 U.S. 123"—a case that doesn't exist. If your users trust those citations, they file briefs with fake authorities and face sanctions.

Legal Research solves this by verifying every citation against authoritative databases:

```text theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
│  AI generates: "Miranda v. Arizona, 384 U.S. 436"               │
│                           ↓                                     │
│  legal.verify("384 U.S. 436")                                   │
│  → status: "verified", case: "Miranda v. Arizona"               │
│                           ↓                                     │
│  Safe to cite with URL to authoritative source                  │
└─────────────────────────────────────────────────────────────────┘
```

| Status             | Meaning                      | Action                                       |
| ------------------ | ---------------------------- | -------------------------------------------- |
| `verified`         | Citation matches a real case | Safe to cite                                 |
| `not_found`        | No match in database         | Likely hallucination—search for alternatives |
| `multiple_matches` | Multiple possible matches    | Review candidates manually                   |

## Building credible workflows

The real power comes from combining methods. Here's how to build a research workflow where every citation is verified and every source is retrievable:

<CodeGroup>
  ```bash title="cURL" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  # 1. Deep search with multiple query variations
  curl -X POST https://api.case.dev/legal/v1/research \
    -H "Authorization: Bearer $CASEDEV_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "query": "topic",
      "additionalQueries": ["topic Supreme Court", "topic leading case"],
      "numResults": 15
    }'

  # 2. Verify each candidate
  curl -X POST https://api.case.dev/legal/v1/verify \
    -H "Authorization: Bearer $CASEDEV_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "text": "Candidate Case Title"
    }'

  # 3. Expand research with similar cases
  curl -X POST https://api.case.dev/legal/v1/similar \
    -H "Authorization: Bearer $CASEDEV_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "url": "https://www.courtlistener.com/opinion/...",
      "numResults": 5
    }'
  ```

  ```bash title="CLI" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  # 1. Deep search with multiple query variations
  casedev legal:v1 research \
    --query "topic" \
    --additional-query "topic Supreme Court" \
    --additional-query "topic leading case" \
    --num-results 15

  # 2. Verify each candidate
  casedev legal:v1 verify --text "Candidate Case Title"

  # 3. Expand research with similar cases
  casedev legal:v1 similar \
    --url "https://www.courtlistener.com/opinion/..." \
    --num-results 5
  ```

  ```typescript title="Typescript" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  async function researchWithVerification(topic: string) {
    // 1. Deep search with multiple query variations
    const research = await client.legal.research({
      query: topic,
      additionalQueries: [
        `${topic} Supreme Court`,
        `${topic} leading case`,
      ],
      numResults: 15
    });

    // 2. Verify each candidate before presenting to user
    const verified = [];
    for (const candidate of research.candidates) {
      const result = await client.legal.verify({ text: candidate.title });
      if (result.summary.verified > 0) {
        verified.push({
          ...candidate,
          citation: result.citations[0]
        });
      }
    }

    // 3. Expand research with similar cases
    if (verified.length > 0) {
      const similar = await client.legal.similar({
        url: verified[0].url,
        numResults: 5
      });
      return { primary: verified, related: similar.similarSources };
    }

    return { primary: verified, related: [] };
  }
  ```

  ```python title="Python" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  def research_with_verification(topic: str):
      # 1. Deep search with multiple query variations
      research = client.legal.v1.research(
          query=topic,
          additional_queries=[
              f"{topic} Supreme Court",
              f"{topic} leading case",
          ],
          num_results=15,
      )

      # 2. Verify each candidate before presenting to user
      verified = []
      for candidate in research.candidates:
          result = client.legal.v1.verify(text=candidate.title)
          if result.summary.verified > 0:
              verified.append({
                  **candidate,
                  "citation": result.citations[0],
              })

      # 3. Expand research with similar cases
      if verified:
          similar = client.legal.v1.similar(
              url=verified[0]["url"],
              num_results=5,
          )
          return {"primary": verified, "related": similar.similar_sources}

      return {"primary": verified, "related": []}
  ```

  ```go title="Go" theme={"theme":{"light":"github-light","dark":"one-dark-pro"}}
  // 1. Deep search with multiple query variations
  research, _ := client.Legal.V1.Research(ctx, casedev.LegalV1ResearchParams{
      Query: casedev.F(topic),
      AdditionalQueries: casedev.F([]string{
          topic + " Supreme Court",
          topic + " leading case",
      }),
      NumResults: casedev.F(int64(15)),
  })

  // 2. Verify each candidate before presenting to user
  var verified []Candidate
  for _, candidate := range research.Candidates {
      result, _ := client.Legal.V1.Verify(ctx, casedev.LegalV1VerifyParams{
          Text: casedev.F(candidate.Title),
      })
      if result.Summary.Verified > 0 {
          verified = append(verified, candidate)
      }
  }

  // 3. Expand research with similar cases
  if len(verified) > 0 {
      similar, _ := client.Legal.V1.Similar(ctx, casedev.LegalV1SimilarParams{
          URL:        casedev.F(verified[0].URL),
          NumResults: casedev.F(int64(5)),
      })
      // Use similar.SimilarSources as related cases
  }
  ```
</CodeGroup>

This pattern ensures your users only see **real cases with working links**—never hallucinated authorities.

## Endpoints

<CardGroup cols={2}>
  <Card title="find" href="/api-reference/legal/find-legal-sources">
    Search for cases by topic or keyword
  </Card>

  <Card title="similar" href="/api-reference/legal/find-similar-legal-sources">
    Find semantically similar cases to a source
  </Card>

  <Card title="verify" href="/api-reference/legal/verify-legal-citations">
    Verify citations against authoritative databases
  </Card>

  <Card title="citations" href="/api-reference/legal/parse-citations-from-text">
    Parse Bluebook citation components from text
  </Card>

  <Card title="citationsFromUrl" href="/api-reference/legal/extract-citations-from-url">
    Extract all citations from a document URL
  </Card>

  <Card title="fullText" href="/api-reference/legal/get-full-text-of-legal-document">
    Retrieve full document content with highlights
  </Card>

  <Card title="research" href="/api-reference/legal/deep-legal-research">
    Deep multi-query research with variations
  </Card>

  <Card title="docket" href="/api-reference/legal/search-federal-dockets-and-filings">
    Search federal court dockets and filings
  </Card>

  <Card title="listCourts" href="/api-reference/legal/list-court-listener-courts">
    Resolve court names to CourtListener IDs
  </Card>

  <Card title="patentSearch" href="/api-reference/legal/search-uspto-patent-applications">
    Search US patent applications and grants
  </Card>

  <Card title="trademarkSearch" href="/api-reference/legal/look-up-uspto-trademark-status">
    Look up US trademark status and details
  </Card>

  <Card title="jurisdictions" href="/api-reference/legal/resolve-jurisdiction">
    Resolve jurisdiction names to canonical IDs
  </Card>
</CardGroup>

## Supported sources

Search and verification covers authoritative legal databases:

| Source             | Content                                        |
| ------------------ | ---------------------------------------------- |
| **CourtListener**  | \~10M court opinions                           |
| **Federal Courts** | Supreme Court, Circuit Courts, District Courts |
| **State Courts**   | All 50 states via regional reporters           |
| **Statutes**       | US Code (USC) citations                        |
| **Regulations**    | Code of Federal Regulations (CFR)              |
| **Cornell Law**    | Statutes, regulations, legal encyclopedias     |

## Pricing

| Method                     | Price           | Use case                                |
| -------------------------- | --------------- | --------------------------------------- |
| `legal.verify()`           | Free            | Verify AI-generated citations           |
| `legal.citations()`        | Free            | Parse citations from text               |
| `legal.jurisdictions()`    | Free            | Resolve jurisdiction names              |
| `legal.citationsFromUrl()` | \$0.01/request  | Extract citations from document URL     |
| `legal.fullText()`         | \$0.01/request  | Retrieve document content               |
| `legal.find()`             | \$0.01/request  | Search for cases                        |
| `legal.secFiling()`        | Free            | Search EDGAR filings and entity history |
| `legal.similar()`          | \$0.01/request  | Find related cases                      |
| `legal.trademarkSearch()`  | \$0.005/request | Look up trademark status                |
| `legal.docket()`           | Free            | Search dockets and retrieve filings     |
| `legal.listCourts()`       | Free            | Resolve court names to IDs              |
| `legal.research()`         | \$0.05/request  | Deep multi-query research               |

## Next steps

<CardGroup>
  <Card title="Case Search" href="/legal-research/search">
    Find cases by topic and discover related authorities
  </Card>

  <Card title="SEC Filings" href="/legal-research/sec-filings">
    Search EDGAR full-text filings and company filing history
  </Card>

  <Card title="Docket Search" href="/legal-research/docket-search">
    Search federal court dockets and filings
  </Card>

  <Card title="Patent Search" href="/legal-research/patent-search">
    Search US patent applications and granted patents
  </Card>

  <Card title="Trademark Search" href="/legal-research/trademark-search">
    Look up US trademark status and details
  </Card>

  <Card title="Citations" href="/legal-research/citations">
    Parse, verify, and extract legal citations
  </Card>
</CardGroup>

## Related services

<CardGroup>
  <Card title="LLMs" href="/llms">
    Combine legal research with AI for analysis and drafting
  </Card>

  <Card title="Vault" href="/vault">
    Store legal documents and build case-specific knowledge bases
  </Card>

  <Card title="Web Search" href="/web-search">
    Supplement legal research with general web search
  </Card>
</CardGroup>
