Session Sharing API
Canonical reference: docs/api-reference.md (generated endpoint directory) — this page is a task-oriented summary.
Create shareable links to exported agent sessions. A share stores serialized session data under a share_id; anyone with the share id can view the public endpoint.
Overview
Session sharing generates a unique share_id for the posted session data. Shares expire after an optional TTL (defaults to the server’s retention). The share data is stored in Mnesia.
Capability-token model: the share_id IS the capability. The public view endpoint is unauthenticated BY DESIGN — possessing the unguessable id (256-bit random) is the authorization; there is no separate ACL. The API never emits expires_at — expiry is internal state, so derive any client-side expiry from the ttl_days you sent.
TTL clamp: ttl_days is clamped server-side to min(ttl_days, 365) — a larger request still succeeds but lives at most one year (loud server warning on clamp).
Quota: creates are bounded per user (share_quota_per_user, default 100 live shares). At the quota the create answers 429 with code share_quota_exceeded and a retry-after: 3600 header (the hourly cleanup cadence frees slots).
Authentication
Create and delete operations require Authorization: Bearer <token>. The public view endpoint (/api/v1/shares/:share_id) does not require authentication — by design (capability model above); it is per-IP rate limited and every read is logged (share id + peer IP).
Endpoints
Create Share
POST /api/v1/sessions
Export session data into a new share. Auth required.
Request Body:
{
"session_data": { },
"format": "json",
"ttl_days": 7
}
session_data is required; format and ttl_days are optional.
Response: 201
{
"share_id": "shr-xyz789"
}
url is only included when the operator has configured base_url (sys.config or SOL_BASE_URL); otherwise only share_id is returned and the client constructs the URL. There is no expires_at field (capability-model note above).
Get Share (authenticated)
GET /api/v1/sessions/:share_id
Returns the stored share data. Answers 404 for an expired share (same
as an unknown id —, ).
{
"data": { },
"format": "json",
"created_at": 1745600000
}
View Shared Session (public)
GET /api/v1/shares/:share_id
Public endpoint — no authentication required. Returns the same shape as the authenticated get:
{
"data": { },
"format": "json",
"created_at": 1745600000
}
404 if the share expired or was never created — expired and unknown ids
are indistinguishable on the public surface.
Delete Share
DELETE /api/v1/sessions/:share_id
Removes a share. Only the share owner or an admin can delete it.
{
"deleted": "shr-xyz789"
}
403 if not the owner/admin; 404 if not found — expired shares are
indistinguishable from never-existed on EVERY share leg since
.
Error Codes:
| Code | Description |
|---|---|
| 401 | Authentication required for create/delete |
| 403 | Not the share owner |
| 404 | Share not found (expired and never-existed are indistinguishable) |
| 429 | Per-user share quota exhausted (share_quota_exceeded, retry-after: 3600) |
| 429 | Public read rate limited per IP (rate_limited) |
Examples:
curl -X POST http://127.0.0.1:21434/api/v1/sessions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"session_data": {"messages": []}, "ttl_days": 7}'
curl http://127.0.0.1:21434/api/v1/shares/shr-xyz789
curl -X DELETE http://127.0.0.1:21434/api/v1/sessions/shr-xyz789 \
-H "Authorization: Bearer $TOKEN"