DeepCitation Documentation

Verify AI citations against source documents. Visual proof for every claim.

Get Started View on GitHub


Quick Navigation

Section Description
Getting Started Installation and quick start guide
API Reference REST API endpoints for file preparation and verification
Curl Guide Direct API usage with curl examples
Types TypeScript interface definitions
Verification Statuses Understanding verification result statuses
Code Examples SDK usage examples and patterns
Components React CitationComponent documentation
Real-World Examples Industry-specific integration examples
Styling CSS customization options

How DeepCitation Works

  1. Pre-Prompt: Prepare Files - Upload source documents to extract text with line IDs for your LLM prompt
  2. Wrap Prompts & Call Your LLM - Add citation instructions and call any LLM provider
  3. Post-Prompt: Verify Citations - Verify citations with deterministic matching and get visual proof
  4. Display Results - Parse citations from output and render with React components or your own UI

Example Projects

Complete working examples are available on GitHub:


Quick Install

npm install @deepcitation/deepcitation-js
import { DeepCitation, wrapCitationPrompt, getAllCitationsFromLlmOutput } from "@deepcitation/deepcitation-js";

const dc = new DeepCitation({ apiKey: process.env.DEEPCITATION_API_KEY });

// Upload and verify in 3 steps
const { attachmentId, deepTextPromptPortion } = await dc.uploadFile(pdfBuffer, { filename: "report.pdf" });
const { enhancedSystemPrompt, enhancedUserPrompt } = wrapCitationPrompt({ systemPrompt, userPrompt, deepTextPromptPortion });
// ... call your LLM ...
const citations = getAllCitationsFromLlmOutput(response.content);
const verified = await dc.verify(attachmentId, citations);