GET /api/threads
List user’s conversation threads
GET
Authentication
Required: JWT Bearer token JWT Claims Extraction (Lines 39-43):Query Parameters
Maximum threads to returnValidation: None (controller accepts any integer)Default: 20 (Line 34)Range: Not enforced by API contract (database-dependent)
Response
Array of thread objects
Authorization
Ownership Filter (Line 50):- Returns ONLY threads owned by authenticated user
- userId extracted from JWT claims
- No visibility filtering (returns all user’s threads regardless of visibility)
- User sees all their own threads (
private,public,unlisted) - User NEVER sees threads owned by others
Side Effects
Database Reads (Line 50):- SELECT from
threadstable WHEREuser_id = userId - Ordered by creation date (descending, assumed from service)
Permissions
Who Can Read:- Authenticated user (their own threads only)
- Unauthenticated users
- Other authenticated users (cross-user access forbidden)
Edge Cases
- Missing user ID claim: 401 error (Lines 45-48)
- Zero threads: Returns
{"items": []}(empty array) - Limit = 0: Behavior not enforced by server contract (service-dependent)
- Limit < 0: Behavior not enforced by server contract (service-dependent)
- Limit > database max: Service may cap internally (not documented)
Error Conditions
| Code | HTTP | Cause | Controller Line |
|---|---|---|---|
| N/A | 401 | JWT missing or invalid | Middleware |
| N/A | 401 | User ID claim missing/invalid GUID | 45-48 |
THREADS_ERROR | 500 | Service exception | 54-62 |
- All service exceptions return 500
- Error message exposed to client
Pagination Behavior
Current Implementation: Simple limit-based No Cursor/Offset: Controller does not support pagination beyond limit Ordering: Not specified by API contract (service-defined) Server Contract: Returns firstlimit threads (ordering implementation-defined)
Performance Characteristics
Database Query: Single SELECT with WHERE clause Index Requirements:threads.user_id should be indexed for performance
Response Size: Proportional to limit value (uncapped by controller)