Skip to main content

Overview

MentraOS Cloud provides both WebSocket and REST APIs:

WebSocket APIs

Real-time bidirectional communication for glasses and apps

REST APIs

HTTP endpoints for authentication, management, and configuration

Base URLs

https://api.mentra.glass  # REST API
wss://api.mentra.glass  # WebSocket

Authentication

WebSocket Authentication

WebSocket connections authenticate using JWT tokens in the Authorization header:
const ws = new WebSocket('wss://cloud.mentraos.com/glasses-ws', {
  headers: {
    'Authorization': `Bearer ${jwtToken}`
  }
});

REST API Authentication

REST endpoints use Bearer token authentication:
curl -X GET https://api.mentraos.com/user/profile \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Rate Limits

API rate limits apply per user:
  • REST API: 100 requests per minute
  • WebSocket messages: 50 per second
  • Display updates: 1 per 200ms

Response Format

All REST API responses follow this format:
{
  "success": true,
  "data": {
    // Response data
  },
  "error": null
}
Error responses:
{
  "success": false,
  "data": null,
  "error": {
    "code": "INVALID_TOKEN",
    "message": "Authentication token is invalid"
  }
}

WebSocket Message Format

All WebSocket messages are JSON with a type field:
{
  "type": "MESSAGE_TYPE",
  "data": {
    // Message-specific data
  }
}

Available Endpoints

WebSocket Endpoints

Glasses Connection

/glasses-ws - Mobile app connections

App Connection

/app-ws - Third-party app connections

REST Endpoints

Authentication

Login, token refresh, logout

User Management

Profile, settings, preferences

App Management

Install, uninstall, configure apps

SDK Integration

The MentraOS SDK handles all API communication for you:
import { AppServer } from '@mentraos/sdk';

// SDK manages all API calls internally
const server = new AppServer({
  packageName: 'com.example.app',
  apiKey: process.env.MENTRAOS_API_KEY
});

Need Help?