Automation Blog

How to Delete an Airtable Record via API or JavaScript in Zapier

Airtable's native Zapier integration does not include a Delete Record action. Here are three workarounds: using Airtable's built-in API Request action with your connected account, a JavaScript Code step with fetch and your Airtable API key, and a Python Code step — each with full working examples.

ZapierAirtableAPICode Steps

By Troy Tessalone · · 5 minutes

Automation Guide

A practical field guide from Automation Ace.

How to Delete an Airtable Record via API or JavaScript in Zapier

Airtable's Zapier integration supports creating, updating, and searching records — but not deleting them. When a Zap needs to remove an Airtable record (clearing processed queue items, pruning stale entries, enforcing retention policies), you have to call the Airtable API directly. There are three practical ways to do this inside a Zap: the Airtable API Request action (simplest), a JavaScript Code step with fetch (most flexible), or a Python Code step.

What You Need

  • The Airtable Base ID: found in the base URL when viewing a base — https://airtable.com/appXXXXXXXXXXXXXX/... — the appXXXX portion
  • The Table ID or Table Name: the table name as it appears in Airtable, or the table ID (tblXXXXXXXXXXXXXX) from the URL
  • The Record ID: the recXXXXXXXXXXXXXX string of the specific record to delete — usually available as a field in Zapier triggers that come from Airtable
  • An Airtable API key or Personal Access Token (for Code step options): generate one at airtable.com/create/tokens with data.records:write scope on the relevant base

Option 1: Airtable API Request Action (Recommended — No Code)

If your Zap already has an Airtable connected account, the Airtable integration includes an API Request action that uses that account's credentials automatically:

  1. Add an Airtable → API Request action step
  2. Select your connected Airtable account
  3. Set Method to DELETE
  4. Set Endpoint to: /v0/{baseId}/{tableIdOrName}/{recordId}
  5. Replace {baseId}, {tableIdOrName}, and {recordId} by mapping from earlier trigger/step fields
  6. No request body is needed for a DELETE

Example endpoint with mapped fields: /v0/appABC123/Orders/{{Record ID}}

On success, Airtable returns a JSON body confirming the deletion. See using the API Request action in Zapier for more on this pattern.

Option 2: JavaScript Code Step with fetch

Use this when you don't have an Airtable Zapier connection, need additional logic around the delete, or want to delete multiple records in one step:

const apiKey     = inputData.airtable_api_key; // store in Zapier's input fields, not hardcoded
const baseId     = inputData.base_id;          // e.g. "appABC123XYZ"
const tableId    = inputData.table_id;         // e.g. "tblXXXXXXXXXXXX" or table name
const recordId   = inputData.record_id;        // e.g. "recXXXXXXXXXXXX"

const url = `https://api.airtable.com/v0/${baseId}/${encodeURIComponent(tableId)}/${recordId}`;

const response = await fetch(url, {
  method: 'DELETE',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  }
});

if (!response.ok) {
  const err = await response.text();
  throw new Error(`Airtable delete failed (${response.status}): ${err}`);
}

const result = await response.json();

output = {
  deleted:   result.deleted ? 'true' : 'false',
  record_id: result.id || recordId
};

Option 2b: Delete Multiple Records in One Request

The Airtable API supports deleting up to 10 records per request via a single DELETE with query parameters:

const apiKey   = inputData.airtable_api_key;
const baseId   = inputData.base_id;
const tableId  = inputData.table_id;
// Comma-separated record IDs: "recAAA,recBBB,recCCC"
const recordIds = inputData.record_ids.split(',').map(s => s.trim()).filter(Boolean);

// Build query string: ?records[]=recAAA&records[]=recBBB
const params = recordIds.map(id => `records[]=${encodeURIComponent(id)}`).join('&');
const url = `https://api.airtable.com/v0/${baseId}/${encodeURIComponent(tableId)}?${params}`;

const response = await fetch(url, {
  method: 'DELETE',
  headers: { 'Authorization': `Bearer ${apiKey}` }
});

if (!response.ok) throw new Error(`Delete failed (${response.status}): ${await response.text()}`);

const result = await response.json();
const deletedIds = (result.records || []).map(r => r.id).join(',');

output = {
  deleted_count: String((result.records || []).length),
  deleted_ids: deletedIds
};

Option 3: Python Code Step

import requests

api_key   = input_data['airtable_api_key']
base_id   = input_data['base_id']
table_id  = input_data['table_id']
record_id = input_data['record_id']

url = f"https://api.airtable.com/v0/{base_id}/{table_id}/{record_id}"
headers = {"Authorization": f"Bearer {api_key}"}

response = requests.delete(url, headers=headers)
response.raise_for_status()

result = response.json()

output = {
    'deleted':   str(result.get('deleted', False)).lower(),
    'record_id': result.get('id', record_id)
}

Storing the API Key Safely

Never hardcode the Airtable API key inside the Code step. Instead:

  • Add an input field named airtable_api_key in the Code step's input section
  • Set its value to the API key as a static value in that input field — it's stored as Zap configuration, not in the code itself
  • The code references it via inputData.airtable_api_key

This keeps the key out of the code and makes it easy to rotate without editing the script.

Getting the Record ID in Your Zap

The record ID to delete must come from somewhere earlier in the Zap:

  • Airtable trigger: the "Record ID" field is available directly
  • Airtable search/lookup step: returns the record ID of the matched record
  • A previous step's output: if another step created or fetched the record, map its ID forward
  • A webhook or form field: if the record ID is passed in from an external system
Deleting Airtable records from Zapier requires going through the API — there's no native delete action in the Zapier integration. The API Request action is the cleanest path when you have an Airtable account connected in the Zap. A Code step with fetch gives you more flexibility — bulk deletes, error handling, and conditional deletion logic. Either way, the Airtable API DELETE endpoint is simple: one URL, one Authorization header, done.

For more on the API Request action pattern, see using the API Request action in Zapier app integrations. For the full fetch pattern for Airtable and other APIs, see HTTP POST in Zapier Code steps. For building Airtable automation triggers that fire Zaps, see triggering Zaps from Airtable automations. For help building an Airtable data management workflow, talk to Automation Ace.

ZapierAirtableAPICode Steps

Disclaimer: This article may include links to apps, products, or services. Some links may be affiliate links, which means Automation Ace may earn a commission at no extra cost to you.

Build Better Systems

Ready to automate with confidence?

Share your tools, process, and goals. Automation Ace can design the workflow, integration, AI assist, or code bridge that fits your business.

Start a Project