Backend Settings
Configure your InAppAI backend at app.inappai.com to control AI behavior, authentication, and API access.
Dashboard Overview
Log in to app.inappai.com to access your subscription dashboard:
- Subscription Details - Your Agent ID, plan, and usage
- Settings - Configure AI provider, model, and authentication
- Knowledge Base - Add URLs for RAG (Retrieval Augmented Generation)
- Usage - Monitor request counts and billing period status
- Billing - Manage payment method and subscription plan
Getting Your Agent ID
Your Agent ID is required for the React component:
- Go to app.inappai.com
- Sign in or create an account
- Create a subscription
- Copy your Agent ID from the dashboard
Use it in your React app:
<InAppAI
agentId="your-agent-id" // Your Agent ID from the dashboard
/>
AI Provider and Model Selection
Choose which AI provider and model to use for your chat assistant.
Supported Providers
InAppAI supports three major AI providers:
- OpenAI - GPT models
- Anthropic - Claude models
- Google - Gemini models
Available models are shown in the dashboard and updated regularly.
Selecting Your Model
- Navigate to Settings in your dashboard
- Choose AI Provider (OpenAI, Anthropic, or Google)
- Select Model from available options
- Click Save
Changes take effect immediately for all new chat requests.
CORS Configuration
Configure which domains can access your backend API.
Allowed Origins
Add your website domains to the Allowed Origins list:
- Go to Settings → CORS
- Add your domain (e.g.,
https://yourdomain.com) - For development, add
http://localhost:3000(or your dev port) - Click Save
Example:
https://myapp.com
https://www.myapp.com
http://localhost:3000
http://localhost:5173
Important: Do NOT use wildcards (*) in production. Always specify exact domains.
Testing CORS
If you see CORS errors in the browser console:
- Check that your domain is in the Allowed Origins list
- Ensure the domain matches exactly (including
https://vshttp://) - Verify there are no trailing slashes
- Check browser console for the exact origin being sent
JWT Authentication (Optional)
Add an extra layer of security by requiring JWT tokens from your users.
When to Use JWT
Use JWT authentication if:
- You have user accounts in your application
- You want to identify which user is chatting
- You need to enforce per-user rate limits
- You want to personalize responses based on user identity
Skip JWT if: You’re building a public website or don’t have user authentication.
JWT Setup
Generate a secret key in your backend:
openssl rand -base64 32Configure JWT in dashboard:
- Go to Settings → Authentication
- Select JWT as authentication method
- Enter your JWT Secret (used to sign tokens)
- Click Save
Sign JWT tokens in your backend:
// Node.js example const jwt = require('jsonwebtoken'); const token = jwt.sign( { userId: user.id, email: user.email, // Add any custom claims }, process.env.JWT_SECRET, { expiresIn: '1h' } );Pass JWT to React component:
<InAppAI agentId="your-agent-id" jwtToken={userJwtToken} // Pass the signed JWT />
JWT Token Claims
Your JWT token can include:
userId- User identifieremail- User emailname- User display namerole- User role (admin, user, etc.)- Custom claims specific to your application
Example JWT payload:
{
"userId": "user_123",
"email": "alice@example.com",
"name": "Alice Chen",
"role": "admin",
"iat": 1703001234,
"exp": 1703004834
}
Rate Limiting
InAppAI automatically rate limits requests to prevent abuse.
Default Limits
- Per subscription: 60 requests per minute
- Per IP address: 30 requests per minute (for public APIs)
How It Works
When rate limits are exceeded:
- Request returns
429 Too Many Requestsstatus - Response includes
Retry-Afterheader - React component shows “Too many requests” message
Best Practices
- Implement request debouncing in your UI
- Show loading states to prevent duplicate requests
- Handle 429 errors gracefully in your application
Usage Tracking and Limits
Monitor your subscription usage and billing.
Usage Metrics
View in Usage dashboard:
- Requests this period: Current billing period request count
- Limit: Total requests allowed per month
- Usage percentage: How much of your quota is used
- Resets on: Next billing period start date
Usage Alerts
InAppAI sends email alerts at:
- 50% usage - Halfway through your quota
- 75% usage - Three-quarters used
- 90% usage - Approaching limit
- 100% usage - Quota exhausted
What Happens at 100% Usage
When you reach your request limit:
- API returns
402 Payment Requiredstatus - React component shows upgrade message
- No additional requests are processed until:
- Billing period resets, or
- You upgrade to a higher plan
Checking Usage Programmatically
You can’t currently check usage via API. Monitor the dashboard or wait for email alerts.
Subscription Plans
Developer Plan (Free)
- Requests: 1,000/month
- Knowledge Base: 10 KB URLs
- Support: Community support
Startup Plan ($89/month)
- Requests: 50,000/month
- Knowledge Base: 100 KB URLs
- Support: Email support
ScaleUp Plan ($299/month)
- Requests: 300,000/month
- Knowledge Base: 200 KB URLs
- Support: Priority email support
Changing Plans
To upgrade or downgrade:
- Go to Billing → Change Plan
- Select new plan
- Confirm change
Upgrades: Take effect immediately, prorated billing Downgrades: Take effect at next billing period
Cancellation
To cancel your subscription:
- Go to Billing → Cancel Subscription
- Confirm cancellation
- Access continues until end of current billing period
Testing Your Configuration
Test Chat Endpoint
Use curl to test your backend:
curl -X POST https://app.inappai.com/api/your-agent-id/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "Hello, can you hear me?"
}
]
}'
Expected response:
{
"role": "assistant",
"content": "Yes, I can hear you! How can I help you today?"
}
Test with JWT
If using JWT authentication:
curl -X POST https://app.inappai.com/api/your-agent-id/chat \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}'
Test Health Endpoint
Check if your subscription is active:
curl https://app.inappai.com/api/your-agent-id/health
Expected response:
{
"status": "ok",
"subscription": "your-agent-id"
}
Troubleshooting
“Invalid Agent ID” Error
Problem: React component shows “Invalid Agent ID”
Solution:
- Copy Agent ID from the dashboard (Subscription Details section)
- Use the exact ID without modification
- Check for typos or extra spaces
- Verify subscription is active (not cancelled)
CORS Error
Problem: Browser console shows “CORS policy” error
Solution:
- Add your domain to Allowed Origins in dashboard
- Include protocol (
https://) and exact domain - For development, add
http://localhost:PORT - Clear browser cache and reload
“Payment Required” Error
Problem: API returns 402 status code
Solution:
- Check usage in dashboard
- Wait for billing period to reset, or
- Upgrade to a higher plan
Rate Limit Error
Problem: API returns 429 status code
Solution:
- Wait 60 seconds before retrying
- Check for request loops or duplicate calls
- Implement request debouncing in your UI
Next Steps
- Knowledge Base - Add custom documentation for better responses
- React Installation - Integrate the React component
- Function Calling - Enable AI to execute actions
Need Help?
- Dashboard - Manage your subscription
- GitHub Issues - Report problems
- Contact: Contact Us