The API Connector is Bubble's gateway to the outside world. Master it, and you can integrate virtually any service into your applications.
Understanding APIs
APIs let applications communicate: - **REST APIs** - Most common, uses HTTP methods - **GraphQL** - Query language for APIs - **Webhooks** - Push notifications from services
Setting Up API Connector
Access it via Plugins > API Connector:
- Add a new API
- Name it descriptively
- Configure authentication
- Create API calls
Authentication Methods
No Auth - Public APIs without keys
API Key - Simple key in header or parameter
Bearer Token - JWT or OAuth tokens
OAuth 2.0 - Complex but secure flow
Basic Auth - Username and password
Creating API Calls
For each call, define: - **Method** - GET, POST, PUT, DELETE - **URL** - The endpoint address - **Headers** - Content-Type, Authorization - **Parameters** - Query strings or body data
Handling Responses
Bubble needs to understand the response:
- Initialize the call with sample data
- Map JSON fields to Bubble types
- Handle nested objects
- Deal with arrays
Dynamic Data
Use Bubble data in API calls: - <parameter> for query parameters - Dynamic headers - Request body with user data
Error Handling
APIs fail. Plan for it: - Check response status - Handle timeout errors - Provide user feedback - Log errors for debugging
Common Integrations
Popular APIs to integrate: - Stripe for payments - SendGrid for emails - Twilio for SMS - OpenAI for AI features - Airtable for databases
Best Practices
- Use server-side calls for sensitive operations
- Cache responses when possible
- Implement retry logic
- Monitor API usage and costs
- Keep API keys secure
The API Connector transforms Bubble from a standalone tool into a powerful integration platform.