Get Transcript History

Retrieve transcription history for an app session.

Endpoint

GET https://api.mentra.glass/api/transcripts/:appSessionId

Headers

X-API-Key: <appApiKey>
X-Package-Name: <packageName>
The code shows this endpoint is incorrectly defined as /api/transcripts/:appSessionId at line 18, but it should be just /transcripts/:appSessionId since the router is mounted at /api.

Parameters

ParameterTypeDescription
appSessionIdstringThe app session identifier (in URL)

Query Parameters

ParameterTypeDescription
durationnumberSeconds to look back from now
startTimestringStart time for transcript range (ISO format)
endTimestringEnd time for transcript range (ISO format)
languagestringLanguage code (e.g., ‘en-US’, ‘fr-FR’), defaults to ‘en-US’
You must provide either duration OR startTime/endTime parameters.

Response

Success (200):
{
  "language": "en-US",
  "segments": [
    {
      "speakerId": "speaker-1",
      "resultId": "1705748400000-abc123",
      "text": "Hello, how are you today?",
      "timestamp": "2024-01-20T10:00:00.000Z",
      "isFinal": true
    },
    {
      "speakerId": "speaker-1",
      "resultId": "1705748403000-def456",
      "text": "I'm doing great, thanks!",
      "timestamp": "2024-01-20T10:00:03.000Z",
      "isFinal": true
    }
  ]
}
Error (400):
{
  "error": "duration, startTime, or endTime is required"
}
Error (404):
{
  "error": "Session not found"
}
Error (500):
{
  "error": "Error fetching transcripts"
}

Implementation

  • File: packages/cloud/src/routes/transcripts.routes.ts:18-70
  • Service: Uses TranscriptionManager.getTranscriptHistory()
  • Session: Extracts user session ID from app session ID by splitting on ’-‘

Time Range Options

  1. Duration-based (most common):
    GET /api/transcripts/session-123?duration=300&language=en-US
    
    Returns last 5 minutes (300 seconds) of transcripts
  2. Time range:
    GET /api/transcripts/session-123?startTime=2024-01-20T10:00:00Z&endTime=2024-01-20T10:30:00Z
    
    Returns transcripts within specific time range

Transcript Segment Structure

Each segment is a TranscriptSegment object containing:
  • speakerId: Optional speaker identifier
  • resultId: Unique identifier for this transcript segment
  • text: The transcribed text
  • timestamp: ISO timestamp when the segment was created
  • isFinal: Whether this is a final or interim result

Language Support

The system supports multiple languages for transcription. Common language codes include:
  • en-US - English (US) - default
  • es-ES - Spanish (Spain)
  • fr-FR - French (France)
  • de-DE - German (Germany)
  • it-IT - Italian (Italy)
  • pt-BR - Portuguese (Brazil)
  • ja-JP - Japanese (Japan)
  • ko-KR - Korean (Korea)
  • zh-CN - Chinese (Simplified)

Session ID Format

The appSessionId parameter follows the format: {userSessionId}-{appIdentifier} For example: session123-com.example.app The endpoint extracts the user session ID by splitting on the first hyphen.

Error Codes

CodeDescription
400Missing required parameters (duration, startTime, or endTime)
404Session not found
500Internal server error

Notes

  • Transcripts are stored in memory per user session
  • Historical data availability depends on session duration
  • Language filtering returns only transcripts in the specified language
  • Apps should authenticate using API key headers (though validation is not shown in the current implementation)
  • Console logs are present for debugging (lines 26, 59)