Authentication & Security
publishableKey
Your publishable key authenticates your application with Flatfile. This key is safe to include in client-side code. Where to find it:- Log into Platform Dashboard
- Navigate to Developer Settings → API Keys
- Copy your Publishable Key (starts with
pk_
)
Security Best Practices
Environment Variables
Store your publishable key in environment variables rather than hardcoding:Common Configuration Options
These options are shared across all SDK implementations:Authentication
Option | Type | Required | Description |
---|---|---|---|
publishableKey | string | ✅ | Your publishable key from Platform Dashboard |
User Identity
Option | Type | Required | Description |
---|---|---|---|
userInfo | object | ❌ | User metadata for space creation |
userInfo.userId | string | ❌ | Unique user identifier |
userInfo.name | string | ❌ | User’s display name - this is displayed in the dashboard as the associated user |
userInfo.companyId | string | ❌ | Company identifier |
userInfo.companyName | string | ❌ | Company display name |
externalActorId | string | ❌ | Unique identifier for embedded users |
Space Setup
Option | Type | Required | Description |
---|---|---|---|
name | string | ✅ | Name of the space |
environmentId | string | ✅ | Environment identifier |
spaceId | string | ❌ | ID of existing space to reuse |
workbook | object | ❌ | Workbook configuration for dynamic spaces |
listener | Listener | ❌ | Event listener for responding to events |
Look & Feel
Option | Type | Required | Description |
---|---|---|---|
themeConfig | object | ❌ | Theme values for Space, sidebar and data table |
spaceBody | object | ❌ | Space options for creating new Space; used with Angular and Vue SDKs |
sidebarConfig | object | ❌ | Sidebar UI configuration |
sidebarConfig.defaultPage | object | ❌ | Landing page configuration |
sidebarConfig.showDataChecklist | boolean | ❌ | Toggle data config, defaults to false |
sidebarConfig.showSidebar | boolean | ❌ | Show/hide sidebar |
document | object | ❌ | Document content for space |
document.title | string | ❌ | Document title |
document.body | string | ❌ | Document body content (markdown) |
CSS Customization
You can customize the embedded Flatfile iframe and its container elements using CSS variables and class selectors. This allows you to control colors, sizing, borders, and other visual aspects of the iframe wrapper to match your application’s design.CSS Variables
Define these CSS variables in your application’s stylesheet to control the appearance of Flatfile’s embedded components:Container Elements
Target these elements to customize the iframe container:Modal Display Customization
WhendisplayAsModal
is set to true
, customize the modal appearance:
Exit Confirmation Dialog
Customize the confirmation dialog that appears when closing Flatfile:Error Component
Customize the error display component:Basic Behavior
Option | Type | Required | Description |
---|---|---|---|
closeSpace | object | ❌ | Options for closing iframe |
closeSpace.operation | string | ❌ | Operation type |
closeSpace.onClose | function | ❌ | Callback when space closes |
displayAsModal | boolean | ❌ | Display as modal or inline (default: true) |
Advanced Configuration Options
These options provide specialized functionality for custom implementations:Space Reuse
Option | Type | Required | Description |
---|---|---|---|
id | string | ✅ | Space ID |
accessToken | string | ✅ | Access token for space (obtained server-side) |
accessToken
to the client. See Server Setup Guide for details.
UI Overrides
Option | Type | Required | Description |
---|---|---|---|
mountElement | string | ❌ | Element to mount Flatfile (default: “flatfile_iFrameContainer”) |
loading | ReactElement | ❌ | Custom loading component |
exitTitle | string | ❌ | Exit dialog title (default: “Close Window”) |
exitText | string | ❌ | Exit dialog text (default: “See below”) |
exitPrimaryButtonText | string | ❌ | Primary button text (default: “Yes, exit”) |
exitSecondaryButtonText | string | ❌ | Secondary button text (default: “No, stay”) |
errorTitle | string | ❌ | Error dialog title (default: “Something went wrong”) |
On-Premises Configuration
Option | Type | Required | Description |
---|---|---|---|
apiUrl | string | ❌ | API endpoint (default: “https://platform.flatfile.com/api”) |
spaceUrl | string | ❌ | Spaces API URL (default: “https://platform.flatfile.com/s”) |
Configuration Examples
Basic Space Creation
Space Reuse with Access Token
Advanced UI Customization
Troubleshooting
Invalid publishableKey
Error:"Invalid publishable key"
Solution:
- Verify key starts with
pk_
- Check for typos or extra spaces
- Ensure key is from correct environment
Space Not Found
Error:"Space not found"
or 403 Forbidden
Solution:
- Verify Space ID format (
us_sp_
prefix) - Ensure Space exists and is active
- Check Space permissions in dashboard
CORS Issues
Error:"CORS policy blocked"
Solution:
- Add your domain to allowed origins in Platform Dashboard
- Ensure you’re using publishable key (not secret key)
- Check browser network tab for specific CORS errors
Access Token Issues
Error:"Invalid access token"
when using space reuse
Solution:
- Ensure access token is retrieved server-side using secret key
- Check that token hasn’t expired
- Verify space ID matches the token
Testing Setup
For development and testing:Next Steps
Once configured:- Deploy your event listener to Flatfile
- Configure data validation and transformation rules
- Test the embedding in your application
- Deploy to production with production keys