Skip to main content

I was looking at the API reference... why is there no method to retrieve an element by a field that is defined as PK? That … is basic DB functionality. 

Currently the only way to use GET (HTTP) to retrieve a record, is with a value no one knows and that can only be calculated via the RECORD_ID() function (... after you already have the record!)

To me this .. is so weird haha :-)

Is it me? 
What I would expect is that Airtable allows via the API to query the table with AT LEAST the PK values. 

You’re not alone in thinking that this is an odd design choice! Airtable’s API is structured more like a spreadsheet interface rather than a traditional relational database, which is why it doesn’t allow direct retrieval of records by a custom primary key (PK). Instead, it requires using the record_id, which is an internal unique identifier that Airtable assigns to each record.

 

Workarounds:

 

If you want to retrieve a record using a custom primary key field, you can use the filterByFormula parameter in the API. For example:
 

GET https://api.airtable.com/v0/{base_id}/{table_name}?filterByFormula={PrimaryKeyField}='your_value'


Airtable is designed more as a user-friendly, flexible no-code/low-code platform rather than a strict relational database. Their API reflects that philosophy by prioritizing simplicity over traditional DB querying methods.


Thx Sannit. While that worked… it’s very odd to me to require such (more complex!) workaround under the flag of “no code / less complex”. For users touching APIs (→ tech savvy ppl anyway), being able to use a PK field makes absolutely most sense.  (IMHO).
This would in no way hurt the no-coders.


Hi ​@Wicked-AI-Ware - Sannit is correct that the Airtable API is not ideal for database-like use cases.

Another option is to use an alternative middleware service like BaseQL, which connects to Airtable and provides a much more database-like experience using GraphQL. Here are some filtering examples: https://docs.baseql.com/usage/filtering


Reply