Public API
Information about the public API
This page covers some key information you need to know about using the Budibase Public API and our OpenAPI 3.0 specification. The Budibase API provides access to resources including applications, users, tables and data through a RESTful API - allowing for much deeper integration with your business use cases.
Public API Reference
This article covers the important general points about the Budibase Public API, if you are looking for in-depth information about the individual endpoints please check out our API Reference.
How to get your API key
The Budibase API requires an API key be specified as a header, specifically the x-budibase-api-key
header. Each user will have their own API key which can be generated through the Budibase portal, you'll find this in the user dropdown menu in the top right.
The "View API key" will open a menu, that allows generating a new API key (this will invalidate your old API key), from here you can copy your API key and start using it!
Getting an App ID
Data-related endpoints will require an x-budibase-app-id
header. Your App's ID can be retrieved by accessing your app from the Budibase dashboard, and locating your App ID from your browser's address bar after the URL's /builder/app/
path.
For example: <hostname>/builder/app/<your-app-id>/other-path
where <hostname>
could be localhost
and <your-app-id>
could be app_dev_567abc890opq123
.
Published data
To interact with data on your published app, simply remove the '_dev_' part of the app id, e.g. app_567abc890opq123
Getting a table's ID and row's ID
Data-related endpoints in the Budibase API may call for a tableId
or rowId
. Your desired Table ID can be retrieved by accessing your app from the Budibase dashboard and then navigating to the "Data" editor. The Table ID can be found in the address bar after the URL's /data/table/
path.
Table ID example: <hostname>/builder/app/<your-app-id>/data/table/<table-id>
where <table-id>
could be ta_123a456b789c123d345e678f
.
While browsing database tables, you can retrieve a row's ID by locating the value under the row's ID
column. You may have to toggle "Auto columns" in order for the ID
column to be visible.
Getting the OpenAPI specification
The Budibase Public API has been defined using the OpenAPI 3.0 specification which allows for easy integration between external applications and Budibase. You can learn more about the OpenAPI initiative here.
You can find the specification for the latest release of Budibase through our Github repository.
Using with Insomnia
Insomnia is an open-source REST API client for developers. To import the Budibase API Collection first choose the Insomnia root element as shown below:
We want to import a collection from a URL so choose the Create button, then URL as shown below:
Paste the URL below into the dialog box, then choose Fetch and Import
https://raw.githubusercontent.com/Budibase/budibase/master/packages/server/specs/openapi.yaml
You will be asked how you would like to import the collection. Choose New as shown below:
Next choose Request Collection
Then OK to confirm the import succeeded.
To view the imported API collection choose the collection name as highlighted below:
The next step is to personalise your environment variables to match your Budibase installation. Choose the OpenAPI env drop-down menu, then Manage Environments
Amend the values for each variable, entering the API key you obtained from your Budibase installation.
With the environment variables set you can try making some requests. The example below shows a request to Search for applications. Amend the value of the name string (set to inventory in this example), then choose the Send button to view the result.
To generate code for this request choose the drop-down arrow beside Search for application, then choose Generate code, then choose your preferred language from the top-left menu.
Using with Postman
The Budibase OpenAPI specification makes it easy to use Budibase with Postman, you can import the Budibase API as a new collection. With Postman open choose the "Import" button at the top-left. Choose Import via link and paste the following URL:
https://raw.githubusercontent.com/Budibase/budibase/master/packages/server/specs/openapi.yaml
Choose continue and you should see a new collection as shown below.
All that you need to do to this is adjust a two parameters about the API, the authorization to input your API key and the host (by default the collection will link to the Budibase Cloud, but you may wish to target your own self hosted Budibase instance). These settings are changed within the collection settings, click the three dots icon on the Budibase API collection, then click "Edit" - see the open this opens below.
First go to the "Authorization" tab and adjust the "Value" of the API key header to be that of your own API key. Then go to the "Variables" tab and change the "Current value" of the baseUrl
variable to be wherever the Budibase instance you wish to target is hosted; make sure that the /api/public/v1
on the end of the URL is maintained, this is required to access the Public API.
Updated about 1 year ago