Mobile API Documentation

🚀 Quick Start

Base URL: /api/mobile/v1

Authentication
JWT Bearer Token
Content-Type
application/json
Response Size
<50KB typical

🔐 Authentication

1. Login

POST /auth/login
Request Body:
{
  "email": "user@example.com",
  "password": "secure_password",
  "device_id": "uuid-device-identifier"
}
Response:
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "bearer",
  "expires_in": 3600,
  "user": {
    "id": 123,
    "email": "user@example.com"
  }
}

2. Use Access Token

Include the access token in the Authorization header for all protected endpoints:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

3. Refresh Token

Access tokens expire after 1 hour. Use the refresh token to get a new access token:

POST /auth/refresh
{
  "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

📋 API Endpoints

GET

/health

Check API availability and response times. No authentication required.

Response:
{
  "status": "healthy",
  "timestamp": "2025-11-06T12:00:00Z",
  "version": "1.0.0",
  "response_time_ms": 12
}
GET

/mti

🔒 Auth Required

Get current Money Tide Index, regime classification, and market signals.

Query Parameters:
?fields=mti,sni,regime - Filter response fields
?format=compact - Minimal response (<5KB)
Response:
{
  "mti": 1.23,
  "sni": 0.85,
  "regime": "Tailwind",
  "velocity": 0.15,
  "acceleration": 0.03,
  "confidence": 0.87,
  "last_updated": "2025-11-06T12:00:00Z",
  "cache_expires": 300
}
GET

/allocation

🔒 Auth Required

Get recommended budget allocation across 8 marketing channels based on current MTI.

Query Parameters:
?budget=100000 - Total budget (default: $100,000)
?risk_posture=balanced - conservative/balanced/aggressive
Response:
{
  "regime": "Tailwind",
  "total_budget": 100000,
  "allocation": {
    "paid_search": 18500,
    "paid_social": 16200,
    "display": 12300,
    "video": 10800,
    "seo": 15400,
    "email": 11600,
    "content": 9700,
    "events": 5500
  },
  "confidence": 0.87
}
GET

/dashboard

🔒 Auth Required

Get complete dashboard data (MTI + allocation + history) in a single optimized response.

💡 Performance Tip
Use ?format=compact to reduce response size by 60% for mobile networks
GET

/history

🔒 Auth Required

Get historical MTI/SNI data for charting. Returns up to 90 days of daily data points.

Query Parameters:
?days=30 - Number of days (default: 30, max: 90)
?granularity=daily - daily/weekly/monthly
POST

/devices/register

🔒 Auth Required

Register device for push notifications and offline sync.

Request Body:
{
  "device_token": "fcm-or-apns-token",
  "platform": "ios",  // "ios" or "android"
  "device_info": {
    "model": "iPhone 15 Pro",
    "os_version": "17.1",
    "app_version": "1.2.0"
  }
}
POST

/sync

🔒 Auth Required

Delta sync for offline-first apps. Only returns data changed since last sync timestamp.

Request Body:
{
  "last_sync": "2025-11-06T10:00:00Z",
  "resources": ["mti", "allocations"]
}
✅ Bandwidth Optimized
Only changed data returned. Typical sync: <2KB vs full fetch: 50KB

⚡ Rate Limiting

Rate limits are enforced per device and included in response headers:

PER MINUTE
60
PER HOUR
1000
PER DAY
10000
Response Headers:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1699275600

⚠️ Error Codes

401
Unauthorized
Invalid or expired JWT token
403
Forbidden
Insufficient permissions for resource
429
Too Many Requests
Rate limit exceeded. Check X-RateLimit-Reset header
500
Internal Server Error
Unexpected server error. Contact support

BRRRBOT

AI Budget Assistant

👋 Hey there! I'm BRRRBOT, your AI budget allocation assistant.

I can help you:

  • Understand your MTI and market regime
  • Explain allocation recommendations
  • Navigate features and settings
  • Optimize your marketing budget

What would you like to know?

Just now