Session sharing
Share a live browser session through editor and viewer links, and embed it in other apps.
Aperture exposes separate editor and viewer capabilities for one browser session. Editor capabilities can request the session-wide input lease and use browser controls. Editors can also start, stop, and download recordings. Editors can also manage the session's files. Viewer capabilities can watch the session but cannot send browser input, record, or access files. Neither capability grants tenant access, DevTools, or session lifecycle operations.
Share links
Owner-facing session responses expose independently rotatable editor and viewer capabilities under collaboration.
The web interface copies links in this form:
https://aperture.example/share/#token=ape_<session-id>_<secret>
https://aperture.example/share/#token=apv_<session-id>_<secret>The share route moves the token into tab-scoped session storage and removes it from the address bar. It uses the session ID embedded in the token to connect to the existing session routes. Opening a share link never adopts or falls back to account credentials already stored in the browser.
Rotating one collaboration capability disconnects session clients using that role without affecting the owner session token or the other collaboration role. A resume secret cannot bypass the rotated capability.
Embedding
Other web apps can show a shared session with the npm packages built from this repository:
@aperture-browser/session-elementregisters<aperture-session>, a custom element that renders the session in its own shadow root, so neither page's styles reach the other;@aperture-browser/session-reactexportsApertureSessionfor React apps, styled by@aperture-browser/session-react/styles.css.
<script
type="module"
src="https://cdn.jsdelivr.net/npm/@aperture-browser/session-element/dist/aperture-session.js"
></script>
<aperture-session
base-url="https://aperture.example"
token="apv_<session-id>_<secret>"
style="height: 600px"
></aperture-session>Both take an editor or viewer token and grant exactly what the share link grants. Parts of the UI can be turned off (hide="tabs menus", or features={{ tabs: false, menus: false }}). For your own controls, the headless <aperture-session-view> and @aperture-browser/session-react/headless render only the browser and expose its tabs and navigation through an API.
For direct cross-origin connections, the embedding page must be listed in embed_allowed_origins:
embed_allowed_origins: [https://app.example.com, http://localhost:3000]Aperture then answers CORS requests from those origins on the session routes share tokens use, and accepts live-session WebSockets from them. * allows any origin. Requests never carry cookies, so an embedding page only gets what the token it holds grants.
For applications that own their users' authentication, use a same-origin backend relay. The browser authenticates to your app, which supplies the Aperture capability upstream. This requires no embed_allowed_origins entry. WebRTC media and data channels remain direct; status and both WebSockets pass through your backend.
Capability authentication
Session HTTP routes accept the token as a bearer credential:
Authorization: Bearer ape_<session-id>_<secret>
Authorization: Bearer apv_<session-id>_<secret>WebSocket routes use the existing bearer subprotocol:
authorization.bearer.ape_<session-id>_<secret>
authorization.bearer.apv_<session-id>_<secret>No tenant header is required. The token's embedded session ID must match the routed /sessions/:sessionId/... path. Suspended sessions wake through the normal live-session activity path. Editor and viewer capabilities never authorize raw CDP. Owner DevTools uses the owner session token separately.
Presence and follow
Each workbench connection appears in the participant list with a persistent local display name and Gravatar identicon. Account-backed owners use their account or token display name when it is available; shared links use a randomly assigned anonymous identity.
Selecting another participant starts following them. The follower adopts that participant's selected browser target and highlights their cursor. Follow relationships may form chains, but the live session rejects any update that would create a cycle. Presence, cursors, and follow relationships disappear when the session ends and are not written into the browser or recordings.
Shared drawing
Owners, editors, and viewers can turn on drawing mode and mark the current target. Drawing mode captures pointer gestures for the overlay instead of sending them to the browser. Each stroke uses target-relative coordinates, so it stays aligned when participants use different viewer sizes.
The live session relays strokes to connected participants but does not store them. A stroke fades out seven seconds after its last point. Shared drawing does not change page content and does not appear in browser recordings.
Presentation modes
The workbench tries WebRTC first and falls back to JPEG frames over the live-session WebSocket when WebRTC is unavailable. Each session client can explicitly choose JPEG or switch back to WebRTC from the Stream menu. An explicit JPEG choice disables background WebRTC retries for that client until it selects WebRTC again.
The server advertises only encoder profiles supported by its media setup. These may include VP8, hardware H.264, hardware H.264 High, and software H.264. Owners and editors can select an advertised profile, use the low, balanced, or high preset, or set a custom frame rate and maximum bitrate. The encoder profile and quality are shared across WebRTC clients, so a change is broadcast to the live session. Viewers can choose JPEG or WebRTC for their own presentation but cannot change the shared encoder settings.
Remote cursor visibility is also shared presentation state. Owners and editors may change it; public HTTP and MCP cursor controls update the same state and broadcast the result to connected clients.
Changing to an incompatible profile first hands the requesting client to WebSocket, updates the shared encoder, and then negotiates a new WebRTC transport. Other WebRTC clients use the same fallback and recovery path. Both transports carry the same live-session protocol; JPEG delivery does not restore a frontend CDP connection.
Files
DELETE /api/sessions/{sessionId} permanently removes a session's browser profile, files, cache, and operational artifacts before it succeeds. It returns terminal expired metadata, not a reopenable session. To stop the browser while keeping its state and files, use POST /api/sessions/{sessionId}/suspend instead. Cleanup failures remain immediately eligible for garbage collection; retrying DELETE is safe.
Each session keeps its files below one root, and every file is named by its path relative to that root: downloads/ for browser downloads, recordings/ for recordings, uploads/ for uploaded files, and outputs/ for Playwright MCP output. Listings, signed download URLs, upload responses, and browser tools all use these relative paths. Inside the browser sandbox the root is mounted at /session/files, and each listed file carries that sandboxPath for CDP DOM.setFileInputFiles; host paths are never exposed. Session files are not part of promoted snapshots.
GET /api/sessions/<session-id>/files
POST /api/sessions/<session-id>/files?directory=uploads
POST /api/sessions/<session-id>/files/directories
DELETE /api/sessions/<session-id>/files?relativePath=<path>[&recursive=true]
POST /api/sessions/<session-id>/files/move
POST /api/sessions/<session-id>/files/download-url
POST /sessions/<session-id>/uploadsThe /api routes work in every retained state, including suspended and stopped sessions. Uploads use multipart/form-data and may contain multiple files. Names are sanitized and collisions receive a numeric suffix instead of overwriting an existing file; the response lists the stored files with the same fields as the listing. The listing includes directories, so empty ones show up; they are created, moved, and deleted explicitly, and a non-empty directory is deleted only with recursive=true. Moves never overwrite. The four top-level directories cannot be deleted or moved, and nothing still being written, such as an in-progress download or recording, can be moved or deleted. Signed download URLs default to attachment disposition; "disposition": "inline" gives a URL for previews such as an <img> source. Downloads carry the detected content type, support HTTP byte ranges, and are served with Content-Security-Policy: sandbox when they could run scripts, such as HTML or SVG.
POST /sessions/<session-id>/uploads reaches the running session itself and stores files in uploads/; it also accepts the owner session token and an editor capability.
The MCP browser tools accept any session file relative path, of any size, so a download or recording can go straight into a page. browser_set_input_files sets files on a file input given by snapshot reference or selector, including hidden inputs, and fails with the input cleared when the page cannot read a file. browser_file_upload fills a file chooser a click has opened.
Each upload request accepts at most 100 files, a directory may hold at most 1,000 files, and a session at most 10,000 files and directories. At most three uploads per session stream at once.
Listing and download URLs need API credentials with sessions:read; uploads, directory creation, deletes, and moves need sessions:write. The owner session token and an editor capability may use the same /api file routes for their own session, as a bearer token and without a tenant header, while the session runs or is suspended. Viewer capabilities cannot access files.
Thumbnails
Every session can serve a JPEG thumbnail, at most 640 pixels wide, of the tab most recently shown to a live-session client, and of each top-level tab. Each tab renders in its own compositor window, so background tabs are captured live too. Repeated requests within two seconds share one capture. Thumbnail requests never wake a suspended session and do not count as session activity.
GET /api/sessions/<session-id>/thumbnail
GET /api/sessions/<session-id>/targets/<target-id>/thumbnail
GET /sessions/<session-id>/thumbnail
GET /sessions/<session-id>/targets/<target-id>/thumbnailThe /api routes need sessions:read and accept API tokens or a signed-in browser session. The /sessions routes accept a signed token query parameter, the owner session token, or an editor or viewer capability as a bearer token.
GET /api/sessions and GET /api/sessions/<session-id> return signed URLs under thumbnail for image elements: url for the session and targetUrlTemplate, whose literal {targetId} placeholder takes a tab ID. They expire after signed_file_url_ttl (15 minutes by default); every response carries fresh ones. thumbnail is omitted when the session has nothing to show.
When a session suspends, Aperture saves the thumbnails of the session and its tabs, and serves them until the session runs again. Tab IDs change when the browser restarts. Set thumbnails_persist_on_suspend = false (APERTURE_THUMBNAILS_PERSIST_ON_SUSPEND=false) to skip saving the images; suspended sessions then have no thumbnail, but their page list is still saved for passive browser status. Responses carry Last-Modified, so clients can revalidate with If-Modified-Since.
Passive browser status
GET /sessions/<session-id>/browser/status accepts account credentials with sessions:read, the owner session token, or an editor or viewer capability. Unlike the live-session WebSockets, reading status never wakes the browser, mounts its profile, updates activity or retention timestamps, or prevents idle suspension.
A running session returns source: "live"; a suspended session returns source: "persisted" with the page metadata and thumbnail availability saved as one suspension generation. capturedAt identifies that generation, and representativeTargetId identifies the page used for the session thumbnail. Pages remain in the manifest even when their thumbnail capture failed or thumbnails are not saved. Page targetIds are the IDs the per-tab thumbnail routes take.
Older suspended sessions have no page manifest. Saving may also fail within its best-effort suspension budget. Those cases return source: "unavailable", an empty page list, and no capturedAt rather than waking the browser or presenting an older generation as new. Target IDs in persisted data are historical references for that generation; Chromium may assign different IDs after resume.
Favicons
Each top-level tab can serve the icon Chromium shows for it. The browser loads the icon through the tab's own network context, so icons of private or signed-in sites work and the site never sees the client. Internal pages such as chrome:// have none. Icons are at most 64 KiB and are PNG, ICO, GIF, JPEG, WebP, or SVG; SVG is served with a Content-Security-Policy that blocks scripts and loads. Favicon requests never wake a suspended session and do not count as session activity.
GET /api/sessions/<session-id>/targets/<target-id>/favicon
GET /sessions/<session-id>/targets/<target-id>/faviconThe routes accept the same credentials as the thumbnail routes. Session reads return a signed favicon.targetUrlTemplate for image elements, with the same lifetime as thumbnail URLs.
Each page in the browser status lists faviconAvailable and faviconVersion, a short content hash. Add v=<faviconVersion> to the favicon URL and the response is cached with Cache-Control: private, max-age=31536000, immutable; a changed icon gets a new version. Without a matching v the response is private, no-cache with the version as its ETag, so clients revalidate with If-None-Match. Suspension saves favicons with the tab thumbnails, and thumbnails_persist_on_suspend = false skips both.
Limits and audit events
The default per-file upload limit is 100 MiB. Before accepting an upload, Aperture measures writable session data under the overlay upper directory, the session files, and the cache. The default admission limit is 1 GiB. The merged overlay and base snapshot are not double-counted. Browser activity can exceed the limit after admission; this is not a filesystem-enforced quota.
The limits are configurable:
session_upload_max_file_bytes = 104857600
session_storage_quota_bytes = 1073741824Successful uploads append a session.file_uploaded event containing the relative path, size, actor kind, and client IP. Changes through the API append session.file_deleted, session.file_moved, session.directory_created, session.directory_deleted, and session.directory_moved events with the paths and client IP. The event never contains the session token or host storage path.