Skip to main content

Overview

Auction Excellence uses Supabase’s auto-generated REST API (PostgREST) for data access. All endpoints support CRUD operations with powerful filtering, sorting, and pagination capabilities.

RESTful Design

Standard HTTP methods (GET, POST, PATCH, DELETE)

PostgREST Syntax

Advanced filtering, embedding, and aggregation

RLS Protected

All requests filtered by Row Level Security

Real-time Ready

Subscribe to changes via WebSocket

Base URL

https://your-project.supabase.co/rest/v1/
All endpoints require authentication headers:
curl -X GET 'https://your-project.supabase.co/rest/v1/locations' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"

Response Format

Success Response

[
  {
    "id": "uuid",
    "created_at": "2025-01-15T10:30:00Z",
    ...
  }
]

Single Record Response

Add Prefer: return=representation header to get the created/updated record:
curl -X POST '...' \
  -H "Prefer: return=representation"

Error Response

{
  "code": "PGRST116",
  "details": null,
  "hint": null,
  "message": "The result contains 0 rows"
}

Count Header

Request record count with Prefer: count=exact:
curl -X GET '...' \
  -H "Prefer: count=exact"
# Response headers include: Content-Range: 0-24/100

Common Query Parameters

Filtering

OperatorSyntaxExample
Equalseq.value?status=eq.open
Not equalsneq.value?status=neq.closed
Greater thangt.value?car_count=gt.10
Less thanlt.value?car_count=lt.100
Greater or equalgte.value?created_at=gte.2025-01-01
Less or equallte.value?submitted_at=lte.2025-01-31
Like (case sensitive)like.pattern?name=like.*North*
ILike (case insensitive)ilike.pattern?name=ilike.*north*
Is nullis.null?parent_message_id=is.null
Is not nullnot.is.null?image_url=not.is.null
In listin.(a,b,c)?status=in.(open,in_progress)

Ordering

?order=column.asc
?order=column.desc
?order=column1.asc,column2.desc

Pagination

?offset=0&limit=25       # First page
?offset=25&limit=25      # Second page
Or use range headers:
curl -X GET '...' \
  -H "Range: 0-24"       # First 25 records

Column Selection

?select=id,name,created_at
?select=*                # All columns (default)
?select=*,locations(*)           # Include related locations
?select=*,user:users(full_name)  # Renamed relation with specific columns

Auctions

Manage multi-tenant organizations.
GET /auctionsGet all auctions the user belongs to.
curl -X GET 'https://your-project.supabase.co/rest/v1/auctions?select=*' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Response:
[
  {
    "id": "abc123-uuid",
    "name": "Main Auto Auction",
    "slug": "main-auto",
    "is_active": true,
    "subscription_tier": "pro",
    "settings": {},
    "created_at": "2025-01-01T00:00:00Z",
    "updated_at": "2025-01-15T10:30:00Z"
  }
]

Auction Members

Manage user membership and roles within auctions.
GET /auction_members
curl -X GET 'https://your-project.supabase.co/rest/v1/auction_members?auction_id=eq.abc123&select=*,user:users(id,email,full_name)' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Response:
[
  {
    "id": "member-uuid",
    "auction_id": "abc123",
    "user_id": "user-uuid",
    "role": "admin",
    "joined_at": "2025-01-01T00:00:00Z",
    "user": {
      "id": "user-uuid",
      "email": "[email protected]",
      "full_name": "John Admin"
    }
  }
]

Locations

Manage parking lots and facilities.
GET /locations
curl -X GET 'https://your-project.supabase.co/rest/v1/locations?auction_id=eq.abc123&is_active=eq.true&order=name.asc' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Response:
[
  {
    "id": "loc-uuid",
    "auction_id": "abc123",
    "name": "North Lot",
    "address": "123 Main St",
    "operating_hours_start": "06:00:00",
    "operating_hours_end": "18:00:00",
    "submission_frequency_minutes": 60,
    "is_active": true,
    "created_at": "2025-01-01T00:00:00Z"
  }
]

Lot Submissions

Submit and retrieve parking lot occupancy data.
GET /recent_submissions (view)Use the view for aggregated data with entries.
curl -X GET 'https://your-project.supabase.co/rest/v1/recent_submissions?auction_id=eq.abc123&order=submitted_at.desc&limit=50' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Response:
[
  {
    "id": "sub-uuid",
    "location_id": "loc-uuid",
    "location_name": "North Lot",
    "user_id": "user-uuid",
    "submitted_by": "John Smith",
    "submitted_at": "2025-01-15T10:30:00Z",
    "entries": [
      {"type_name": "Dealer", "car_count": 45, "image_url": null},
      {"type_name": "Retail", "car_count": 30, "image_url": "https://..."}
    ],
    "entry_count": 2,
    "total_car_count": 75,
    "image_url": "https://..."
  }
]

Quality Inspections

Create and retrieve vehicle inspection records.
GET /recent_quality_inspections (view)
curl -X GET 'https://your-project.supabase.co/rest/v1/recent_quality_inspections?auction_id=eq.abc123&order=submitted_at.desc&limit=50' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Response:
[
  {
    "id": "insp-uuid",
    "location_id": "loc-uuid",
    "location_name": "North Lot",
    "user_id": "user-uuid",
    "inspector_name": "Jane Inspector",
    "vin_number": "1HGBH41JXMN109186",
    "barcode": "A12345",
    "submitted_at": "2025-01-15T10:30:00Z",
    "defect_count": 3
  }
]

Problem Reports

Create and manage A3-style problem reports.
GET /active_problem_reports (view)
curl -X GET 'https://your-project.supabase.co/rest/v1/active_problem_reports?auction_id=eq.abc123&status=neq.closed&order=submitted_at.desc' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Response:
[
  {
    "id": "prob-uuid",
    "issue_name": "Delayed Vehicle Processing",
    "area": "Intake",
    "location_name": "North Lot",
    "status": "in_progress",
    "prepared_by_name": "John Smith",
    "assigned_to_name": "Jane Manager",
    "action_count": 5,
    "completed_action_count": 2,
    "submitted_at": "2025-01-10T10:00:00Z"
  }
]

Chat

Real-time messaging with channels and reactions.
GET /channels
curl -X GET 'https://your-project.supabase.co/rest/v1/channels?auction_id=eq.abc123&is_archived=eq.false&order=name.asc' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Response:
[
  {
    "id": "chan-uuid",
    "auction_id": "abc123",
    "name": "general",
    "description": "General discussion",
    "is_default": true,
    "is_archived": false,
    "created_at": "2025-01-01T00:00:00Z"
  }
]

Analytics

Retrieve aggregated statistics and trends.
POST /rpc/get_location_stats
curl -X POST 'https://your-project.supabase.co/rest/v1/rpc/get_location_stats' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "p_location_id": "loc-uuid",
    "p_start_date": "2025-01-01T00:00:00Z",
    "p_end_date": "2025-01-31T23:59:59Z"
  }'
Response:
{
  "total_submissions": 124,
  "total_car_count": 4567,
  "average_car_count": 36.8,
  "by_type": [
    {"type_name": "Dealer", "count": 2345},
    {"type_name": "Retail", "count": 2222}
  ]
}

File Storage

Upload and manage files in Supabase Storage.
POST /storage/v1/object/lot-images/{path}
curl -X POST 'https://your-project.supabase.co/storage/v1/object/lot-images/user-uuid/1705323000_abc123.jpg' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: image/jpeg" \
  --data-binary @photo.jpg
Response:
{
  "Key": "lot-images/user-uuid/1705323000_abc123.jpg"
}

Error Codes

Common PostgREST error codes:
CodeMeaningResolution
PGRST000Connection errorCheck Supabase project status
PGRST100Relation not foundVerify table name
PGRST116No rows returnedCheck filter conditions
PGRST200Invalid queryReview filter syntax
PGRST301JWT expiredRefresh authentication token
42501RLS policy violationUser lacks permission
23505Unique constraint violationDuplicate value exists
23503Foreign key violationReferenced record missing

Rate Limiting

API rate limits per IP address:
TierRequests/minRequests/hour
Free601,000
Pro30010,000
EnterpriseCustomCustom
Heavy operations (reports, analytics) count as 5 requests.

Next Steps