# Work in Progress: How to Bring Data from Airtable

{% hint style="info" %}
The best way for us to make use of big chunks of information on the flow is in the form of a JSON Object. Airtable has its own API for that!
{% endhint %}

### Step 1: Get your Airtable URL

* Go to "API documentation" on the Help menu of your base
* Select your table on the left side Menu
* Click on "List Records"
* On the "curl" window to the right, you'll see an example request
* Copy the URL and the authorization with your API key, you'll need that for later!

{% hint style="info" %}
To get your API key below the URL, you'll have to check the "Show API key" box on the top right corner of the curl window!
{% endhint %}

### Step 2: Create a Computed Field

* Go to the "All" Tab of the Left Sidebar
* Scroll down to the Computed Fields section and create a new one&#x20;
* Give it a cool, original name. Something like "airtable\_data"
* Scroll to the bottom of the Options Tab on the Right Sidebar
* Click on "Generate Sample Code", it will generate an empty function:

### Step 3: Fetch!

* Copy this code inside the function:

```
function result() {
  let url = "YOUR_URL";
  
  return fetch(url, {
    headers: {'Authorization': 'Bearer YOUR_API_KEY',
    }
  })
    .then((response) => response.json())
    .then(json => {
      // Do something with the data
      return json.records
    }); 
    
}
```

* Paste the URL you copied from Airtable where it says `YOUR_URL` , and your API key where it says `YOUR_API_KEY`
* Click on "Update" to save the code changes and you should be ready to go!

{% hint style="info" %}
Your Airtable URL from the example request has its maxRecords set to 3 by default. You can change that to a max of 100. This is what it looks like, you can change the number 3 on the URL: "<https://api.airtable.com/v0/apps1073vcOXbLbso/example\\_base?maxRecords=3\\&view=Grid%20view>"

{% endhint %}

### Security warning

Your Airtable API key is the same for every base on your account, so:

* We recommend creating an account that only has access to that base.
* Anyone with the account API key could have read/write access to that account bases.
* Even if write permission isn't an issue, they still get access to all the data.

{% hint style="info" %}
In most cases this isn't an issue, but if it is an issue for you, don't worry! We're working on it to make it safer.
{% endhint %}

&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trysavvy.com/other-useful-docs/work-in-progress/pending/work-in-progress-how-to-bring-data-from-airtable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
