API Connections let you integrate external services into your app—like AI models, payment processors, analytics tools, and more. Bloom can automatically provide and manage API keys for you, or you can bring your own.
Why API connections matter
Most modern apps rely on external services:
AI & Machine Learning Connect to services like Google AI, OpenAI, or Anthropic to add smart features—chatbots, content generation, image analysis, etc.
Payments Integrate Stripe, PayPal, or other payment processors to accept payments in your app.
Analytics Track user behavior and app performance with services like Mixpanel, Segment, or Google Analytics.
Communication Send emails (SendGrid, Mailgun), SMS messages (Twilio), or push notifications (Firebase).
API keys are like passwords that let your app talk to external services securely. Bloom helps you manage them safely.
Auto-provisioned API keys
Bloom can automatically provide API keys for popular services, so you can start using them immediately without creating accounts or managing credentials yourself.
How it works
Enabled (Recommended)
Disabled
When auto-provisioning is ON: Bloom provides API keys automatically for supported services
Keys are securely managed and rotated by Bloom
Usage counts against your plan’s credits
No need to create external accounts or manage credentials
Start using services immediately
This is the fastest way to add external services to your app—perfect for development, testing, and most production use cases.
Supported services:
Google AI (Gemini models)
Additional services coming soon
Auto-provisioned keys are shared across your Bloom apps but isolated per project for security.
When auto-provisioning is OFF: You provide your own API keys for each service
Full control over API accounts and billing
Direct access to service dashboards and logs
Required for services not supported by Bloom provisioning
You’ll need to create accounts with each external service, generate API keys, and add them as environment variables in Bloom.
When to disable auto-provisioning:
You need specific API quotas or rate limits
You want direct billing from the service provider
You’re using services not yet supported by Bloom provisioning
Your organization requires managing all API credentials directly
Credit usage warning
API provisioning disabled - insufficient credits Your Bloom credits have been exhausted. API calls will fail until you upgrade your plan or disable API provisioning.
If you see this warning:
Upgrade your plan to get more credits (recommended for continued use)
Disable API provisioning and use your own API keys instead
Purchase credit top-ups from your billing dashboard
View plans and pricing Compare plans and see how credits are used
Environment Variables
Environment variables let you securely store API keys, configuration values, and other sensitive information your app needs to function.
What are environment variables?
Think of environment variables as a secure storage locker for your app’s secrets:
API keys from external services
Configuration values like feature flags or URLs
Credentials for databases or third-party services
They’re called “environment” variables because they’re specific to where your app is running (development vs. production) and kept separate from your code.
Environment variables are never exposed in your app’s frontend code or shared publicly. They’re only accessible from your backend functions.
Managing variables
Click 'Add Variable'
Opens a form to create a new environment variable.
Enter variable details
Name: What you’ll call this variable in your code (e.g., STRIPE_API_KEY)
Value: The actual key or configuration value
Use UPPERCASE_WITH_UNDERSCORES for variable names—it’s a common convention that makes them easy to identify.
Save the variable
The variable is immediately available in your Convex backend functions.
Use it in your code
Access the variable in your backend using process.env.VARIABLE_NAME // Example: Using an API key in a Convex function
const apiKey = process . env . GOOGLE_AI_API_KEY ;
Variable status indicators
Each variable shows its current status:
Provided by Bloom
In use
Not in use
This variable is auto-provisioned by Bloom. The API key is managed automatically and rotated for security. Example: Google_AI when auto-provisioning is enabledNo manual configuration needed
Counts against your plan credits
This variable is actively being used by your app’s backend functions. Your code is successfully accessing this variable
The service connection is working
If a variable shows no status badge, it’s defined but not currently being used in any backend functions. This might mean:
You added it but haven’t implemented the feature yet
The variable name doesn’t match what your code is looking for
The code using it isn’t being called
Actions for variables
Click the edit icon (pencil) to change a variable’s value. Changing a variable value will affect your live app immediately. Make sure you’re updating the correct variable!
Common reasons to edit:
Rotating API keys for security
Updating configuration values
Fixing incorrect credentials
Click the delete icon (trash can) to remove a variable. Deleting a variable that’s in use will cause errors in your app. Check that no functions depend on it before deleting.
Check logs after deleting to ensure no functions are trying to access the removed variable.
Click Refresh to reload the list of variables and their current status. Useful after:
Adding variables in the Convex dashboard directly
Making changes in another browser tab
Troubleshooting variable visibility issues
Common use cases
Adding a custom AI API key
If you want to use your own Google AI, OpenAI, or Anthropic API key:
Disable auto-provisioning
Toggle off “Automatically provision API keys” if it’s enabled.
Add as environment variable
Click “Add Variable” and enter:
Name: GOOGLE_AI_API_KEY (or appropriate name)
Value: Your API key from the provider
Update your code
Make sure your backend functions use process.env.GOOGLE_AI_API_KEY
Test the connection
Use your app’s AI features and check Logs for any errors
Connecting a payment processor
To add Stripe, PayPal, or another payment service:
Create an account
Sign up with your chosen payment processor (e.g., Stripe )
Get API credentials
Find your API keys in the service’s dashboard:
Stripe: Dashboard → Developers → API keys
Look for “Secret key” or “API key”
Add to environment variables
Name: STRIPE_SECRET_KEY (or provider-specific name)
Value: Your secret API key
Never use “publishable” keys in environment variables—only “secret” keys belong in the backend.
Implement payment logic
Use Bloom’s agent to help generate payment processing code, or follow the provider’s documentation
To track user behavior with Mixpanel, Segment, or Google Analytics:
Create analytics account
Sign up with your chosen analytics platform
Get tracking credentials
Each platform provides:
API key or Write key
Project ID or tracking ID
Add as environment variables
Example for Mixpanel:
MIXPANEL_TOKEN: Your project token
MIXPANEL_SECRET: Your API secret (if using server-side tracking)
Initialize tracking
Add tracking calls to your backend functions or frontend code as needed
Switching from Bloom-managed to custom keys
If you started with auto-provisioned keys but want to use your own:
Get your own API key
Create an account with the service provider and generate an API key
Add the new variable
Create an environment variable with your custom key (don’t delete the Bloom one yet)
Update your code
Change your functions to use the new variable name
Test thoroughly
Verify everything works with your custom key before proceeding
Disable auto-provisioning
Once confirmed working, toggle off auto-provisioning to stop using Bloom credits
Remove old variable (optional)
Delete the Bloom-provided variable if no longer needed
Security best practices
Never commit keys to code Always use environment variables—never hard-code API keys directly in your app’s source code.
Rotate keys regularly Change API keys periodically for security, especially if team members leave or keys are potentially exposed.
Use separate keys per environment If exporting code for production, use different API keys for development vs. production deployments.
Monitor usage Check provider dashboards regularly for unexpected API usage that might indicate a security issue.
If you suspect an API key is compromised:
Immediately delete the variable in Bloom
Revoke the key in the provider’s dashboard
Generate a new key and add it as a fresh variable
Check Logs for suspicious activity
Troubleshooting
API calls failing with 'key not valid'
Possible causes:
The API key is incorrect or expired
The key doesn’t have required permissions
Auto-provisioning is disabled but no custom key is set
Variable name doesn’t match what your code expects
Solutions:
Verify the key is correct in the provider’s dashboard
Check the variable name matches your code exactly
Enable auto-provisioning if you want Bloom-managed keys
View Logs for the specific error message
Variable not showing as 'In use'
If you added a variable but it doesn’t show the “In use” badge:
Your code might not be calling the function that uses it yet
The variable name in your code might not match exactly
You might be checking process.env incorrectly in your function
Check Backend Dashboard Functions to verify the function is being called.
If auto-provisioning is disabled due to insufficient credits: Option 1: Upgrade plan
Get more monthly credits
Keep using Bloom-managed keys
Simplest for ongoing projects
Option 2: Use custom keys
Disable auto-provisioning
Add your own API keys
Direct billing from service providers
Click Refresh to reload the variable list
Check you’re in the correct app’s settings
Verify the variable was saved (you should see a confirmation)
Check if it was accidentally deleted
Learn more