Set DateTime

Update the user’s datetime setting and notify subscribed apps.

Endpoint

POST https://api.mentra.glass/api/user-data/set-datetime

Request Body

{
  "coreToken": "eyJhbGciOiJIUzI1NiIs...",
  "datetime": "2024-01-20T10:30:00Z"
}
The datetime must be in ISO 8601 format.

Response

Success (200):
{
  "success": true,
  "userId": "user@example.com",
  "datetime": "2024-01-20T10:30:00Z"
}
Error (400):
{
  "error": "Missing or invalid coreToken or datetime (must be ISO string)"
}
Error (401):
{
  "error": "Invalid core token - missing user email" // or "Invalid or expired core token"
}
Error (404):
{
  "error": "User session not found"
}

Implementation

  • File: packages/cloud/src/routes/user-data.routes.ts:17-70
  • Authentication: JWT token validation using AUGMENTOS_AUTH_JWT_SECRET
  • Side Effects: Sends CUSTOM_MESSAGE to all apps subscribed to custom messages

Custom Message Format

Apps subscribed to CUSTOM_MESSAGE stream will receive:
{
  "type": "CUSTOM_MESSAGE",
  "action": "update_datetime",
  "payload": {
    "datetime": "2024-01-20T10:30:00Z",
    "section": "topLeft"
  },
  "timestamp": "2024-01-20T10:30:00.000Z"
}

Usage Notes

  • The coreToken is passed in the request body rather than as a header
  • This endpoint stores the datetime in the user’s session as userDatetime
  • Only apps that have subscribed to the CUSTOM_MESSAGE stream type will receive the update
  • The datetime is used for display purposes on the glasses

Error Codes

CodeDescription
400Missing or invalid parameters
401Invalid or expired core token
404User session not found - user must have active WebSocket connection