Get Transcript History
Retrieve transcription history for an app session.
Endpoint
Production
Development
Local
GET https://api.mentra.glass/api/transcripts/:appSessionId
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
Parameter Type Description appSessionIdstring The app session identifier (in URL)
Query Parameters
Parameter Type Description durationnumber Seconds to look back from now startTimestring Start time for transcript range (ISO format) endTimestring End time for transcript range (ISO format) languagestring Language 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
Duration-based (most common):
GET /api/transcripts/session-123?duration=300&language=en-US
Returns last 5 minutes (300 seconds) of transcripts
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)
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
Code Description 400 Missing required parameters (duration, startTime, or endTime) 404 Session not found 500 Internal 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)