Overview
With API Data Sources, you can:- Connect External APIs: Configure secure connections to fetch user data from external systems
- Define Permission Rules: Automatically grant permissions based on API response data
- Enrich Conversations: Include relevant user context in AI agent conversations
- Test Configurations: Validate API connections and permission rules for specific users
Creating an API Data Source
Navigate to Settings > API Data Sources to create a new connection. Basic Settings:URL Placeholders
Use the following placeholders in your API URL, headers, or request body:<<email>>- User’s email address<<user_id>>- Internal user ID<<username>>- Username<<clerk_id>>- Clerk authentication ID<<api_key>>- Your configured API key
Authentication
API Key: Enter your API key in the dedicated field. It is encrypted and stored securely. Reference it in headers using the<<api_key>> placeholder.
Forward User Auth: Enable this option to pass the user’s authentication token to the external API. Useful when the external API needs to verify the user’s identity directly.
JWT Query Parameters
Map JWT claim values to URL query parameters for user-specific API calls. This allows you to pass information from the user’s authentication token directly as query parameters to the external API. Configuration: Each mapping consists of:- Parameter Name: The query parameter name to add to the URL
- JWT Claim Path: Dot-notation path to the value in the JWT claims (e.g.,
user.department)
department → user.department and a JWT containing:
https://api.example.com/data becomes https://api.example.com/data?department=Engineering.
If a JWT claim is missing or empty, that parameter is silently skipped. This feature requires JWT-authenticated widget users.
Response Configuration
Response Data Path: If your API wraps data in nested objects, specify the path to extract the relevant data using dot notation. For example, if your API returns:data.user to extract just the user object.
Caching
Permission Rules
Permission rules define conditions that, when matched against API data, automatically grant specific permissions to users.Creating a Permission Rule
- Navigate to your API Data Source
- Click Add Permission Rule
- Configure the rule name, priority, conditions, and permissions to grant
Conditions
Each condition has a field, operator, and value. All conditions in a rule must match (AND logic).Example
Grant premium permissions to users with an active premium subscription:Context Mappings
Context mappings extract fields from API responses and include them in AI conversations, giving agents relevant business context about users.Field Mapping Configuration
Enable Include in Conversation to share the mapped data with AI agents.
Prompt Template
Optionally customize how context data appears in AI conversations:Testing
Before deploying, test your configuration with real user data.- Navigate to your API Data Source
- Click Test API Connection
- Enter a test user identifier (email, user ID, etc.)
- Review the API response, matched rules, and granted permissions
