Build a QRCode API and Inventory Management System with Autocode and Airtable

If you use Airtable to keep an inventory of items in your warehouse, you can save time by scanning QR codes with your iPhone and quickly updating your Airtable base as you restock your shelves or check items in and out.

In this tutorial, we’ll learn to create QR Codes for every record in an Airtable base. You’ll be able to print QR Codes for each product and attach them to your inventory shelves for easy scanning and updating information on every record. 🙌🏼

While Airtable’s iPhone app allows you to scan barcode numbers through your phone’s camera, it does not automatically generate unique barcodes every time a record is created.

What You’ll Need Beforehand

  • 1x Airtable is a combination of a spreadsheet & database.
  • 1x — A platform for building and deploying APIs, linking software tools, powering Slack apps, automating tasks, and more.

We’ll learn how to build and publish a QRcode API service with Autocode

We’ll use our QRCode API in an Airtable formula to automatically produce barcodes for each record (row) in Airtable.

We’ll write a script to transform a bulk of image file URLs into image attachments in Airtable.

Part 1: How to Build a QRCode API with Autocode

Head on over and copy the QRCode template using this link:

You will be prompted to sign in or create a free account. If you have a Standard Library account click and sign in using your Standard Library credentials.

Give your project a unique name and select

Navigate through the functions folder on the left and select QRCode.js file.

Standard Library automatically generates HTTP endpoints (URLs) for each file.

This URL consists of

<username><projectName>@environment/<endpointName> and it will be available after you deploy your project in the next steps.

For example:

A Brief Explanation:

of code imports the node QRcode NPM package. Autocode automatically adds dependencies to package.json file when importing NPM packages.

isa comment that serves as documentation and allows Standard Library to type check requests to our APIs. If a request does not supply a parameter with an expected type, it will return an error. You can learn more about the parameters and types here:

This QRCode API endpoint has a parameter expecting a string that passes in a URL. It will return an HTTP Response as an object. The headers are set to {“Content-Type”: “image/png”} on and the body () is the result we define on

is a function (module.exports) that will export our entire code found in . Once you deploy your code, this function will be wrapped into an HTTP endpoint (API endpoint) and will be made available at:


Test Run the Code:

Before you deploy your API give it a test run. Find and select the button on the upper right.

Set the url to a site you’d like to generate a QRCode image for and click Payloads must be JSON formatted like this:

When you select , you’ll see the QR code image result rendered by Autocode.

Take out your phone’s camera and test it out!

🚀 Ship your QRCode API Generator

You’re ready to deploy your QRCode API! Select in the bottom-left of the file manager.

Congrats! 🎉

Your QRCode service is live! You can see the documentation for your APIs by typing<username>/lib/<projectName>/dev/ in the browser.

Alternatively, find the manager button on the upper left and select

Your APIs docs will open up in a different tab. You can also test your API right from the docs by passing in any URL.

Part 2: Generate QRCodes for Every Row in Airtable using a Formula

You can easily create QRCode images for each item in an Airtable Product Inventory Management System. As a sample for this tutorial, we’ll use this inventory tracking template. Copy the template to your Airtable Workspace by clicking this link 👇🏼

Right-click on any record in an Airtable to view the record URL.

Notice that all record URLs include:<TableID>/<ViewID>/<RecordID>

For Ex:

We will use these record URLs in a formula to autogenerate QRCodes for every record using the API we built in

Writing the Formula in Airtable

Step 1.

Create a new field and title it QRCodeLink select Formula for the field type.

Copy and paste your QRCode URL in the formula field, followed by ?url= .

Here’s the result of the first part of the formula:

Step 2:

Next, we’ll add a new function by first inserting an ampersand (&) as a separator. Then:

  • Add the ENCODE_URL_COMPONENT function followed by the URL to your Table which consists of "" insert an ampersand (&) as a separator and add RECORD_ID() function to retrieve every row’s ID. Close off your function with a bracket ) .
  • Mine looks like this: '' & ENCODE_URL_COMPONENT("" & RECORD_ID())

Hit Now every time you add a new record to your Airtable, a QRCode will be autogenerated for that record.

Part 3: Transfer Image File URLs to Attachments in Bulk with Autocode

You now have a link to the QRCode image for every row in Airtable.

Create a new Attachment field and title it QRCodeImage:

Copy the code to transfer Image file URLs to attachments using this link:

Name your project and select

Navigate through the functions folder on the left and select QueryUpdate.js file.

Select the red button, which will prompt you to link an Airtable account.

Selectand followthe instructions on the modal to retrieve your Airtable API Key and select .

Find and select your base and click .


Once you’ve finished Linking your accounts you need to add your base’s ID to line 12 and Line 28.

Locate your Base ID by clicking on the tab on the upper right corner of your Base. Select

Copy the base id:

Paste the base ID onto and in between the backtick quotes to set the value for baseId as seen in the screenshot:

Hit and watch as your Airtable becomes populated by Autocode.

That’s it! 🤗

You now have all the tools you need to build an Inventory Control System with Airtable and QRCode APIs on Standard Library. I hope you found this tutorial helpful. If you have any questions, jump into our support channels. Our team at Standard Library is ready to help.


The Startup

Get smarter at building your thing. Join The Startup’s +738K followers.