In scripting, is there a way to access a different base than the one that you are in?

I’m using a custom script to get records form the base I am in. To do this, I am using using:


Now, I’d like to create new records using data from the records in base.getTable('Incoming') in a table that lives in a different base. How can I reference a different base from this script?

Scripting is only aware of its own base. If you want to use scripting to access a different base, you can use the REST API. However, you would not be able to take advantage of any libraries, and you are exposing your API key to all users in the base.

Another option would be to use a script to call a webhook automation in the remote base. Then have script in the remote base create the record.


Is there a way to use the API inside of a script? Also, when you mention webhooks, does that mean integrating with another software?

Using the REST API from a script is just like using the REST API from anywhere else, except that you cannot use libraries. See the documentation for more info.

The webhook automation is documented here

I guess I’m wondering how to access the below (from API docs) in the scripting:

var Airtable = require('airtable');
var base = new Airtable({apiKey: 'YOUR_API_KEY'}).base('appLeAWrWWE5ctwux');

How can I use the API in a script if I don’t have access to the base I want to send to/from?

Does the script “know” about require('airtable');?

When you use require('airtable') you are trying to include a library. This will not work. Scripting cannot use libraries. You will need craft the API calls on your own. Depending on your level of coding experience, this might be a large learning curve, or (if you have budget) you may want to hire someone to write this for you.

Why do you want to create new records in a different base? Could you use a synced table instead?

1 Like

I think I can craft them on my own, but I’m still unsure of how to reference the base in the scripting app? Would I have to create a custom React app to do this?

Also, I just saw the “sync table” feature:

Is there a way to do this programmatically?

The issue is that we want to make space in one base by moving or deleting records we don’t need everyday but want to hold on to.

You would not create a react app. That is for creating a custom app, not using the REST API. The documentation for the REST API is quite good and has all the information that an experienced developer needs.

Yes, that is the synced table feature that I referred to in my earlier post.

But how can I use the API in the script if I can’t use libraries? Where should I use the API?

You must build every aspect of the API call without the benefit of helper libraries (i.e., SDKs). It’s very tedious and it places all the integration burden on you and requires a deep understanding of native javascript directives. Don’t do this if there’s a better way, and @kuovonne has already pointed you in that direction - calling an Airtable webhook seems far less complex and requires no API key exposure or API skills.

1 Like


i think you choose very hard way for a task, that may be solved with less efforts.
If you need to separate and store ‘historical part’, you can adjuct syncing.
In target base, you can create kind of automation which copies synced table to some other table and then change some value in other ‘signal’ table synced back to source. it may be smth like ‘5000 records from 01 Jan 2021 to 30 Mar 2021 archived succesfully’, and then it may run some automation in source table which removes these records.

other approach - you can put whole record (if it doesn’t have very important attachments) in json-string and put it to a single long-text field. thus, you can for example put 100 records in a single record of a table having 100 long-text fields.
you need to write a procedures which can archive and extract values, but you can perform it inside the same base.

of course, you can go deeper and think about compression and maybe binary form of data storing (i didn’t check whether it’s possible to work with attachments in script). but i would rethink whole data-storing strategy implementing some ‘unlimited’ type of storage outside of Airtable.