← Airtable

Create single record with Airtable API

Pipedream makes it easy to connect APIs for Airtable and 700+ other apps remarkably fast.

Trigger workflow on
HTTP requests, schedules and app events
Next, do this
Create single record with the Airtable API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

Create a workflow to Create single record with the Airtable API. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Configure the Create single record action
    1. Connect your Airtable account
    2. Select a Base
    3. Select a Table
    4. Configure Typecast
  2. Select a trigger to run your workflow on HTTP requests, schedules or app events
  3. Deploy the workflow
  4. Send a test event to validate your setup
  5. Turn on the trigger

Details

This is a pre-built, open source component from Pipedream's GitHub repo. The component is developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Create single record on Airtable
Description:Adds a record to a table.
Version:1.0.1
Key:airtable-create-single-record

Code

import airtable from "../../airtable.app.mjs";
import {
  makeFieldProps,
  makeRecord,
} from "../../common/utils.mjs";
import common from "../common.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
  key: "airtable-create-single-record",
  name: "Create single record",
  description: "Adds a record to a table.",
  version: "1.0.1",
  type: "action",
  props: {
    ...common.props,
    // eslint-disable-next-line pipedream/props-label,pipedream/props-description
    tableId: {
      ...common.props.tableId,
      reloadProps: true,
    },
    typecast: {
      propDefinition: [
        airtable,
        "typecast",
      ],
    },
  },
  async additionalProps() {
    const baseId = this.baseId?.value ?? this.baseId;
    const tableId = this.tableId?.value ?? this.tableId;
    try {
      const tableSchema = await this.airtable.table(baseId, tableId);
      return makeFieldProps(tableSchema);
    } catch (err) {
      const hasManualTableInput = !this.tableId?.label;
      // If manual input and .table throws error, return a record prop
      // otherwise, throw ConfigurationError
      if (hasManualTableInput) {
        return {
          // Use record propDefinition directly to workaround lack of support
          // for propDefinition in additionalProps
          record: airtable.propDefinitions.record,
        };
      }
      throw new ConfigurationError("Could not find a table for the specified base ID and table ID. Please adjust the action configuration to continue.");
    }
  },
  async run({ $ }) {
    const baseId = this.baseId?.value ?? this.baseId;
    const tableId = this.tableId?.value ?? this.tableId;

    const table = this.airtable.base(baseId)(tableId);

    const record = this.record ?? makeRecord(this);

    this.airtable.validateRecord(record);

    const data = [
      {
        fields: record,
      },
    ];

    const params = {
      typecast: this.typecast,
    };

    let response;
    try {
      [
        response,
      ] = await table.create(data, params);
    } catch (err) {
      this.airtable.throwFormattedError(err);
    }

    $.export("$summary", `Added 1 record to ${this.baseId?.label || baseId}: [${this.tableId?.label || tableId}](https://airtable.com/${baseId}/${tableId})`);
    return response;
  },
};

Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
AirtableairtableappThis component uses the Airtable app.
BasebaseIdstringSelect a value from the drop down menu.
TabletableIdstringSelect a value from the drop down menu.
Typecasttypecastboolean

The Airtable API will perform best-effort automatic data conversion from string values if the typecast parameter is True. Automatic conversion is disabled by default to ensure data integrity, but it may be helpful for integrating with 3rd party data sources.

Authentication

Airtable uses API keys for authentication. When you connect your Airtable account, Pipedream securely stores the keys so you can easily authenticate to Airtable APIs in both code and no-code steps.

Airtable uses simple token-based authentication. To generate or manage your API key, visit your account settings.

get airtable api key

About Airtable

Looks like a spreadsheet, acts like a database.