Skip to main content

Configuration

Complete reference for all Knidian SDK configuration options.

Basic Configuration

The minimum configuration required to initialize the SDK:

const sdk = KnidianSDK.create({
authUrl: 'https://your-backend.com/api/knidian-auth',
userId: 'user-123',
container: '#knidian-container'
});

Required Options

authUrl

  • Type: string
  • Required: Yes
  • Description: Your backend endpoint that returns session tokens. See Backend Examples for implementation details.
authUrl: 'https://your-backend.com/api/knidian-auth'

Security Note: The SDK never uses API keys directly. Your API key stays secure on your backend server, and the SDK uses short-lived session tokens instead.

userId

  • Type: string
  • Required: Yes
  • Description: Unique identifier for the current user. Should be from your authentication system.
userId: 'user-123'

container

  • Type: string | HTMLElement
  • Required: Yes
  • Description: CSS selector or DOM element where the SDK will be rendered.
// Using CSS selector
container: '#knidian-container'

// Using DOM element
container: document.getElementById('knidian-container')

Optional Configuration

baseUrl

  • Type: string
  • Default: 'https://api.knidian.ai'
  • Description: Knidian API base URL. Only change if directed by Knidian support.
baseUrl: 'https://api-eu.knidian.ai'

sessionRefreshBuffer

  • Type: number (seconds)
  • Default: 300 (5 minutes)
  • Description: How many seconds before session expiry to automatically refresh the token.
sessionRefreshBuffer: 300 // Refresh 5 minutes before expiry

displayMode

  • Type: 'full-page'
  • Default: 'full-page'
  • Description: Display mode for the SDK interface.
displayMode: 'full-page'

Theme Configuration

Customize the SDK appearance. See Theming for details.

theme: {
fontFamily: 'Inter, sans-serif',
primaryColor: '#3b82f6',
secondaryColor: '#64748b',
errorColor: '#ef4444',
successColor: '#10b981',
backgroundColor: '#ffffff',
textColor: '#0f172a',
borderRadius: '0.5rem',
spacing: 'comfortable',
}

theme.fontFamily

  • Type: string
  • Default: System font stack
  • Description: Font family for all text in the SDK.

theme.primaryColor

  • Type: string (hex color)
  • Description: Primary brand color used for buttons and accents.

theme.secondaryColor

  • Type: string (hex color)
  • Description: Secondary color for less prominent elements.

theme.errorColor

  • Type: string (hex color)
  • Default: '#ef4444'
  • Description: Color for error messages and validation.

theme.successColor

  • Type: string (hex color)
  • Default: '#10b981'
  • Description: Color for success messages and confirmations.

theme.backgroundColor

  • Type: string (hex color)
  • Description: Background color for the SDK container.

theme.textColor

  • Type: string (hex color)
  • Description: Default text color.

theme.borderRadius

  • Type: string (CSS value)
  • Default: '0.5rem'
  • Description: Border radius for UI elements.

theme.spacing

  • Type: 'compact' | 'comfortable' | 'spacious'
  • Default: 'comfortable'
  • Description: Spacing density for UI elements.

Localization

Set the SDK language. See Localization for details.

locale: 'en' // 'en' | 'es' | 'pt'

locale

  • Type: 'en' | 'es' | 'pt'
  • Default: 'en'
  • Description: Language for all SDK text and messages.
    • 'en': English
    • 'es': Spanish (Español)
    • 'pt': Portuguese (Português)

Google Drive Integration

Enable Google Drive features. See Google Drive Guide for details.

googleDrive: {
clientId: 'your-google-client-id.apps.googleusercontent.com'
}

googleDrive.clientId

  • Type: string
  • Description: Your Google OAuth 2.0 client ID for Google Drive integration.

Complete Example

Here's a complete configuration example:

const sdk = KnidianSDK.create({
// Required
authUrl: 'https://your-backend.com/api/knidian-auth',
userId: currentUser.id,
container: '#knidian-container',

sessionRefreshBuffer: 300,
locale: 'es',

// Theme
theme: {
fontFamily: 'Inter, sans-serif',
primaryColor: '#3b82f6',
secondaryColor: '#64748b',
errorColor: '#ef4444',
successColor: '#10b981',
backgroundColor: '#ffffff',
textColor: '#0f172a',
borderRadius: '0.5rem',
spacing: 'comfortable',
},

// Google Drive
googleDrive: {
clientId: process.env.GOOGLE_CLIENT_ID,
},
});

Environment-Specific Configuration

Development

const config = {
authUrl: 'http://localhost:3000/api/knidian-auth',
userId: 'dev-user-123',
container: '#app',
};

Production

const config = {
authUrl: 'https://your-backend.com/api/knidian-auth',
userId: authenticatedUser.id,
container: '#app',
};

Next Steps