Airtable logo
GraphQL
Import and sync data in Airtable

Connect Airtable and any GraphQL API

Import data from any GraphQL API using a simple no-code API integration. Sync data from any GraphQL API and thousands of other apps into Airtable automatically with Data Fetcher.

Trusted by leading Airtable teams

IBM Logo
Amazon Logo
Warner Records Logo
Harvard Logo
Stanford Logo
NBA Logo
Time Logo
DraftKings Logo

The no-code solution for connecting any GraphQL API to Airtable

It takes just 4 simple steps to get up and running with Data Fetcher’s no-code imports into Airtable

Step 1

Add the Data Fetcher extension

Get started with GraphQL in Airtable by adding the Data Fetcher extension from the Airtable Marketplace. Create your free account directly within the extension after installation.

Add the Data Fetcher extension
Step 2

Connect to any GraphQL API

Create a custom request to connect to any GraphQL API or remote file. Enter the request details like URL, method, and body to get the data you need. Set up authentication and pagination if needed.

Connect to any GraphQL API
Step 3

Map the fields

Select which GraphQL data fields you want to import and map them to your existing Airtable fields. Choose how new data should merge with existing records in your base.

Map the fields
Step 4

Automate your GraphQL data sync

Keep your Airtable data fresh by scheduling automatic updates at any interval. You can also trigger syncs from any GraphQL API when records change in your Airtable base.

Automate your GraphQL data sync

About the tools

GraphQL logo

GraphQL

GraphQL is a query language and runtime for APIs that allows clients to request exactly the data they need. It provides a description of the data in your API through a type system and schema. Unlike traditional REST APIs, GraphQL enables developers to fetch multiple resources in a single request while allowing flexible data retrieval. With real-time subscriptions, introspection capabilities, and built-in documentation generation, GraphQL has become a popular alternative for building modern APIs.

Airtable logo

Airtable

Airtable blends spreadsheets and databases, enabling organized, collaborative workflows. It features customizable templates, multiple viewing options like grid, calendar, and kanban boards, plus powerful data types. With integration capabilities, automation tools, and team collaboration features, Airtable helps businesses of all sizes manage projects, content planning, and data without technical expertise.

Data Fetcher logo

Data Fetcher

Data Fetcher is an Airtable extension that connects your bases with external data sources and APIs. Users can pull data from REST APIs and external systems without writing code. With support for automic syncs, data transformation and mapping, Data Fetcher helps businesses make Airtable their source of truth for all their third-party data. It acts as the missing connection between GraphQL and Airtable.

How to Connect any GraphQL API to Airtable

In this guide, we will learn how to connect to a GraphQL API in Airtable using the Data Fetcher extension. GraphQL is a query language for APIs made by Facebook that is growing in popularity. We will connect to an open-source GraphQL countries API to import country data in Airtable. You can use the same approach to connect to other GraphQL APIs in Airtable, such as the Shopify Admin API or the Github API.

Install Data Fetcher

Install Data Fetcher from the Airtable marketplace. Data Fetcher is a free Airtable extension that lets you connect to any JSON or GraphQL API. After the extension launches, sign up for a free Data Fetcher account by entering a password and clicking 'Sign up for free'.

Group 1Data Fetcher Sign Up .png

Connect to GraphQL API in Airtable

On the home screen of the Data Fetcher extension, click 'Create your first request'. Requests in Data Fetcher are how you import data to or send data from your Airtable base.

click-create-your-first-request.png

On the create request screen in Data Fetcher, for Application, select 'Custom'.

custom-application-selected.png

Enter a Name for your request, e.g. 'Import Countries'.

Set the request method to POST. GraphQL APIs always require the request method to be POST.

Enter the following URL. This is the base URL for the countries GraphQL API we are using.

https://countries.trevorblades.com/

graphql-url-name-method.png

Add a GraphQL request body by clicking Body, then GraphQL. Then enter the GraphQL query you want to use, as well as any variables. We will use this query without any variables for this example:

{
  countries {
    code
    name
    emoji
    capital
    continent {
      name
    }
    currency
  }
}

This looks like this in Data Fetcher:

graphql query in data fetcher.png

Select the Output Table & View you want to import the data into.

output-table-1.png

Click 'Save & Run'.

The request will run and the Response field mapping modal will open. This is where you set how the available fields in the GraphQL API response should map to fields in the output table. For each field name in the response, you can either import or filter it. For an imported field, you can set whether to map them to an existing field or create a new field. You can also set the field type for each new field.

Once you are happy with the mapping, click 'Save & Run'.

graphql-response-field-mapping.png

Data Fetcher will create any new fields in the output table, then run the request and import the data from the GraphQL API in Airtable.

Screenshot 2021-07-27 at 12.04.02.png

If there is a unique id field in the GraphQL API response, you can import that and set it as the Update based on field in the 'Advanced settings'. This means even if you move records around in Airtable, Data Fetcher will still be able to match up data from the API response with records in the output table.

Import Data from GraphQL API in Airtable on a Schedule

At the moment, we have to click 'Run' in order to import the data from the GraphQL API. We can use Data Fetcher's scheduled requests feature to automatically import the data every 15 minutes/ hour/ day etc.

In Data Fetcher, scroll to Schedule and click 'Upgrade'.

table-1-schedule-upgrade-button.png

A new tab will open where you can select a plan and enter your payment details to upgrade.

data fetcher upgrade pricing plans.png

Return to the Data Fetcher extension and click 'I've done this'.

table-1-schedule-ive-done-this-button.png

Under Schedule click '+ Authorize'.

Schedule Data Fetcher

A pop-up will open and prompt you to authorize the Airtable bases you want Data Fetcher to have access to.

By selecting 'All current and future bases in all current and future workspaces' you'll avoid issues with any unauthorized bases in the future.

Click 'Grant access'.

schedule-authorize-bases.jpg

In the Data Fetcher interface, Schedule this request will now be toggled on.

Select how often you want the request to run, e.g. 'Every 15 mins'. Click 'Save' The request will now run on the schedule and automatically import the GraphQL API data.

Group 11(2).png

Handle GraphQL Pagination in Airtable

Follow these instructions to handle GraphQL cursor pagination in Data Fetcher.

Or if the GraphQL API uses offset pagination, follow the below instructions.

Enter your GraphQL query (including pagination arguments) and variables into our GraphQL to JSON body converter to convert them to JSON.

convert graphql query and variables to json.png

Back in the Data Fetcher extension, add this as a JSON request body, rather than a GraphQL one.

data fetcher json body with graphql query.png

Scroll down to the bottom of the screen and click "Advanced settings". Then scroll down to Pagination and select "Offset body". Enter the Offset path and Limit path for the GraphQL pagination variables within the JSON. These use JSONPath syntax.

In this example, our Offset path would be "$.variables.offset" and our Limit path would be "$.variables.limit".

Enter the Limit value. This is how many items should be returned in each page. In this example, we'll use 50.

graphql offset body pagination config.png

When we run the request, the offset/ limit values will be replaced with the correct values each time.

Other GraphQL APIs

For this guide, we used this public countries GraphQL API. Here is a list of public GraphQL APIs you might want to try instead, following the same approach as above.

data fetcher graphql query body.png

Ready to connect any GraphQL API to Airtable?

Start syncing your data sources with Airtable today.