Skip to main content

Quickstart

This guide will help you make your first API call to Switchyard.

Prerequisites

  • Access to the Switchyard admin dashboard
  • A user account with appropriate permissions
  • Your Supabase project credentials (for direct API access)

Authentication

Switchyard uses Supabase Auth for authentication. There are two main ways to authenticate:

Option 1: Session-based (Admin UI)

When logged into the admin dashboard, your session cookie is automatically included with requests.

Option 2: Bearer Token (API/Mobile)

For programmatic access, authenticate with Supabase and use the JWT:
# 1. Get a token from Supabase
curl -X POST 'https://your-project.supabase.co/auth/v1/token?grant_type=password' \
  -H "apikey: YOUR_ANON_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "user@example.com", "password": "password"}'

# 2. Use the access_token in API calls
curl 'https://api.switchyard.run/admin/products' \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Your First API Call

Let’s fetch the list of products:
curl 'https://api.switchyard.run/admin/products?limit=10' \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Next Steps