API for LLM Source Verification

A developer-first API that scores the reliability of sources in LLM-generated responses. Integrate trust scoring into your language model applications with a simple REST API.

Real-time ScoringMulti-source AnalysisAudit Trails

Trust Scores

Live

UNAIDS Uganda Profile

Q:95R:90P:91
92

NASA Climate Data

Q:90R:85P:86
87

Blog Post - TechCrunch

Q:70R:85P:37
64

Wikipedia Article

Q:60R:40P:35
45
Avg Score72

Quick Start Guide

Get started with Ancestor in three simple steps

1

Get API Key

Bash
curl -X POST https://api.ancestor.cloud/v1/auth/keys \
  -H "Content-Type: application/json" \
  -d '{"email": "your@email.com"}'
2

Evaluate Sources

Bash
curl -X POST https://api.ancestor.cloud/v1/evaluate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What is Uganda'''s HIV prevalence?",
    "answer": "According to UNAIDS, Uganda'''s HIV prevalence is 5.7% as of 2022",
    "citations": [
      {
        "url": "https://www.unaids.org/en/regionscountries/countries/uganda",
        "title": "UNAIDS Uganda Country Profile"
      }
    ]
  }'
3

Get Results

JSON
{
  "trust_score": 87,
  "factors": {
    "source_quality": 92,
    "recency": 85,
    "provenance": 78
  },
  "explanation": "High confidence: UNAIDS is authoritative source, data is recent (2022), has stable URL + archived copy",
  "ancestry_id": "eval_abc123"
}

API Reference

Complete API documentation with interactive examples and detailed schemas.

POST/v1/evaluate

Evaluate source quality for LLM-generated responses with detailed trust scoring and analysis.

GET/v1/ancestry/{id}

Retrieve detailed audit trail and evaluation history for a specific ancestry ID.

Error Handling

The API uses conventional HTTP response codes to indicate success or failure. Error responses include detailed information to help debug issues.

Error Response Format

JSON
{
  "error": {
    "code": "invalid_request",
    "message": "Missing required field: question",
    "details": {
      "field": "question",
      "expected": "string",
      "received": null
    }
  },
  "request_id": "req_abc123"
}

Common Error Examples

400 Bad Request
JSON
{
  "error": {
    "code": "invalid_request",
    "message": "Invalid URL format in citations",
    "details": {
      "field": "citations[0].url",
      "value": "not-a-valid-url"
    }
  }
}
401 Unauthorized
JSON
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid API key",
    "details": {
      "hint": "Check your API key in the Authorization header"
    }
  }
}
429 Too Many Requests
JSON
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded",
    "details": {
      "limit": 100,
      "window": "1 hour",
      "retry_after": 3600
    }
  }
}
500 Internal Server Error
JSON
{
  "error": {
    "code": "internal_error",
    "message": "An internal error occurred",
    "details": {
      "request_id": "req_abc123",
      "support": "Contact support with this request ID"
    }
  }
}

HTTP Status Codes

Status CodeDescriptionCommon Causes
200SuccessRequest completed successfully
400Bad RequestInvalid JSON, missing fields, malformed URLs
401UnauthorizedMissing or invalid API key
403ForbiddenAPI key lacks required permissions
404Not FoundAncestry ID not found, invalid endpoint
422Unprocessable EntityValid JSON but business logic errors
429Too Many RequestsRate limit exceeded for your plan
500Internal Server ErrorServer error, contact support
503Service UnavailableTemporary maintenance or overload

Authentication

All API requests require authentication using your API key in the Authorization header:

HTTP
Authorization: Bearer YOUR_API_KEY

Rate Limits

Rate limits are enforced per API key and reset at the beginning of each time window. Exceeding limits returns a 429 status code.

Free Tier
100 requests/hour
10 requests/minute
Burst: 20 requests
Pro Plan
1,000 requests/hour
100 requests/minute
Burst: 200 requests
Enterprise
Custom limits
Dedicated infrastructure
SLA guarantees

Tip: Use the X-RateLimit-* headers in responses to monitor your usage and implement proper backoff strategies.

Webhooks

Webhooks allow you to receive real-time notifications when evaluations are completed, enabling asynchronous processing for high-volume applications.

Webhook Events

evaluation.completed

Triggered when an evaluation request is successfully processed

evaluation.failed

Triggered when an evaluation request fails after retries

Webhook Payload Example

JSON
{
  "event": "evaluation.completed",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "ancestry_id": "eval_abc123",
    "request_id": "req_xyz789",
    "trust_score": 87,
    "factors": {
      "source_quality": 92,
      "recency": 85,
      "provenance": 78
    },
    "processing_time_ms": 1250,
    "webhook_id": "wh_def456"
  },
  "signature": "sha256=a1b2c3d4e5f6..."
}

Setting Up Webhooks

Bash
# Create a webhook endpoint
curl -X POST https://api.ancestor.cloud/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-app.com/webhooks/ancestor",
    "events": ["evaluation.completed", "evaluation.failed"],
    "secret": "your_webhook_secret"
  }'

# Use async evaluation with webhook
curl -X POST https://api.ancestor.cloud/v1/evaluate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What is the population of Japan?",
    "answer": "According to World Bank, Japan has 125 million people",
    "citations": [{"url": "https://data.worldbank.org/country/japan"}],
    "options": {
      "async": true,
      "webhook_id": "wh_def456"
    }
  }'

Webhook Security

All webhook payloads are signed using HMAC-SHA256. Verify the signature to ensure authenticity:

JavaScript
// Node.js example
const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload, 'utf8')
    .digest('hex');
  
  return `sha256=${expectedSignature}` === signature;
}

// Verify in your webhook handler
const isValid = verifyWebhookSignature(
  req.body, 
  req.headers['x-ancestor-signature'], 
  process.env.WEBHOOK_SECRET
);

Note: Webhook functionality is available for Pro and Enterprise plans.

SDKs & Libraries

Official SDKs and code examples to integrate Ancestor into your applications quickly.

PythonPython 3.10+
# Python SDK
pip install ancestor-python

from ancestor import Client
client = Client(api_key="your_key")

result = client.evaluate(
    question="What is the global temperature increase?",
    answer="According to NASA, global temperature has increased by 1.1°C since 1880",
    citations=[{"url": "https://climate.nasa.gov/evidence/"}]
)

print(f"Trust Score: {result.trust_score}")
print(f"Explanation: {result.explanation}")

# Access detailed factors
factors = result.factors
print(f"Source Quality: {factors.source_quality}")
print(f"Recency: {factors.recency}")
print(f"Provenance: {factors.provenance}")

Need help getting started? Check out our comprehensive documentation and examples.

View Full Documentation

Use Cases

Integrate source quality verification across your AI-powered applications and workflows.

LLM Applications

Verify sources in language model responses to ensure your AI applications provide trustworthy information to users.

  • • Real-time source validation for AI assistants
  • • Trust scoring for generated content
  • • Automated fact-checking workflows

RAG Systems

Score reliability of retrieved documents in RAG pipelines to improve the quality of context-aware responses.

  • • Document quality assessment
  • • Source ranking for retrieval
  • • Context reliability scoring

Conversational AI

Validate citations in chatbot responses to build user trust and ensure accurate information delivery.

  • • Citation validation for chatbots
  • • Trust indicators in conversations
  • • Source transparency features

Research Platforms

Assess source credibility in LLM-assisted research to maintain academic and professional standards.

  • • Academic source verification
  • • Research quality assurance
  • • Citation credibility analysis

Ready to enhance your application with source quality verification?

Contact for Early Access

Simple, transparent pricing

Choose the plan that fits your needs. Start free and scale as you grow.

Free

$0/month
1,000 evaluations/month
  • API access
  • Basic support
  • 100 requests/hour
  • Community support
Start Free
Most Popular

Pro

$29/month
10,000 evaluations/month
  • Everything in Free
  • Advanced analytics & insights
  • Priority email support
  • 1,000 requests/hour
  • Webhook support
  • Detailed audit trails

Enterprise

Custom
Volume pricing
  • Everything in Pro
  • Custom rate limits
  • Dedicated support
  • SLA guarantees
  • Custom integrations
Contact Sales

All plans include comprehensive API documentation, SDKs, and 99.9% uptime SLA.