{
    "success": true,
    "timestamp": "2026-06-29T23:41:49+07:00",
    "data": {
        "title": "YaTTi API User Guide",
        "format": "markdown",
        "content": "# YaTTi API User Guide\n\n## Welcome to YaTTi Knowledgebase API\n\nThe YaTTi (Yayasan Teknologi Terbuka Indonesia - Indonesian Open Technology Foundation) API provides access to multiple specialized knowledgebases with AI-powered search and response generation capabilities.\n\n## Quick Start\n\n### 1. Get Your API Key\n\nTo use the YaTTi API, you need an API key. Contact your system administrator to obtain one, or use the demo key for testing:\n\n**Demo API Key**: `okusi_4d2bf6aa68a9c33c34d68e31d262076f638eb81ea6dbc451`\n\n### 2. API Base URL\n\nAll API requests should be made to:\n```\nhttps://yatti.id/v1/\n```\n\n### 3. Authentication\n\nInclude your API key in the request header:\n```\nX-API-Key: your-api-key-here\n```\n\n## Available Knowledgebases\n\nThe API provides access to these specialized knowledgebases:\n\n| Knowledgebase | Description | Example Topics |\n|----------------|-------------|----------------|\n| **appliedanthropology** | Applied Anthropology Resources | Cultural studies, social research, ethnography |\n| **seculardharma** | Secular Dharma & Mindfulness | Meditation, mindfulness practices, Buddhist philosophy |\n| **okusiassociates** | Okusi Associates Resources | Business consulting, organizational development |\n| **wayang.net** | Indonesian Wayang Culture | Traditional puppetry, Indonesian culture, wayang stories |\n| **peraturan.go.id** | Indonesian Legal Regulations | Laws, regulations, government policies |\n| **jakartapost** | Jakarta Post News Archive | Indonesian news, current events, journalism |\n| **prosocial.world** | Prosocial World Resources | Cooperation, social behavior, community building |\n| **okusimail** | Okusi Mail Archive | Email communications, correspondence |\n| **okusiresearch** | Okusi Research Database | Research papers, studies, academic work |\n| **ollama** | Ollama Documentation | AI model documentation, LLM tools |\n| **uv** | UV Package Manager Docs | Python package management, development tools |\n\n## Common Use Cases\n\n### 1. Simple Information Query\n\n**Ask a question about dharma and meditation:**\n\n```bash\ncurl -X POST https://yatti.id/v1/query \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-API-Key: okusi_4d2bf6aa68a9c33c34d68e31d262076f638eb81ea6dbc451\" \\\n  -d '{\n    \"knowledgebase\": \"seculardharma\",\n    \"query\": \"What is mindfulness meditation and how do I practice it?\",\n    \"options\": {\n      \"temperature\": 0.3\n    }\n  }'\n```\n\n### 2. Research Query with Sources\n\n**Get information about applied anthropology with source references:**\n\n```bash\ncurl -X POST https://yatti.id/v1/query \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-API-Key: okusi_4d2bf6aa68a9c33c34d68e31d262076f638eb81ea6dbc451\" \\\n  -d '{\n    \"knowledgebase\": \"appliedanthropology\",\n    \"query\": \"How is ethnographic research used in product design?\",\n    \"options\": {\n      \"top_k\": 10,\n      \"model\": \"gpt-5.2\",\n      \"prompt_template\": \"scholarly\"\n    }\n  }'\n```\n\n### 3. Legal Information Lookup\n\n**Search Indonesian regulations about technology:**\n\n```bash\ncurl -X POST https://yatti.id/v1/query \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-API-Key: okusi_4d2bf6aa68a9c33c34d68e31d262076f638eb81ea6dbc451\" \\\n  -d '{\n    \"knowledgebase\": \"peraturan.go.id\",\n    \"query\": \"What are the regulations for data protection and privacy in Indonesia?\",\n    \"options\": {\n      \"top_k\": 15,\n      \"temperature\": 0.1,\n      \"prompt_template\": \"technical\"\n    }\n  }'\n```\n\n### 4. Context-Only Search (No AI Response)\n\n**Get raw context matches without AI processing:**\n\n```bash\ncurl -X POST https://yatti.id/v1/query \\\n  -H \"Content-Type: application/json\" \\\n  -H \"X-API-Key: okusi_4d2bf6aa68a9c33c34d68e31d262076f638eb81ea6dbc451\" \\\n  -d '{\n    \"knowledgebase\": \"okusiassociates\",\n    \"query\": \"organizational change management\",\n    \"options\": {\n      \"top_k\": 5,\n      \"context_only\": true\n    }\n  }'\n```\n\n## Query Options Explained\n\n### Basic Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `top_k` | integer | 5 | Number of relevant documents to retrieve (1-100) |\n| `temperature` | float | 0.0 | AI creativity level (0.0 = focused, 2.0 = creative) |\n| `context_only` | boolean | false | Return only matching documents without AI response |\n\n### Advanced Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `model` | string | \"gpt-5.2\" | AI model to use (All latest LLMs from OpenAI, Anthropic, and Google) |\n| `max_tokens` | integer | - | Maximum length of AI response |\n| `context_scope` | integer | 3 | Context segments to include per result (typically 1-10) |\n| `prompt_template` | string | \"default\" | Response style (see templates below) |\n| `cache_ttl` | integer | 86400 | Cache duration in seconds (24 hours) |\n| `force_refresh` | boolean | false | Bypass cache for fresh results |\n| `timeout` | integer | 60 | Query timeout in seconds (default: 60, max: 600) |\n\n### Prompt Templates\n\n- **default**: Standard helpful assistant response\n- **instructive**: Educational with step-by-step explanations\n- **scholarly**: Academic tone with citations and references\n- **concise**: Brief, to-the-point answers\n- **analytical**: Detailed analysis and breakdown\n- **conversational**: Friendly, casual tone\n- **technical**: Technical documentation style\n\n## Response Format\n\n### Successful Query Response\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"query_id\": \"q_abc123def456\",\n    \"knowledgebase\": \"seculardharma\",\n    \"query\": \"What is mindfulness?\",\n    \"response\": \"Mindfulness is the practice of maintaining moment-to-moment awareness...\",\n    \"contexts\": [\n      {\n        \"source\": \"mindfulness-basics.md\",\n        \"content\": \"Mindfulness involves paying attention to the present moment...\"\n      }\n    ],\n    \"metadata\": {\n      \"processing_time\": 2.5,\n      \"tokens_used\": 1200,\n      \"model_used\": \"gpt-5.2\",\n      \"cached\": false,\n      \"documents_searched\": 450\n    }\n  },\n  \"timestamp\": \"2025-09-13T10:30:00+07:00\"\n}\n```\n\n### Error Response\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"message\": \"Invalid API key\",\n    \"code\": 401\n  },\n  \"timestamp\": \"2025-09-13T10:30:00+07:00\"\n}\n```\n\n## Other Useful Endpoints\n\n### Check API Status\n\n```bash\ncurl https://yatti.id/v1/status\n```\n\n### List Available Knowledge Bases\n\n```bash\ncurl -H \"X-API-Key: your-api-key\" \\\n     https://yatti.id/v1/knowledgebases\n```\n\n### Get Knowledge Base Details\n\n```bash\ncurl -H \"X-API-Key: your-api-key\" \\\n     https://yatti.id/v1/knowledgebases/seculardharma\n```\n\n### Retrieve Previous Query\n\n```bash\ncurl -H \"X-API-Key: your-api-key\" \\\n     https://yatti.id/v1/query/q_abc123def456\n```\n\n### View Query History\n\n```bash\ncurl -H \"X-API-Key: your-api-key\" \\\n     \"https://yatti.id/v1/query?limit=10\"\n```\n\n## Using the Command-Line Client (v1.3.5)\n\n### Install the YaTTi CLI\n\n#### Quick Install (Recommended)\n```bash\n# One-liner installation with auto-configuration\ncurl -fsSL https://yatti.id/v1/install | bash\n```\n\nThis intelligent installer will:\n- Auto-detect the best installation location\n- Download and verify the client script\n- Auto-configure with demo API key for immediate testing\n- Request sudo only if needed for system-wide installation\n\n#### Manual Installation\n```bash\n# Download to current directory\ncurl -o yatti-api https://yatti.id/v1/client/download\nchmod 755 yatti-api\n\n# Install system-wide (recommended)\nsudo mv yatti-api /usr/local/bin/\n\n# Or install in user directory (no sudo required)\nmkdir -p ~/bin\nmv yatti-api ~/bin/\necho 'export PATH=\"$HOME/bin:$PATH\"' >> ~/.bashrc\nsource ~/.bashrc\n\n# Configure with your API key\nyatti-api configure\n```\n\n### Keep Your Client Updated\n\nThe YaTTi CLI has built-in self-update capability:\n\n```bash\n# Check current version\nyatti-api version\n\n# Check for available updates\nyatti-api update --check\n\n# Update to latest version\nyatti-api update\n\n# Force reinstall (useful if having issues)\nyatti-api update --force\n```\n\n**Note**: System-wide installations will automatically request sudo when needed for updates.\n\n### New in v1.4.0\n\n**Retry Logic**: The client automatically retries transient failures (HTTP 429, 5xx) with exponential backoff:\n\n```bash\n# Configure retry behavior via environment variables\nexport YATTI_MAX_RETRIES=3        # Max retry attempts (default: 3, set to 1 to disable)\nexport YATTI_TIMEOUT=60           # Request timeout in seconds (default: 60)\nexport YATTI_CONNECT_TIMEOUT=10   # Connection timeout in seconds (default: 10)\n```\n\n**Large Query Support**: Handle queries of unlimited size via file input:\n\n```bash\n# Query from file (for large queries)\nyatti-api query -K seculardharma -Q /path/to/query.txt\n\n# Query from stdin\necho \"What is the nature of suffering?\" | yatti-api query -K seculardharma -q -\n\n# Pipe from another command\ncat document.txt | yatti-api query -K appliedanthropology -q -\n```\n\n**Man Page**: Full documentation available via `man yatti-api` (if installed via the installer).\n\n### CLI Examples\n\n```bash\n# Simple query\nyatti-api query seculardharma \"What is mindfulness?\"\n\n# Query with explicit knowledgebase option\nyatti-api query -K jakartapost -q \"Who is Soeharto?\"\n\n# Query with multiple options\nyatti-api query -K ollama -q \"Explain LLMs\" --model gpt-5.2 --top-k 10\n\n# Query with prompt template and max tokens\nyatti-api query -K arxiv -q \"Quantum computing\" -p scholarly -M 2000\n\n# Context-only search (no AI response)\nyatti-api query -K wikipedia -q \"Python programming\" -c\n\n# Query with timeout for large knowledgebases\nyatti-api query -K jakartapost -q \"Economic news\" --timeout 300\n\n# List knowledgebases\nyatti-api kb list\n\n# View query history\nyatti-api history\nyatti-api history 20 jakartapost  # Last 20 queries from jakartapost\n\n# Check API status\nyatti-api status\nyatti-api status health  # Detailed health check\nyatti-api status info    # System information\n\n# View documentation\nyatti-api docs           # User documentation\nyatti-api docs api       # API documentation\nyatti-api docs technical # Developer documentation\n\n# Get help for any command\nyatti-api help\nyatti-api query --help\n```\n\n## Best Practices\n\n### 1. Choose the Right Knowledge Base\nSelect the knowledge base most relevant to your query for best results.\n\n### 2. Optimize Query Performance\n- Use `context_only: true` for faster responses when you don't need AI processing\n- Smaller `top_k` values (3-10) are faster than larger ones\n- Cached queries return instantly - use default cache settings when possible\n\n### 3. Craft Effective Queries\n- Be specific and clear in your questions\n- Include relevant context or domain terms\n- For technical queries, use technical terminology\n\n### 4. Select Appropriate Options\n- Use low temperature (0.0-0.3) for factual queries\n- Use higher temperature (0.7-1.0) for creative responses\n- Choose prompt templates that match your needs\n\n### 5. Handle Rate Limits\n- Default: 100 requests per hour\n- Check response headers for rate limit status\n- The CLI client (v1.4.0+) automatically handles retries with exponential backoff\n\n## Language Support\n\nWhile the API interface is in English, the knowledge bases contain content in multiple languages:\n- **Indonesian**: peraturan.go.id, wayang.net, some jakartapost content\n- **English**: Most knowledge bases primarily in English\n- Mixed language queries are supported\n\n## Troubleshooting\n\n### Common Issues\n\n**401 Unauthorized Error**\n- Verify your API key is correct\n- Ensure the X-API-Key header is properly formatted\n\n**404 Knowledge Base Not Found**\n- Check the knowledge base name spelling\n- Use `/v1/knowledgebases` endpoint to list available KBs\n\n**500 Internal Server Error**\n- Query may be too complex - try simplifying\n- Reduce `top_k` or `max_tokens` values\n- Contact administrator if issue persists\n\n**Slow Response Times**\n- Use `context_only: true` for faster results\n- Reduce `top_k` value\n- Check if query is cached (subsequent identical queries are faster)\n\n## Python Example\n\n```python\nimport requests\nimport json\n\n# API configuration\nAPI_KEY = \"okusi_4d2bf6aa68a9c33c34d68e31d262076f638eb81ea6dbc451\"\nAPI_URL = \"https://yatti.id/v1/query\"\n\n# Headers\nheaders = {\n    \"Content-Type\": \"application/json\",\n    \"X-API-Key\": API_KEY\n}\n\n# Query data\ndata = {\n    \"knowledgebase\": \"appliedanthropology\",\n    \"query\": \"What are the key methods in ethnographic research?\",\n    \"options\": {\n        \"top_k\": 5,\n        \"temperature\": 0.3\n    }\n}\n\n# Make request\nresponse = requests.post(API_URL, headers=headers, json=data)\n\n# Handle response\nif response.status_code == 200:\n    result = response.json()\n    if result[\"success\"]:\n        print(result[\"data\"][\"response\"])\n    else:\n        print(f\"Error: {result['error']['message']}\")\nelse:\n    print(f\"HTTP Error: {response.status_code}\")\n```\n\n## JavaScript Example\n\n```javascript\nconst API_KEY = 'okusi_4d2bf6aa68a9c33c34d68e31d262076f638eb81ea6dbc451';\nconst API_URL = 'https://yatti.id/v1/query';\n\nasync function queryKnowledgeBase(kb, question) {\n  const response = await fetch(API_URL, {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application/json',\n      'X-API-Key': API_KEY\n    },\n    body: JSON.stringify({\n      knowledgebase: kb,\n      query: question,\n      options: {\n        top_k: 5,\n        temperature: 0.3\n      }\n    })\n  });\n\n  const data = await response.json();\n  \n  if (data.success) {\n    console.log(data.data.response);\n  } else {\n    console.error('Error:', data.error.message);\n  }\n}\n\n// Example usage\nqueryKnowledgeBase('seculardharma', 'What is mindfulness meditation?');\n```\n\n## Support\n\nFor technical support or to request an API key:\n- Contact your system administrator\n- Visit https://yatti.id for more information\n- Email support for assistance\n\n## Terms of Use\n\n- API keys are for authorized use only\n- Do not share your API key publicly\n- Respect rate limits and usage guidelines\n- Content from knowledge bases may have specific licensing terms\n\n---\n\n*Last updated: October 2025*\n*API Version: 1.0.1*\n*Client Version: 1.3.5*\n*Installer Version: 1.0.0*\n",
        "available_docs": {
            "/v1/docs": "User documentation (this document)",
            "/v1/docs/api": "API technical documentation",
            "/v1/docs/technical": "Developer README",
            "/v1/docs/raw": "Raw markdown (user docs)"
        }
    }
}