Table of Contents

19 different ways to GET and filter data from Airtable

Rafaela Basso Updated by Rafaela Basso

Airtable is a handy resource to build a small database. It can work with many applications, and different types of data. In here we have listed 19 ways to retrieve data from your Airtable database, via API with the Webhook block.

Bear in mind that it's a freemium service, and has it's limitations: It cannot retrieve more than a 100 results. So is better to filter the data that you are most interested in using.

As we will see in the different methods, Airtable offers us a method called "filterByFormula" that allows us to create formulas that are conditions. If the Conditions are met, that means, when they are True, it returns us the items (rows) that match those conditions.

The API will return an array with every row, as a JSON object, like below:

How to get URL (Airtable's App ID) and the Authorization (API Key)

We will get the information from the Airtable API Documentation, and set it in the Webhook according to the steps we will show in this article.

Note: Watch out for typos, spelling mistakes, and lower/upper case! The information must be exactly the same in the Airtable API Documentation and the Webhook block.

In Airtable, first we need to go to the API documentation option in the Help section:

Then, once in the API documentation, click on the Authentication option:

1. Webhooks URL and Method

You must get the App ID in Airtable to build the Webhook's URL. It should look like the following:

https://api.airtable.com/v0/<app_id>/<nameofthebase>

In the examples below we used the following URL:

https://api.airtable.com/v0/appzYrKqRzqbYCGi9/Furniture

This is how it will look in your Webhook:

It consists of 2 parts:

  • The Base we are using is called Furniture, so the end of our URL is Furniture

  • The Base App Id is appzYrKqRzqbYCGi9

2. Webhook's Header (Authorization)

To set up the Webhook's Header (Authorization), you must get the API Key in Airtable.

To get an Airtable API Key, repeat the same process to get to the API Documentation, but this time click on this option:

Then, under the line where you located the APP ID, you will see the API KEY just after "Authorization":

Please copy from "Bearer" until the end of the text:

Please make sure you copy the whole code, but not the quotation marks.

This is how it should look in the Webhook block:

3. Save the Results of Airtable API response as Array

The next step is saving the Array of results from the Airtable API response, so that we can use this later in the Dynamic Data block.

As you can see, we can store the main array with all the results like in the picture below:

Here is how you would TEST and Set up the Save response section to be able to select the key "records" (that contains the array of results) and save it in the variable @records:

1. Set the URL, method (GET), the parameters section (with the variable) and the Header with the Authentication

2. In the Test section, add a sample value for the variable you want to use

3. Press TEST

4. Select the Key "records"

5. Select a variable (in this example @records) where it will store the content of the Key "records"

And now we will have the array with all the results based on the filter stored in the @records variable. Later we can use this variable for example in a Dynamic Data block:

Below there is a list of 11 ways to build the URL and/or the "Send params" section to get data filtered from your Airtable.

1. Request data (no filter)

In case we want to pull all the first 100 "items", without any filter

https://api.airtable.com/v0/<app_id>/<nameofthebase>

2. One fixed filter

This is best used when we want to get content from one column (field) that matches completely (case sensitive and the whole string is equal).

In the example below the column (field) is "Type" and the string to match is "Chairs", in the base Furniture:

filterByFormula=SEARCH("Chairs",{Type})

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=SEARCH("Chairs",{Type})

3. One user input filter

You should use this option if what you want is to filter based on the input or selection from the user that will be stored in a variable.

In the example below the column (field) is "Type" and the string to match is the landbot variable @type, in the base "Furniture":

filterByFormula=SEARCH("@type",{Type})

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=SEARCH("@type",{Type})

4. More than one filter

We use AND if we need to match 2 (or more) conditions with specific values.

In this example we check for items that match the landbot variable @color with the column (field) in Airtable "Color" and the landbot variable @type with the column (field) "Type":

Bear in mind that if we use "White" in the color and "Chairs" for type, it WILL NOT match the example above, because is has to be a full match, and color is "White, Brown, Black" in that object.

In case you want a case for "contains", where you are checking if "White" is one of the texts in the cell, please check the next filter:

filterByFormula=AND({Color}='@color',{Type}='@type')

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=AND({Color}='@color',{Type}='@type')

5. Search filter "contains" value in cell/column

If the cell for example has more than one value or contains more text, we want to check if a string (text) is contained for that field like in the example below:

Here we use FIND to check if the string "Brass" is in any of the items of the column (field) "Materials".

It will match both items in the picture above.

filterByFormula=FIND("Brass",{Materials})>0

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=FIND("Brass",{Materials})>0

6. Search filter numeric value bigger than X

This is very handy if we need to check for specific values that are greater (>) or smaller (<) than a specified value.

In this example we check in the column (field) "sold" for items with a value greater than 30:

filterByFormula={sold}>"30"

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula={sold}>"30"

7. Search for 2 conditions (less than and text)

This case is an example that checks numeric values at the same time that checks for a specific string in a column field.

Here the filter is looking for items sold less than 2 times and that their color could be red:

filterByFormula=AND({sold}<"2",FIND("Red",{Color})>0)

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=AND({sold}<"2",FIND("Red",{Color})>0)

8. Search filter by more than X days from Today

This is a specific case that we might use to check for the difference of days comparing with Today. The best case scenario would be if you want to make sure there is a difference of days between today and the date contained in a cell.

In the example below we check in the column (field) "Fulfill" for items fulfilled more than 60 days ago:

filterByFormula=DATETIME_DIFF({Fulfill},TODAY(),'days')>-60

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=DATETIME_DIFF({Fulfill},TODAY(),'days')>-60

9. Filter by dates

Just like with numbers, we can check for dates (greater or smaller) with filters. Bear in mind that the date has to be set with the YYYY-MM-DD format.

In the example we check for orders fulfilled after the 2019-10-17:

filterByFormula={Fulfill}>"2019-10-17"

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula={Fulfill}>"2019-10-17"

10. Search checked (box)

Checkboxes are handy for boolean values, we can verify if they are either checked (1) or not (0).

In the example we filter for items that in the column (field) were not checked (0):

filterByFormula={In stock}=0

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula={In stock}=0

11. Search this OR that

It is similar to AND, but in this case, only one of the conditions is met. Let's say we want to search either by name or email, then we will need to use OR.

In the formula below we are checking either if a product is not in stock or if theirs gross sales is greater than 0:

filterByFormula=OR({In Stock}=0,{Gross sales}>0)

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=OR({In Stock}=0,{Gross sales}>0)

12. Filter a list to get 1 record, and GET after all the information from that specific record based on recordId

Sometimes we might need to let the user select one product (record/row) from a list, and after display all the information possible from that product (record/row).

This means we need the following steps:

1. Filter and get a list of product, and store the information in one array

2. Display the list of product with a Dynamic Data block

3. Based on the selection from the Dynamic Data block, make a second request to Airtable to get all the information from that product (record/row), and save it in Landbot variables

4. Display that information

So the flow would be like this:

To get the id of the record, we need to set up the Dynamic Data to capture it and store it in the variable @recordid :

Now, we will use the @recordid in the following webhook to GET all the information from that specific record/row:

So, as an example we will set up a URL like this:

https://api.airtable.com/v0/appfQ7NnSyo70Z5E8/Imported%20table/@recordid

And we will need to test it like this:

The code of the record for the example you can get it by testing the first Webhook:

Once the TEST is done you would be able to set the variables in the SAVE RESPONSE section below:

And display the data right after:

13. Search for an exact Match

In this case, we want that input from the user (@email) is in the Airtable base.

filterByFormula=({emails}='@email')

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=({emails}='@email')

Or just simply:

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=Orderno=@number
filterByFormula=Orderno=@number

14. Search for two (or more) exact Matches

In this case, we want that input from the user (@email and @phone) is in the Airtable base.

filterByFormula=AND(({Phone}='@phone'),({Email}='@email'))

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=AND(({Phone}='@phone'),({Email}='@email'))

15. Search for records that a specific field is empty

In this case, we want that input from the user (@email) is empty in the Airtable base.

filterByFormula=emails=''

https://api.airtable.com/v0/<app_id>/<nameofthebase>?filterByFormula=emails=''

16. Set up a "pre-filter" based on a category, and a search pull after that category items.

Could be that you have a list of products, that each one is part of a "product category", but you want to offer them the user first to browser dynamically based on those product categories and then display only the product in such category.

What we need is first to set up in Airtable, a tab specific for the product categories

Then we need in Landbot a way to capture this whole list, with a simple GET that points to product_categories will be ready:

And we store the records key:

Then with Dynamic Data block, right after:

Where we will work with the landbot variable you just created (@records) we will display the key "Name":

Then the bot will display according the Categories:

View on Landbot 2:

View on Landbot 3

Then based on that selection you can search with another call for a list filtered based on that selection:

View on Landbot 2:

View on Landbot 3

17. Create and display a list of items

We might want to display a list of items, but not to be selected with Dynamic Data. In that case we need first to edit the data in Airtable to be ready to be displayed in Landbot.

Here we have all the data capture with a field that is a Rollup

Where we use the Formula to add an html tag <br> to add give the format, that will be displayed in Landbot

So finally in Landbot is displayed this way:

Final view on Landbot 2:

Final view on Landbot 3

18. Get data sorted in ascendent or descendent order

Could be that we need to display the data based on a specific order. Let's say we want to do in based on a field (column) called "population, from bigger population to smallest (desc). Here is how:

In case you want to do it in the other order from smallest to largest (asc):

19. Set up a Formula block to check if an email (or other value) exists in your Airtable

With Airtable you can search for values (for example with the method 15), where email is the name of the field/column

But if those values are not in your Table and the request is set up correctly it will return an empty array.

We are going to use such empty array to validate if the email is present or not. To do it, we want to select the key "records"

And save it in Landbot variable (recordsarray) as an array in the Save Response section.

After that, we will use Formulas to check if the Array is empty (length of the array is 0) or if the Array contains any value (length of the array is more than 0)

We will use this nested Formula to get a True and False output, in case we want to redirect the user to a specific flows. True, means there is a record and False means there is no records that matches your criteria as Airtable response was empty (records array)

IsNotEqual(Length(@recordsarray),0)

This same principle can be used with other filters above. Array of length 0, means no records that matches your criteria.

Bear in mind, that if the request in the params section is not set up correctly it will return all the records

How did we do?

How to set the flow according to Open/Closed Business Hours

How to set up Multiple Choice questions

Contact