Project Settings
Project settings configure how your frontend applications connect to Distri Cloud. The key component is the Client ID, which allows browser-based applications to invoke agents securely.
Client ID
A Client ID is a public identifier that enables frontend applications to call Distri APIs directly from the browser.
Creating a Client ID
- Go to app.distri.dev/settings/project
- Click Generate Client ID
- Copy the generated ID
Using the Client ID
import { DistriProvider, Chat } from '@distri/react';
function App() {
return (
<DistriProvider config={{ clientId: 'YOUR_CLIENT_ID' }}>
<Chat agentId="my_agent" />
</DistriProvider>
);
}
Allowed Origins (CORS)
Control which domains can use your Client ID.
Configuring Origins
- Go to Project Settings
- Find Allowed Origins
- Add your domains (e.g.,
https://myapp.com) - Click Save
Origin Format
- Include the protocol:
https://myapp.com - Include port if non-standard:
http://localhost:3000 - No trailing slash
Examples
https://myapp.com
https://app.mycompany.com
http://localhost:3000
http://localhost:5173
Allow All Origins
Leave the list empty to allow requests from any origin. This is useful for development but not recommended for production.
Restricting origins prevents unauthorized sites from using your Client ID and consuming your quota.
Client ID vs API Key
| Feature | Client ID | API Key |
|---|---|---|
| Visibility | Public (in browser) | Secret (server only) |
| Access | Read + invoke only | Full account access |
| CORS | Respects allowed origins | N/A |
| Use case | Frontend apps | Backend services |
When to Use Client ID
- React/Vue/Angular applications
- Embedded chat widgets
- Public-facing web apps
- Mobile apps (with origin restrictions)
When to Use API Key
- Node.js backends
- Cron jobs and webhooks
- Server-to-server integrations
- Admin scripts
Permissions
Client IDs have limited permissions:
| Action | Allowed |
|---|---|
| Invoke agents | ✅ |
| List agents | ✅ |
| Get agent details | ✅ |
| Create threads | ✅ |
| Send messages | ✅ |
| Read thread history | ✅ |
| Modify agents | ❌ |
| Access secrets | ❌ |
| Manage API keys | ❌ |
Regenerating Credentials
If you need to invalidate an existing Client ID:
- Go to Project Settings
- Click Regenerate
- Update your applications with the new ID
- The old ID stops working immediately
Multiple Environments
For separate dev/staging/prod configurations:
- Create separate Distri accounts for each environment
- Each account has its own Client ID
- Use environment variables in your app:
const config = {
clientId: process.env.REACT_APP_DISTRI_CLIENT_ID
};
<DistriProvider config={config}>
<Chat agentId="my_agent" />
</DistriProvider>
Troubleshooting
"CORS error" in browser console
- Check that your domain is in Allowed Origins
- Ensure the protocol matches exactly (
httpvshttps) - Include the port for non-standard ports
"Unauthorized" errors
- Verify the Client ID is correct
- Check that you're calling an agent you own or is public
- Ensure your account is active
Requests from localhost not working
Add http://localhost:3000 (or your port) to Allowed Origins.