I’m trying to search my Airtable base using the filterByFormula parameter in the URL. Here’s what I’ve got so far:
api.airtable.com/v0/MYAPPID/TableName?filterByFormula=(FIND("SearchText",{ColumnName})&api_key=MYAPIKEY
But I’m getting an error:
{
"error": {
"type": "INVALID_FILTER_BY_FORMULA",
"message": "The formula for filtering records is invalid: Invalid formula. Please check your formula text."
}
}
I’ve been testing this in Postman but can’t figure out what’s wrong. Can anyone help me fix this URL so I can search my Airtable database properly? I’m new to using Airtable’s API and would really appreciate some guidance on the correct syntax for the filterByFormula parameter.
hey there! looks like ur missing a closing parenthesis in ur formula. try this:
api.airtable.com/v0/MYAPPID/TableName?filterByFormula=(FIND("SearchText",{ColumnName}))&api_key=MYAPIKEY
that should fix it. also, make sure to url encode special characters. good luck!
When I first encountered this challenge with Airtable’s API, I found that getting the syntax right in the filterByFormula parameter was crucial. One approach that worked was to use a formula which explicitly checks if the FIND function returns 0 (meaning the text is not found) and then invert that result using NOT. For example:
api.airtable.com/v0/MYAPPID/TableName?filterByFormula=NOT(FIND(“SearchText”, {ColumnName})=0)&api_key=MYAPIKEY
This condition ensures that only records where FIND returns a non-zero value (i.e., the text is found) are returned. Be sure to URL encode your formula to handle spaces and special characters. Also, always verify that your API key and app ID are correct.
I’ve been in your shoes, struggling with Airtable’s API and filterByFormula. Here’s what I’ve learned through trial and error:
The FIND function in Airtable is case-sensitive, which can trip you up if you’re not careful. I’d recommend using LOWER to make your search case-insensitive:
api.airtable.com/v0/MYAPPID/TableName?filterByFormula=FIND(LOWER(“SearchText”),LOWER({ColumnName}))&api_key=MYAPIKEY
Also, don’t forget to URL encode your formula. Spaces and special characters can cause issues if not properly encoded.
One more tip: if you’re searching across multiple columns, you can use OR like this:
OR(FIND(LOWER(“SearchText”),LOWER({Column1})),FIND(LOWER(“SearchText”),LOWER({Column2})))
Hope this helps you get your search working!