HEPCO API
Powered by Airtable
v1.0Airtable
REST API
HEPCO API Reference
A generic REST API built on Next.js route handlers that proxies full CRUD operations to your Airtable base. Replace :table with any table name in your connected base.
Base URL
/api/:table
This API uses your AIRTABLE_API_KEY and AIRTABLE_BASE_ID environment variables. These are server-side only and never exposed to the client. Add authentication middleware before deploying publicly.
Endpoints
Error Responses
400Bad Request
Missing or invalid 'fields' in request body
404Not Found
Record ID does not exist in the table
500Server Error
Airtable connection or configuration error
{ "error": "Human-readable error message" }Quick Start
Fetch all records from a table named "Products":
fetch('/api/Products')
.then(res => res.json())
.then(data => console.log(data.records))Create a new record:
fetch('/api/Products', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
fields: { Name: 'New Product', Price: 99 }
})
})