MCPcopy Index your code
hub / github.com/mehanizm/airtable

github.com/mehanizm/airtable @v0.3.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.4 ↗ · + Follow
99 symbols 295 edges 20 files 53 documented · 54% 16 cross-repo links updated 16mo agov0.3.4 · 2025-03-14★ 862 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Golang Airtable API

GoDoc Go codecov Go Report Mentioned in Awesome Go

A simple #golang package to access the Airtable API.

Table of contents

Installation

The Golang Airtable API has been tested compatible with Go 1.13 on up.

go get github.com/mehanizm/airtable

Basic usage

Initialize client

You should get your_api_token in the airtable account page

client := airtable.NewClient("your_api_token")

You can use custom http client here

client.SetCustomClient(http.DefaultClient)

Custom context

Each method below can be used with custom context. Simply use MethodNameContext call and provide context as first argument.

List bases

bases, err := client.GetBases().WithOffset("").Do()

Get base schema

schema, err := client.GetBaseSchema("your_database_ID").Do()

Get table

To get the your_database_ID you should go to main API page and select the database.

table := client.GetTable("your_database_ID", "your_table_name")

List records

To get records from the table you can use something like this

records, err := table.GetRecords().
    FromView("view_1").
    WithFilterFormula("AND({Field1}='value_1',NOT({Field2}='value_2'))").
    WithSort(sortQuery1, sortQuery2).
    ReturnFields("Field1", "Field2").
    InStringFormat("Europe/Moscow", "ru").
    Do()
if err != nil {
    // Handle error
}

Add records

recordsToSend := &airtable.Records{
    Records: []*airtable.Record{
        {
            Fields: map[string]any{
                "Field1": "value1",
                "Field2": true,
            },
        },
    },
}
receivedRecords, err := table.AddRecords(recordsToSend)
if err != nil {
    // Handle error
}

Get record by ID

record, err := table.GetRecord("recordID")
if err != nil {
    // Handle error
}

Update records

To partial update one record

res, err := record.UpdateRecordPartial(map[string]any{"Field_2": false})
if err != nil {
    // Handle error
}

To full update records

toUpdateRecords := &airtable.Records{
    Records: []*airtable.Record{
        {
            Fields: map[string]any{
                "Field1": "value1",
                "Field2": true,
            },
        },
        {
            Fields: map[string]any{
                "Field1": "value1",
                "Field2": true,
            },
        },
    },
}
updatedRecords, err := table.UpdateRecords(toUpdateRecords)
if err != nil {
    // Handle error
}

Delete record

res, err := record.DeleteRecord()
if err != nil {
    // Handle error
}

Bulk delete records

To delete up to 10 records

records, err := table.DeleteRecords([]string{"recordID1", "recordsID2"})
if err != nil {
    // Handle error
}

Special thanks

Inspired by Go Trello API

Core symbols most depended-on inside this repo

Error
called by 12
errors.go
Do
called by 8
base.go
do
called by 8
client.go
rateLimit
called by 6
client.go
get
called by 4
client.go
GetRecords
called by 3
get-records.go
GetRecord
called by 3
record.go
WithOffset
called by 3
get-bases.go

Shape

Method 54
Function 27
Struct 18

Languages

Go100%

Modules by API surface

table.go14 symbols
base.go14 symbols
get-records.go13 symbols
client.go13 symbols
record.go7 symbols
table_test.go5 symbols
get-bases.go5 symbols
attachment.go5 symbols
record_test.go4 symbols
errors.go3 symbols
client_test.go3 symbols
mock-response_test.go2 symbols

For agents

$ claude mcp add airtable \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact