REST API · v1

API Documentation

Programmatically optimize any URL or raw text for AI engines. JSON in, citation-ready Markdown out.

Overview

The RAGify API restructures content into BLUF summaries, question-based H2s, semantic tables, and FAQ schema so AI engines (ChatGPT, Perplexity, Claude) can ingest and cite it. Each successful optimize consumes 1 credit from your plan.

Base URLhttps://aipriva.com/api/public/v1
Required planGrowth · Agency
FormatJSON · UTF-8

Authentication

Send your API key as a Bearer token in the Authorization header. Keys start with rag_live_ and are shown exactly once at creation time — store them securely. Generate keys from your dashboard.

Authorization: Bearer rag_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Endpoints

POST/optimize

Submit a URL or raw text. Returns optimized Markdown plus the document id.

Request

{
  "url": "https://example.com/post",
  // — or —
  "rawText": "Long article text…"
}

Response

{
  "id": "8b0a…",
  "status": "completed",
  "title": "Page title",
  "optimized_markdown": "## TL;DR …",
  "credits_remaining": 248
}
GET/documents/{id}

Fetch a previously optimized document by id.

Response

{
  "id": "8b0a…",
  "title": "…",
  "status": "completed",
  "optimized_markdown": "## TL;DR …",
  "created_at": "2026-06-15T…"
}
GET/usage

Returns your current plan, credit balance, and billing reset date.

Response

{
  "plan": "growth",
  "plan_name": "Growth",
  "api_access": true,
  "monthly_credits": 250,
  "credits_remaining": 248,
  "billing_cycle_reset": "2026-07-10T…"
}

Code samples

Three ways to call POST /optimize. Set the RAGIFY_API_KEY environment variable to your key.

curl -X POST https://aipriva.com/api/public/v1/optimize \
  -H "Authorization: Bearer rag_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/blog/post" }'

Errors

All errors return a JSON body with an `error` object containing a stable `code` and a human-readable `message`.

HTTPCodeMeaning
400invalid_inputBody invalid or URL unreachable
401unauthorizedMissing or invalid API key
402insufficient_creditsPlan credits exhausted
403forbidden_planPlan does not include API access
404not_foundDocument not found
500internal_errorServer-side failure

Versioning

All endpoints live under /v1 and are stable. Breaking changes will ship under /v2 with at least 90 days of advance notice.