API Documentation

Integrate CiteRAG into your application with our simple REST API

POSThttp://localhost:8000/citerag/v0.1/
REST API
curl -X POST http://localhost:8000/citerag/v0.1/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
  "response": "The Moon is drifting away from Earth at a rate of about 3.8 cm per year.",
  "sources": [
    {
      "id": "src_001",
      "text": "Laser ranging experiments using reflectors left by Apollo astronauts show that the Moon's orbit is expanding. It moves away from Earth at 3.8 centimeters annually."
    },
    {
      "id": "src_002",
      "text": "The Moon was formed roughly 4.5 billion years ago, likely from a collision between Earth and a Mars-sized body."
    }
  ]
}'

Response Schema

FieldTypeDescription
okbooleanWhether the request was successful
user_idnumberUser ID making the request
remaining_quotanumberRemaining API quota for the user
context_matchedbooleanIndicates if the source context aligns with the response. When true, the surrounding context of the matched text supports the claim being made.
equivalency_matchedbooleanIndicates if the facts are semantically equivalent. When true, the source and response convey the same factual information, even if worded differently.
semantically_matchedbooleanIndicates semantic similarity between source and response. Uses advanced NLP to determine if the meaning is preserved across different phrasings.
scorenumber (0-3)The confidence score of the citation. Higher scores indicate stronger matches:
  • 3 - High confidence (all criteria met)
  • 2 - Medium confidence (two criteria met)
  • 1 - Low confidence (one criterion met)
  • 0 - No match
matched_sentencesstring[]Array of sentences from the source that match the response

💡 Pro Tip

Use the score field to filter citations by confidence level. A score of 3 indicates the highest confidence with all matching criteria met (context, equivalency, and semantic similarity).