AlphaSaveAlphaSave
Sign in
Get started

API Documentation

Integrate AlphaSave into your applications and workflows. Transform digital footprints programmatically.

Base URL

https://api.alphasavegroup.com

All API endpoints are prefixed with /api/gateway

Authentication

Most endpoints require authentication using a Bearer token. Include the token in the Authorization header:

Authorization: Bearer YOUR_ACCESS_TOKEN

Get your access token by logging in via POST /api/auth/login or using Google SSO.

Authentication

POST/api/auth/register

Register a new user account

Request Body:

{
  "email": "user@example.com",
  "password": "securepassword",
  "access_plan": 1  // Optional: 1=Insight Access, 2=Collaboration & Tools, 3=Platform Partner
}

Response (201):

{
  "id": "uuid",
  "email": "user@example.com",
  "partner_roles": ["platform_member"],
  "access_plan": 1
}
POST/api/auth/login

Authenticate with email and password

Request Body:

{
  "email": "user@example.com",
  "password": "securepassword"
}

Response (200):

{
  "access_token": "jwt_token",
  "refresh_token": "refresh_token",
  "token_type": "Bearer",
  "expires_in": 3600,
  "user": {
    "id": "uuid",
    "email": "user@example.com",
    "partner_roles": ["platform_member"],
    "access_plan": 1
  }
}
POST/api/auth/google

Authenticate using Google SSO (validates Google ID token)

Request Body:

{
  "id_token": "google_id_token"
}
POST/api/auth/refresh

Refresh an access token using a refresh token

Request Body:

{
  "token": "refresh_token"
}
POST/api/auth/verify

Validate an access token

User Management

GET/api/user/profileAuth Required

Get the authenticated user's profile

Response (200):

{
  "id": "uuid",
  "email": "user@example.com",
  "name": "User Name",
  "partner_roles": ["platform_member"],
  "access_plan": 1,
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}
PUT/api/user/profileAuth Required

Update the authenticated user's profile

Digital Assets

GET/api/user/{userId}/digital-assetsAuth Required

Get all digital assets for a user

Response (200):

[
  {
    "id": "uuid",
    "user_id": "uuid",
    "asset_type": "website",
    "platform_name": "WordPress",
    "url": "https://example.com",
    "monthly_cost": 50.00,
    "monthly_revenue": 200.00,
    "is_profitable": true,
    "notes": "Main website",
    "created_at": "2024-01-01T00:00:00Z"
  }
]
POST/api/user/{userId}/digital-assetsAuth Required

Create a new digital asset

Request Body:

{
  "asset_type": "website",
  "platform_name": "WordPress",
  "url": "https://example.com",
  "monthly_cost": 50.00,
  "monthly_revenue": 200.00,
  "notes": "Main website"
}

Response (201):

{
  "id": "uuid",
  "user_id": "uuid",
  "asset_type": "website",
  "platform_name": "WordPress",
  "url": "https://example.com",
  "monthly_cost": 50.00,
  "monthly_revenue": 200.00,
  "is_profitable": true,
  "notes": "Main website",
  "created_at": "2024-01-01T00:00:00Z"
}

Problem Reports

POST/api/user/{userId}/problem-reportsAuth Required

Report a problem with a digital asset

Request Body:

{
  "problem_category": "Platform Not Profitable",
  "problem_description": "Social media account costs $100/month but generates $0 revenue",
  "affected_platforms": ["instagram", "facebook"],
  "urgency": "high"
}
GET/api/user/problem-reports/analyticsAuth Required

Get analytics on reported problems

Response (200):

{
  "total_reports": 150,
  "problems_by_category": {
    "Platform Not Profitable": 45,
    "Social Media Not Generating Income": 30
  },
  "problems_by_urgency": {
    "high": 20,
    "medium": 50,
    "low": 80
  }
}

Admin

GET/api/admin/feature-flagsAdmin Only

Get all feature flags

PUT/api/admin/feature-flags/{flagId}Admin Only

Update a feature flag

Error Handling

The API uses standard HTTP status codes. Error responses include a message:

400 Bad Request

{
  "error": "Invalid request parameters"
}

401 Unauthorized

{
  "error": "Invalid or expired token"
}

403 Forbidden

{
  "error": "Insufficient permissions"
}

404 Not Found

{
  "error": "Resource not found"
}

500 Internal Server Error

{
  "error": "Internal server error"
}

Code Examples

JavaScript/TypeScript

// Login
const response = await fetch('https://api.alphasavegroup.com/api/auth/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    email: 'user@example.com',
    password: 'password'
  })
});

const { access_token } = await response.json();

// Get digital assets
const assets = await fetch(
  'https://api.alphasavegroup.com/api/user/USER_ID/digital-assets',
  {
    headers: {
      'Authorization': `Bearer ${access_token}`
    }
  }
);

cURL

# Login
curl -X POST https://api.alphasavegroup.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"user@example.com","password":"password"}'

# Get digital assets
curl -X GET \
  https://api.alphasavegroup.com/api/user/USER_ID/digital-assets \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Rate Limiting

API requests are rate-limited to ensure fair usage. Rate limits are enforced per IP address and per user:

  • Authentication endpoints: 10 requests per minute
  • General endpoints: 100 requests per minute
  • Admin endpoints: 50 requests per minute

Rate limit headers are included in responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

Additional Resources