GET /api/threads/{id}
Retrieve a single thread by ID
GET
Authentication
Conditional (Line 116):[AllowAnonymous]
Public sharing enabled: Authentication optional for public/unlisted threads
Private threads: Authentication required
JWT Claims Extraction (Lines 138-142):
Path Parameters
Thread UUIDFormat: Valid GUIDValidation: Route constraint
:guid (Line 115)Response
UUID identifier
Owner UUID
Thread title
"private", "public", or "unlisted"ISO8601 UTC timestamp
ISO8601 UTC timestamp
Authorization Logic
Feature Flag Check (Line 134):PUBLIC_SHARING Feature Flag States
| Flag | Visibility | Auth | Access |
|---|---|---|---|
| ON | public | No | ✅ Allowed (Line 150-154) |
| ON | unlisted | No | ✅ Allowed (Line 150-154) |
| ON | private | No | ❌ 401 (Line 158-166) |
| ON | private | Yes (owner) | ✅ Allowed (Line 179) |
| ON | private | Yes (other) | ❌ 403 (Line 169-177) |
| OFF | public | No | ❌ 401 (Line 158-166) |
| OFF | public | Yes (owner) | ✅ Allowed (Line 179) |
| OFF | public | Yes (other) | ❌ 403 (Line 169-177) |
| OFF | unlisted | No | ❌ 401 |
| OFF | private | Yes (owner) | ✅ Allowed |
Side Effects
Database Reads (Lines 121, 134):- SELECT from
threadstable WHEREthread_id = {id} - SELECT from
system_settingstable WHEREkey = 'public_sharing'
Permissions
Who Can Read:- Public threads (when
public_sharing = true): Anyone - Unlisted threads (when
public_sharing = true): Anyone with the link - Private threads: Owner only
- Any visibility (when
public_sharing = false): Owner only
private: Requires auth + ownershippublic: Visible to all when feature enabledunlisted: Visible to all when feature enabled, but not listed in search/discovery
Edge Cases
- Thread doesn’t exist: 404 (Lines 123-131)
- Invalid GUID format: 400 (route constraint, not in controller code)
- Deleted thread: 404 (service returns null)
- Feature flag missing: Treated as
false(default behavior assumed) - User ID claim missing for public thread: Allowed (auth optional, Lines 137-142)
- User ID claim present but thread private: Ownership check applies (Line 169)
Error Conditions
| Code | HTTP | Cause | Controller Line |
|---|---|---|---|
NOT_FOUND | 404 | Thread doesn’t exist | 123-131 |
UNAUTHORIZED | 401 | Auth required but missing | 158-166 |
FORBIDDEN | 403 | Private thread, wrong user | 169-177 |
THREAD_ERROR | 500 | Service exception | 181-189 |
Behavioral Guarantees
Visibility Check Order:- Thread existence (404 if not found)
- Feature flag + visibility (public access allowed here)
- Authentication (401 if required but missing)
- Ownership (403 if private + wrong owner)
public_sharing setting controls anonymous access
Security Implications
Public Exposure Risk: Whenpublic_sharing = true:
- Public threads visible without authentication
- Unlisted threads accessible via direct link (URL guessing possible)
- No rate limiting documented