Back to App

API Documentation

Reypub Open-AI - Permanent API keys, custom instructions & knowledge injection

Persistent (D1) Permanent Keys Knowledge Injection Custom Instructions

Quick Start - Get Your Permanent API Key

Keys are stored in our D1 database - they persist forever across deployments. Add custom instructions and knowledge to shape your bot's behavior.

Key Management

POST/api/keys/generate

Create a permanent API key with instructions and knowledge.

Request Body
{ "name": "My Bot", "instructions": "Be helpful and concise", "knowledge": "Our products: Widget A ($10), Widget B ($20)", "rateLimit": 30 }
POST/api/keys/updateAuth

Update instructions, knowledge, name, or rate limit of your key.

curl
curl -X POST YOUR_DOMAIN/api/keys/update \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "instructions": "Updated instructions", "knowledge": "New facts and data for the bot" }'

Chat API v1

POST/api/v1/chatAuth

Chat with organized answers. Instructions + knowledge are auto-applied. Returns structured response with sections.

curl
curl -X POST YOUR_DOMAIN/api/v1/chat \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"message":"What is quantum computing?"}'
JavaScript
const res = await fetch('/api/v1/chat', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_KEY' }, body: JSON.stringify({ message: 'Hello!' }) }); const data = await res.json(); // data.answer contains organized sections // data.sources, data.webResults, data.questionType

Public Endpoints

GET/api/search?q=...

Free web search. No key needed.

POST/api/chat

Basic chat. For persistent keys & instructions, use /api/v1/chat.

GET/api/info

System information.

Usage Tips

  • Permanent Keys - Stored in D1 database. Persist across deployments.
  • Instructions - Set behavior rules applied to every request.
  • Knowledge - Inject facts/data the bot uses to answer.
  • Organized Answers - Responses include sections: Direct Answer, Full Analysis, Key Facts.
  • CORS Enabled - Call from any frontend.
  • Two Auth Methods - Authorization: Bearer KEY or X-API-Key: KEY