Data API endpoints
This section covers how to identify the correct endpoint when using the Bubble Data API.
Last updated
This section covers how to identify the correct endpoint when using the Bubble Data API.
Last updated
Remember our lesson from earlier when we explored that whenever a client sends an API request, they are attempting to reach a specific resource. The URL, short for Universal Resource Locator, shows the way to this resource.
Bubble automatically generates a URL – known as an endpoint – for each data type you activate in the Data API. By using this URL in an API request, a client will reach the correct data type – the resource.
The URL consists of a root URL that’s unique for every version of every app you create but remains the same for all data types. As soon as you have activated the Data API, Bubble will reveal your app's root URL in the API settings:
That URL is structured like this:
Development (Main branch)
https://myapp.bubbleapps.io/version-test/api/1.1/obj
Development
(custom branch)
https://myapp.bubbleapps.io/[branch-id]/api/1.1/obj
Live
https://myapp.bubbleapps.io/api/1.1/obj
If you have connected your app to a custom domain, the URL will look like this:
Development (Main branch)
https://mydomain.com/version-test/api/1.1/obj
Development
(custom branch)
https://mydomain.com/[branch-id]/api/1.1/obj
Live
https://mydomain.com/api/1.1/obj
As you can see, the root URL points the client towards your app’s API and obj (object) means we want to interact with objects (data records) in the database.
What’s missing?
The final piece of the puzzle is to let the server know which data type we want to access. For that we need to include the name of the data type. Data type names in the Data API are the same as what you named them in the Bubble database editor, except it needs to be formatted in the following way:
Remove spaces
Use lowercase letters
For example, the following data type names would need to be formatted as the following:
Data Type name
Correct Data API formatting
Rental Unit
rentalunit
Sports Team
sportsteam
Cake Recipe
cakerecipe
Make sure to always use unique Data Type names.
If two or more Data Types share the same name, the Data API will return the first one it finds, which may lead to unexpected behavior.
If we want to access the Rental Unit data type, the full endpoint URL would look like this:
Development (Main branch)
https://myapp.bubbleapps.io/version-test/api/1.1/obj/rentalunit
Development (custom branch)
https://myapp.bubbleapps.io/branch-id/api/1.1/obj/rentalunit
Live
https://myapp.bubbleapps.io/api/1.1/obj/rentalunit
Development (Main branch)
https://myapp.bubbleapps.io/version-test/api/1.1/obj/rentalunit
Development (custom branch)
https://myapp.bubbleapps.io/branch-id/api/1.1/obj/rentalunit
Live
https://myapp.bubbleapps.io/api/1.1/obj/rentalunit
To complete an endpoint, we need to know both the URL to the resource we want to access, and the (GET, PUT, POST, DELETE) that determines what we want to do with that data type.
Action
Description
GET
Retrieve data
POST
Create data
PUT
Update data
PATCH
Replace data
DELETE
Delete data
The table above shows the most common HTTP methods used in an API call. To learn more about what an HTTP method is from a more technical perspective, check out our guide on How RESTful APIs work and HTTP methods specifically.
Next we will look at how to set up some common requests.