API Documentation
Integrate Nairi into your applications with our REST API. All endpoints require authentication unless otherwise noted.
Authorization: Bearer YOUR_SESSION_TOKENSession tokens are obtained through Supabase Auth after signing in. Use the Supabase client library to manage authentication.
Endpoints
/auth/sign-up/auth/sign-in/auth/sign-outCreate a new user account
Sign in with email and password
Sign out current user
/api/chatSend a message to AI and stream response
/api/createGenerate content (presentations, websites, etc.)
/api/credits/api/credits/earn/api/credits/earn/api/credits/referralGet user's credit balance and stats
Get available rewards to claim
Claim a reward
Process referral signup
/api/marketplace/search/api/marketplace/purchase/api/marketplace/reviews/api/marketplace/reviewsSearch for agents
Purchase an agent
Get agent reviews
Submit a review
/api/profile/api/profile/api/profileGet current user's profile
Update profile information
Request account deletion
/api/traces/api/traces/api/tracesGet execution traces history
Start a new execution trace
Complete an execution trace
Code Examples
// Send a chat message
const response = await fetch('/api/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_SESSION_TOKEN'
},
body: JSON.stringify({
messages: [
{ role: 'user', content: 'Hello, how are you?' }
],
conversationId: 'optional-conversation-id',
mode: 'default' // or 'debate', 'reasoning', 'tutor', 'creator'
})
})
// Response is a stream
const reader = response.body.getReader()// Get credit balance
const response = await fetch('/api/credits', {
headers: {
'Authorization': 'Bearer YOUR_SESSION_TOKEN'
}
})
const { balance, dailyLimit, resetIn, streak } = await response.json()
// Claim a reward
const claimResponse = await fetch('/api/credits/earn', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_SESSION_TOKEN'
},
body: JSON.stringify({
rewardType: 'watch' // or 'activity', 'streak'
})
})Free tier: 100 requests/minute
Pro tier: 1000 requests/minute
Business tier: Custom limits
{
"success": true,
"data": { ... },
"error": null
}