Authentication

The Waymaker One API uses a dual-authentication system supporting both internal Waymaker applications and external API customers.

Authentication Methods

1. JWT Token Authentication (Recommended)

For applications with user sessions, use JWT tokens from the Waymaker authentication system.

const response = await fetch('https://api.waymakerone.com/v1/coordinate', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${userToken}`,
    'Content-Type': 'application/json',
    'x-app-context': 'your-app-name'
  },
  body: JSON.stringify({
    messages: [{
      role: 'user',
      content: 'Help me create a strategy canvas for my startup'
    }]
  })
});

2. API Key Authentication

For server-to-server integrations and external applications.

const response = await fetch('https://api.waymakerone.com/v1/coordinate', {
  method: 'POST',
  headers: {
    'apikey': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    messages: [{
      role: 'user',
      content: 'Analyze our customer journey for e-commerce'
    }]
  })
});

Authentication Flow

For Internal Waymaker Apps

  1. Obtain User Token: Use your app's existing Supabase authentication
  2. Include App Context: Add x-app-context header to identify your application
  3. Make API Calls: Include the user token in the Authorization header
// Example for Waymaker Advisor integration
import { createClient } from '@supabase/supabase-js';

const supabase = createClient(
  process.env.VITE_SUPABASE_URL!,
  process.env.VITE_SUPABASE_ANON_KEY!
);

const { data: { session } } = await supabase.auth.getSession();

if (session?.access_token) {
  const apiResponse = await fetch('https://api.waymakerone.com/v1/coordinate', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${session.access_token}`,
      'Content-Type': 'application/json',
      'x-app-context': 'advisor'
    },
    body: JSON.stringify(request)
  });
}

For External Applications

  1. Get API Key: Register at api.waymakerone.com/register
  2. Choose Tier: Select appropriate usage tier (see Rate Limiting)
  3. Secure Storage: Store API key securely (never in client-side code)
  4. Make Requests: Include API key in requests
import requests

headers = {
    'apikey': 'your-api-key',
    'Content-Type': 'application/json'
}

data = {
    'messages': [{
        'role': 'user',
        'content': 'Help me analyze our business model'
    }],
    'userContext': {
        'industry': 'technology',
        'businessStage': 'growth'
    }
}

response = requests.post(
    'https://api.waymakerone.com/v1/coordinate',
    headers=headers,
    json=data
)

Request Headers

Required Headers

HeaderDescriptionExample
Authorization or apikeyAuthentication credentialsBearer <token> or API key
Content-TypeRequest content typeapplication/json

Optional Headers

HeaderDescriptionExample
x-app-contextApplication identifieradvisor, commander, external
x-client-infoClient informationwaymaker-js-sdk/1.0.0

Error Responses

401 Unauthorized

{
  "error": "unauthorized",
  "message": "Invalid authentication credentials",
  "code": "AUTH_INVALID_TOKEN"
}

403 Forbidden

{
  "error": "forbidden",
  "message": "Insufficient permissions for this operation",
  "code": "AUTH_INSUFFICIENT_PERMISSIONS"
}

429 Rate Limited

{
  "error": "rate_limited",
  "message": "Rate limit exceeded for your tier",
  "code": "RATE_LIMIT_EXCEEDED",
  "resetTime": "2025-07-12T15:30:00Z"
}

Security Best Practices

API Key Management

  1. Never expose API keys in client-side code or public repositories
  2. Rotate keys regularly for enhanced security
  3. Use environment variables for key storage
  4. Implement proper error handling for authentication failures

JWT Token Handling

  1. Validate tokens before making API calls
  2. Handle token expiration with refresh logic
  3. Use secure storage for tokens in client applications
  4. Include app context for proper routing and analytics

Rate Limiting

  1. Monitor usage against your tier limits
  2. Implement exponential backoff for rate-limited requests
  3. Cache responses when appropriate to reduce API calls
  4. Consider upgrading tiers for higher usage needs

Development vs Production

Development Mode

  • Uses Supabase anonymous keys for testing
  • Relaxed rate limiting for development
  • Additional debugging headers available

Production Mode

  • Requires valid authentication tokens
  • Full rate limiting enforcement
  • Enhanced security validation

Migration Guide

From Direct Edge Functions

If you're currently using Waymaker edge functions directly:

// OLD: Direct edge function call
const response = await supabase.functions.invoke('one-framework', {
  body: { messages: [...] }
});

// NEW: Waymaker One API
const response = await fetch('https://api.waymakerone.com/v1/coordinate', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${session.access_token}`,
    'Content-Type': 'application/json',
    'x-app-context': 'your-app'
  },
  body: JSON.stringify({
    messages: [...],
    preferences: { forceAgent: 'framework' }
  })
});

Next Steps