The Airtable class allows you to interact with an Airtable base. In order to use this class you must generate an Airtable personal access token which can be found in your Airtable settings.


Finding The Base Key

The easiest place to find the base_key for the base that you wish to interact with is via the Airtable API documentation.

  • Go to the Airtable API Base List and select the base.

  • The url of the resulting page will contain the base_key.

  • Example:[BASE_KEY]/api/docs#curl/introduction


To instantiate the Airtable class, you can either store your Airtable personal access token AIRTABLE_PERSONAL_ACCESS_TOKEN as an environmental variable or pass in your personal access token as an argument. You also need to pass in the base key and table name.

from parsons import Airtable

# First approach: Use personal access token via environmental variable and pass
# the base key and the table as arguments.
at = Airtable(base_key, 'table01')

# Second approach: Pass personal access token, base key and table name as arguments.
at = Airtable(base_key, 'table01', personal_access_token='MYFAKETOKEN')

You can then call various endpoints:

# Get records from a base
at.get_records(fields=['id', 'fn', 'ln'])

# Get a single record from a base

# Insert records


class parsons.Airtable(base_key, table_name, personal_access_token=None)[source]
base_key: str

The key of the Airtable base that you will interact with.

table_name: str

The name of the table in the base. The table name is the equivilant of the sheet name in Excel or GoogleDocs.

personal_access_token: str

The Airtable personal access token. Not required if AIRTABLE_PERSONAL_ACCESS_TOKEN env variable set.


Returns a single record.

record_id: str

The Airtable record id


A dictionary of the record

get_records(fields=None, max_records=None, view=None, formula=None, sort=None, sample_size=None)[source]
fields: str or lst

Only return specified column or list of columns. The column name is case sensitive

max_records: int

The maximum total number of records that will be returned.

view: str

If set, only the records in that view will be returned. The records will be sorted according to the order of the view.

formula: str

The formula will be evaluated for each record, and if the result is not 0, false, “”, NaN, [], or #Error! the record will be included in the response.

If combined with view, only records in that view which satisfy the formula will be returned. For example, to only include records where COLUMN_A isn’t empty, pass in: "NOT({COLUMN_A}='')"

For more information see Airtable Docs on formulas.

Usage - Text Column is not empty:


Usage - Text Column contains:

airtable.get_all(formula="FIND('SomeSubText', {COLUMN_STR})=1")

sort: str or lst

Specifies how the records will be ordered. If you set the view parameter, the returned records in that view will be sorted by these fields. If sorting by multiple columns, column names can be passed as a list. Sorting Direction is ascending by default, but can be reversed by prefixing the column name with a minus sign -.

Example usage: airtable.get_records(sort=['ColumnA', '-ColumnB'])

sample_size: int

Number of rows to sample before determining columns

Parsons Table

See Parsons Table for output options.


Insert a single record into an Airtable.

row: dict

Fields to insert. Must be dictionary with Column names as Key.

typecast: boolean

Automatic data conversion from string values.


Dictionary of inserted row

insert_records(table, typecast=False)[source]

Insert multiple records into an Airtable. The columns in your Parsons table must exist in the Airtable. The method will attempt to map based on column name, so the order of the columns is irrelevant.

table: A Parsons Table or list of dicts

Insert a Parsons table or list

typecast: boolean

Automatic data conversion from string values.


List of dictionaries of inserted rows

update_record(record_id, fields, typecast=False)[source]

Updates a record by its record id. Only Fields passed are updated, the rest are left as is.

record_id: str

The Airtable record id

fields: dict

Fields to insert. Must be dictionary with Column names as Key.

typecast: boolean

Automatic data conversion from string values.