Oil Price API Documentation - Quick Start in 5 Minutes | REST API
GitHub
GitHub

Airtable Integration

Build powerful oil price tracking databases in Airtable. Combine the flexibility of a spreadsheet with the power of a database to track, analyze, and share commodity price data across your organization.


Overview

Airtable provides a flexible database platform that's perfect for tracking oil prices over time. Combined with OilPriceAPI, you can create automated price tracking systems, historical databases, and custom reporting dashboards without writing code.

What You Can Build:

  • Historical oil price databases
  • Price comparison trackers
  • Automated daily price logs
  • Team-accessible commodity dashboards
  • Price alert and notification systems
  • Custom reporting and analysis tools

Prerequisites

Before you begin:

  1. An active OilPriceAPI account with API key (Sign up)
  2. An Airtable account (Create free account)
  3. A connector tool: Zapier, Make, or Airtable Automations with Scripts

Method 1: Airtable Automations with Scripts

Airtable's built-in automations can run scripts to fetch oil prices directly.

Step 1: Create Your Oil Price Base

  1. Create a new Airtable base
  2. Name it "Oil Price Tracker"
  3. Create a table with these fields:
Field NameField TypeDescription
DateDateDate of price record
CommoditySingle SelectBRENT_CRUDE_USD, WTI_USD, etc.
PriceCurrencyPrice per barrel
ChangePercentDaily change percentage
Updated AtDate/TimeTimestamp from API
Record IDAutonumberUnique identifier

Step 2: Create an Automation

  1. Go to Automations in your base
  2. Click Create automation
  3. Name it "Daily Oil Price Import"

Step 3: Set the Trigger

  1. Choose At a scheduled time
  2. Configure:
    • Frequency: Daily
    • Time: 8:00 AM (or your preferred time)
    • Timezone: Your timezone

Step 4: Add a Script Action

  1. Add action: Run a script
  2. Paste this script:
// Airtable Automation Script: Fetch Oil Prices
let settings = input.config({
    title: "OilPriceAPI Settings",
    description: "Configure your API connection",
    items: [
        input.config.text("apiKey", {
            label: "API Key",
            description: "Your OilPriceAPI key"
        }),
        input.config.text("commodities", {
            label: "Commodity Codes",
            description: "Comma-separated codes",
            defaultValue: "BRENT_CRUDE_USD,WTI_USD,NATURAL_GAS_USD"
        })
    ]
});

// Fetch prices from OilPriceAPI
let response = await fetch(
    `https://api.oilpriceapi.com/v1/prices/latest?by_code=${settings.commodities}`,
    {
        headers: {
            "Authorization": `Token ${settings.apiKey}`,
            "Content-Type": "application/json"
        }
    }
);

if (!response.ok) {
    throw new Error(`API request failed: ${response.status}`);
}

let data = await response.json();

// Get the target table
let table = base.getTable("Oil Prices");

// Create records for each commodity
let recordsToCreate = [];

for (let item of data.data.items) {
    recordsToCreate.push({
        fields: {
            "Date": new Date().toISOString().split('T')[0],
            "Commodity": item.code,
            "Price": item.price,
            "Change": item.change_percent / 100,
            "Updated At": item.updated_at
        }
    });
}

// Insert records
await table.createRecordsAsync(recordsToCreate);

output.text(`Successfully imported ${recordsToCreate.length} price records`);

Step 5: Configure and Test

  1. Click Test script to verify it works
  2. Review created records in your table
  3. Toggle automation ON

Method 2: Integration via Zapier

Connect OilPriceAPI to Airtable using Zapier for a code-free approach.

Step 1: Prepare Your Airtable Base

Create a base with the same field structure as Method 1.

Step 2: Create a Zapier Zap

  1. Trigger: Schedule by Zapier

    • Choose frequency (daily, hourly)
  2. Action 1: Webhooks by Zapier (GET)

    • URL: https://api.oilpriceapi.com/v1/prices/latest?by_code=BRENT_CRUDE_USD
    • Headers: Authorization: Token YOUR_API_KEY
  3. Action 2: Airtable (Create Record)

    • Base: Oil Price Tracker
    • Table: Oil Prices
    • Map fields from API response

Step 3: Handle Multiple Commodities

For multiple commodities, add a Looping by Zapier action:

  1. After the API call, add Looping by Zapier
  2. Loop through: {{data.items}}
  3. Inside the loop, add Airtable Create Record

Method 3: Integration via Make

Build visual workflows to sync OilPriceAPI with Airtable.

Scenario Setup

[Scheduler] → [HTTP Module] → [JSON Parse] → [Iterator] → [Airtable: Create Record]

Configuration

  1. HTTP Module:

    • URL: https://api.oilpriceapi.com/v1/prices/latest
    • Headers: Authorization with your API key
  2. Iterator:

    • Array: {{1.data.items}}
  3. Airtable Module:

    • Connection: Your Airtable account
    • Base: Oil Price Tracker
    • Table: Oil Prices
    • Map iterator values to fields

Building Your Oil Price Dashboard

View 1: Grid View (Default)

Your standard table view showing all records. Configure:

  • Sort by Date (descending) to see latest prices first
  • Group by Commodity for organized viewing

View 2: Calendar View

Track prices over time:

  1. Create new Calendar view
  2. Set Date field as the calendar date
  3. See price records plotted on the calendar

View 3: Gallery View

Create price cards:

  1. Create Gallery view
  2. Configure card layout to show key metrics
  3. Add cover images for each commodity

View 4: Chart Extension

Visualize price trends:

  1. Add the Chart extension
  2. Create line chart:
    • X-axis: Date
    • Y-axis: Price
    • Group by: Commodity
  3. See historical trends at a glance

Use Case Templates

Template 1: Weekly Commodity Report

Base Structure:

  • Table: Weekly Prices
  • Fields: Week Start Date, Week End Date, Commodity, Open, High, Low, Close, Weekly Change

Automation:

  • Runs every Monday
  • Aggregates previous week's daily prices
  • Calculates high, low, and change

Template 2: Price Alert Tracker

Base Structure:

  • Table: Alerts
  • Fields: Alert Name, Commodity, Threshold Type (Above/Below), Threshold Price, Status, Last Triggered

Automation:

  • Fetch prices hourly
  • Compare against alert thresholds
  • Update status and send notifications

Template 3: Multi-Commodity Comparison

Base Structure:

  • Table: Daily Snapshot
  • Fields: Date, Brent Price, WTI Price, Spread, Natural Gas, Diesel

View Configuration:

  • Create charts showing spread between Brent and WTI
  • Track correlations between commodities

Template 4: Fuel Cost Calculator

Base Structure:

  • Table: Cost Calculations
  • Fields: Date, Diesel Price, Fleet Size, Daily Consumption, Daily Fuel Cost, Monthly Estimate

Formula Fields:

Daily Fuel Cost = {Diesel Price} * {Daily Consumption}
Monthly Estimate = {Daily Fuel Cost} * 22

Advanced Airtable Features

Linked Records

Connect price data to other business data:

  1. Create a "Suppliers" table
  2. Link price records to supplier contracts
  3. Track cost implications automatically

Rollup Fields

Aggregate data across linked records:

  • Calculate average price per supplier
  • Sum total costs by period
  • Count records by commodity type

Lookup Fields

Pull data from linked records:

  • Show current price on contract records
  • Display commodity details on transaction records

Formula Examples

// Calculate percentage change
IF({Previous Price},
   ROUND((({Price} - {Previous Price}) / {Previous Price}) * 100, 2),
   "N/A"
)

// Format price with currency
CONCATENATE("$", ROUND({Price}, 2), " USD")

// Days since update
DATETIME_DIFF(NOW(), {Updated At}, 'days')

Sharing and Collaboration

Share with Team

  1. Click Share in your base
  2. Invite team members with appropriate permissions:
    • Creator: Full access
    • Editor: Can edit records
    • Commenter: Can comment only
    • Read only: View access

Public Dashboards

Create public views for stakeholders:

  1. Create a filtered view
  2. Click Share view
  3. Generate public link
  4. Embed in internal sites or share externally

Sync to Other Tools

Use Airtable's sync feature:

  • Sync to other Airtable bases
  • Connect to BI tools via API
  • Export to CSV for reporting

Troubleshooting

Records Not Creating

  • Verify Airtable field types match API data types
  • Check automation/Zap execution history
  • Ensure API key has required permissions

Duplicate Records

  • Add a unique identifier formula field
  • Use "Find Record" before creating new ones
  • Set up deduplication automation

Script Errors

  • Check API key is entered correctly in settings
  • Verify commodity codes are valid
  • Review Airtable's automation logs

FAQ

Can I use Airtable's free plan for oil price tracking?

Yes, Airtable's free plan supports automations and scripts. You're limited to 100 automation runs per month. For daily updates to one table, this covers about 3 months of usage.

How much historical data can I store?

Airtable's free plan allows 1,000 records per base. Pro plans offer up to 50,000 records. For long-term historical data, consider archiving older records or upgrading your plan.

Can I import historical oil prices?

Yes. Use the OilPriceAPI historical endpoint (/v1/prices/past_week or /v1/prices/past_day) and run a one-time import script to backfill your database.

How do I share price data with my team?

Use Airtable's sharing features to invite team members. Create specific views for different audiences and control permissions for each user.

Can I create charts and visualizations?

Yes. Use Airtable's Chart extension to create line charts, bar charts, and other visualizations directly in your base. For advanced analytics, export to Google Sheets or BI tools.


Related Documentation

  • Authentication Guide
  • API Reference
  • Zapier Integration
  • Make Integration
  • Notion Integration
Last Updated: 12/28/25, 12:24 AM