Back

Bubble API Essential Guide

Aug 14, 20246 minute read

What type of API does Bubble provide?

Based on the search results provided, Bubble uses a RESTful API. Here are the key points about Bubble's API:

Bubble's API Type

Bubble provides a RESTful API. The documentation specifically mentions that "Bubble automatically generates an interface in your app that adheres to the RESTful principles".

Key Characteristics of Bubble's RESTful API

  1. It follows REST architectural principles, making it compatible with many external systems.
  2. It is often cacheable, allowing clients to use cached responses for repeated requests, which improves performance.
  3. It may use a layered system architecture, where intermediaries like proxies can be used between the client and server for stability and security.

API Components

Bubble's API includes:

  1. The Data API - for interacting with app data
  2. The Workflow API - for triggering workflows
  3. API authentication options

API Usage

Bubble provides documentation on how to authenticate and use their API, including:

  • How to authenticate (as a user, admin, or without authentication)
  • Data API endpoints and requests
  • Workflow API endpoints
  • Creating and scheduling API workflows

Best Practices

While not specific to Bubble, some general best practices for working with RESTful APIs include:

  • Using appropriate HTTP methods (GET, POST, PUT, DELETE, etc.)
  • Structuring endpoints around resources
  • Using proper status codes in responses
  • Implementing pagination for large data sets
  • Versioning the API

In summary, Bubble provides a RESTful API that adheres to standard REST principles, making it compatible with many external systems and following common web development practices.

Does the Bubble API have webhooks?

Does Bubble support webhooks?

Yes, Bubble supports webhooks. Webhooks in Bubble are implemented as API workflows that can be triggered by external services.

Types of events you can subscribe to

Bubble allows you to create custom API workflows that can be triggered by various events from external services. Some examples include:

  • Payment events from Stripe (e.g. failed charges, successful payments)
  • Subscription status changes
  • Data updates from external APIs
  • Custom events from your own services

Key points about Bubble webhooks:

  • They are implemented as API workflows in the Backend Workflows section
  • You can make them public so external services can trigger them
  • They can be configured to run without authentication for simplicity
  • You can pass data to the webhook via URL parameters or in the request body
  • Webhook security is important to consider, as public endpoints could potentially be abused

Best practices for webhook security in Bubble:

  1. Use API tokens in URL parameters to authenticate requests
  2. Implement Basic authentication by checking credentials in the workflow
  3. Verify the source of webhook calls when possible
  4. Store sensitive authentication values in the database with privacy rules
  5. Use Bubble's built-in security features like making workflows private when possible

Code example:

Here's a basic example of setting up a webhook endpoint in Bubble:

1. Create a new API workflow 
2. Set it as public
3. Add any needed parameters (e.g. event_id)
4. Add actions to process the webhook data
5. Implement security checks at the start of the workflow

// Pseudo-code for security check
if (API_token is valid) {
  // Continue processing webhook
}
else {
  // Terminate workflow
}

In summary, Bubble provides flexible support for webhooks through its API workflow system, allowing you to subscribe to various external events and trigger actions in your app. Proper security measures should be implemented when using public webhook endpoints.

Rate Limits and other limitations

Based on the search results provided, here are the key points regarding API rate limits for the Bubble API:

Default Rate Limits

  • For legacy plans, Bubble applications are rate-limited by default to 1,000 requests per minute collectively between Live and Development versions.

  • Exceeding this limit will result in an HTTP 429 error.

Plan-Specific Limits

The Data API and Workflow API handle a specific number of requests per minute depending on the plan:

  • Starter: 15,000 requests/minute
  • Growth: 25,000 requests/minute
  • Team: 35,000 requests/minute

Additional Protections

  • Bubble has additional rate limits enforced to protect their cluster from malicious attacks. These are subject to change and are unlikely to affect legitimate usage.

Enterprise Plan

  • The Enterprise plan does not have a hard limit on scheduled API workflows, allowing for more flexibility.

Handling Rate Limit Exceedance

  • When an API request exceeds the rate limit, Bubble will return an error response, typically with a 429 Too Many Requests status code.

  • Bubble implements a queue system that holds incoming requests that exceed the rate limit. These requests are then processed in order once the rate limit resets.

Best Practices

  • Set reasonable rate limit values that balance preventing abuse and allowing legitimate usage.
  • Consider implementing user-specific rate limits.
  • Regularly monitor and analyze API usage.
  • Document and communicate your rate limit configuration.

Adjusting Rate Limits

  • Rate limits can be adjusted in the API endpoint settings in Bubble.io by modifying the maximum number of requests allowed within a specific time frame.

It's important to note that these limits may change over time, so it's advisable to check Bubble's official documentation for the most up-to-date information on API rate limits.

Latest API Version

Based on the search results, here are the key points regarding the most recent version of the Bubble API:

  1. The most recent version mentioned is Bubble Version 28 [5].

  2. Version 28 included two main changes:

    • Addressing a bug in the API Connector where JSON content-type was not explicitly sent in the header for JSON body type calls [5].

    • Fixing a rounding bug when using the "formatted as" operator [5].

  3. Initially, there were some issues reported with Version 28:

    • It was overwriting custom content-types in shared headers with multiple API calls [5].

    • Some users reported it breaking Stripe API calls [5].

  4. Bubble investigated the issues and released a fix for Version 28 [5].

  5. As of December 2, 2023, the fix was released and users were able to upgrade to the new Bubble Version [5].

  6. The Bubble platform is continuously advancing, with multiple updates rolled out on workdays [4].

  7. Apps operate on specific "release tiers" that determine when they receive updates to the Bubble framework [4].

To summarize, the most recent version of the Bubble API mentioned in the search results is Version 28. However, it's important to note that Bubble regularly releases updates, so there may be newer versions available since these search results were published. To get the most up-to-date information on the latest Bubble API version, it would be best to check the official Bubble documentation or release notes.

How to get a Bubble developer account and API Keys?

1. Sign up for a Bubble account

  • Go to bubble.io and click "Sign Up" to create a free account.
  • You'll need to provide your email address and create a password.

2. Choose a plan

  • Bubble offers a free plan that allows you to create and test apps, including API integrations.
  • For production use and more advanced features, you may want to consider a paid plan.

3. Create a new app

  • Once logged in, click "Create a new app" from your Bubble dashboard.
  • Give your app a name and choose a template or start from scratch.

4. Enable API Connector plugin

  • Go to the "Plugins" section in your Bubble app.
  • Search for and install the "API Connector" plugin, which allows you to connect to external APIs.

5. Set up API authentication

  • In your app settings, go to the "API" tab.
  • Here you can set up authentication methods for your API, such as API keys or OAuth.

6. Create API endpoints

  • Still in the "API" tab, you can create new API endpoints for your app.
  • Define the data structure, HTTP methods, and authentication requirements for each endpoint.

7. Test your API

  • Use Bubble's built-in API testing tools to ensure your endpoints are working correctly.
  • You can also use external tools like Postman to test your API.

What can you do with the Bubble API?

Based on the search results provided, here is a summary of the data models you can interact with using the Bubble API, along with what is possible for each:

Things (Data Types)

  • Things are the core data model in Bubble, analogous to tables in a traditional database.
  • You can create, read, update, and delete Thing entries via the Data API.
  • Each Thing can have multiple fields of different data types (text, numbers, dates, images, etc.).

Capabilities:

  • Search for Thing entries
  • Read Thing entries
  • Create new Thing entries
  • Modify existing Thing entries
  • Delete Thing entries

Fields

  • Fields store different data attributes for each Thing.
  • You can access and modify field values through the Data API.

Capabilities:

  • Read field values
  • Update field values
  • Add new fields to Things
  • Remove fields from Things

Relationships

  • You can establish relationships between Things (one-to-one, one-to-many, many-to-many).
  • Relationships can be queried and modified through the API.

Capabilities:

  • Query related data
  • Create new relationships between Things
  • Modify existing relationships
  • Remove relationships

User Accounts

  • Bubble has built-in user authentication.
  • You can interact with user data through the API.

Capabilities:

  • Create new user accounts
  • Read user data
  • Update user information
  • Delete user accounts
  • Authenticate API requests as a user

Workflows

  • Bubble allows you to set up an API to trigger workflows.

Capabilities:

  • Trigger custom workflows via API calls

Custom States

  • While not explicitly mentioned in the search results, Bubble supports custom states which can likely be accessed or modified via the API.

Option Sets

  • Option sets are another data type in Bubble that can likely be interacted with via the API, though not specifically mentioned in the results.

It's important to note that Bubble uses a NoSQL structure, which provides flexibility for storing dynamic data but may require a different approach to data organization compared to traditional relational databases. Additionally, Bubble has its own system for generating unique IDs, which may need to be considered when migrating data or maintaining references to external systems.