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.
https://aipriva.com/api/public/v1Authentication
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_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxEndpoints
/optimizeSubmit 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
}/documents/{id}Fetch a previously optimized document by id.
Response
{
"id": "8b0a…",
"title": "…",
"status": "completed",
"optimized_markdown": "## TL;DR …",
"created_at": "2026-06-15T…"
}/usageReturns 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`.
| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_input | Body invalid or URL unreachable |
| 401 | unauthorized | Missing or invalid API key |
| 402 | insufficient_credits | Plan credits exhausted |
| 403 | forbidden_plan | Plan does not include API access |
| 404 | not_found | Document not found |
| 500 | internal_error | Server-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.