openapi: 3.0.3 info: title: AirCam API description: | Private group media sharing API for the AirCam mobile and web apps. ## Authentication Most endpoints require a bearer token in the `Authorization` header: ``` Authorization: Bearer ``` Two token types are accepted: - **User token** — obtained from `POST /auth/verify` after email sign-in - **Guest token** — obtained from `POST /auth/guest` using a 4-digit album code ## Roles Authenticated users have one of three roles: | Role | Description | |---|---| | `admin` | Full access including member management and invite codes | | `editor` | Can create/update albums and guest codes | | `contributor` | Can upload media and delete only their own uploads | Guests are a separate session type scoped to a single album (view + upload only). ## Interactive Docs In development, interactive Swagger UI is available at `GET /api/docs`. ## Machine-Readable Spec The raw OpenAPI YAML is served at `GET /api/docs/openapi.yaml`. version: 0.1.0 contact: name: AirCam API servers: - url: /api description: Current environment tags: - name: Health description: Server reachability - name: Auth description: Sign-in, session, and device token management - name: Albums description: Album CRUD and cover image - name: Media description: Photo and video records - name: Members description: Group member listing and role management - name: Invites description: Member invite code management (Admin only) - name: Guest Codes description: Temporary 4-digit album access codes - name: Storage description: Presigned upload URLs and private object streaming - name: Activity description: Group activity feed - name: Notification Preferences description: Per-album push notification muting - name: Videos description: Server-side video upload, transcoding, HLS delivery, and frame extraction - name: Search description: AI-powered and keyword search across video captions - name: Admin description: Internal observability endpoints (Admin only) components: securitySchemes: bearerAuth: type: http scheme: bearer description: User session token or guest session token obtained from `/auth/verify` or `/auth/guest` schemas: ErrorEnvelope: type: object required: [error] properties: error: type: string example: Not found HealthStatus: type: object required: [status] properties: status: type: string example: ok # ── Auth ────────────────────────────────────────────────────────────────── MagicLinkRequest: type: object required: [email] properties: email: type: string format: email example: user@example.com inviteCode: type: string nullable: true description: Optional group invite code to associate with the sign-in MagicLinkResponse: type: object required: [sent] properties: sent: type: boolean example: true devCode: type: string nullable: true description: Only populated in non-production environments when email delivery is unavailable VerifyCodeRequest: type: object required: [email, code] properties: email: type: string format: email example: user@example.com code: type: string description: 6-digit sign-in code from the email example: "482910" guestToken: type: string nullable: true description: Pass an existing guest token to upgrade the guest session to a full user account SessionRole: type: string enum: [admin, editor, contributor] UserObject: type: object required: [id, email, name] properties: id: type: string description: Clerk user ID email: type: string format: email name: type: string GroupObject: type: object required: [id, name] properties: id: type: string description: Clerk organization ID name: type: string Session: type: object required: [token, user, group, role] properties: token: type: string description: Bearer token to use on subsequent requests (TTL 60 days) user: $ref: '#/components/schemas/UserObject' group: $ref: '#/components/schemas/GroupObject' role: $ref: '#/components/schemas/SessionRole' MeResponse: type: object required: [user, group, role] properties: user: $ref: '#/components/schemas/UserObject' group: $ref: '#/components/schemas/GroupObject' role: $ref: '#/components/schemas/SessionRole' GuestLoginRequest: type: object required: [code] properties: code: type: string minLength: 4 maxLength: 4 description: 4-digit album guest code example: "7391" GuestSessionResponse: type: object required: [token, albumId, groupId, expiresAt] properties: token: type: string description: Guest bearer token (TTL 4 hours) albumId: type: string format: uuid groupId: type: string format: uuid expiresAt: type: string format: date-time RegisterDeviceTokenRequest: type: object required: [token] properties: token: type: string description: Hex-encoded APNs device token string environment: type: string enum: [sandbox, production] nullable: true description: APNs environment the token was issued for. Defaults to production. DeregisterDeviceTokenRequest: type: object required: [token] properties: token: type: string description: The APNs device token to remove # ── Albums ──────────────────────────────────────────────────────────────── AlbumRulesMediaType: type: string enum: [photo, video, both] AlbumRulesOrientation: type: string enum: [any, portrait, landscape] AlbumRules: type: object required: [mediaType, orientation, maxVideoDuration] properties: mediaType: $ref: '#/components/schemas/AlbumRulesMediaType' orientation: $ref: '#/components/schemas/AlbumRulesOrientation' maxVideoDuration: type: number nullable: true description: Maximum video duration in seconds, or null for no limit Album: type: object required: [id, name, rules, createdAt] properties: id: type: string format: uuid name: type: string rules: $ref: '#/components/schemas/AlbumRules' createdAt: type: string format: date-time coverMediaId: type: string format: uuid nullable: true CreateAlbumRequest: type: object required: [name, rules] properties: name: type: string minLength: 1 example: Summer 2026 rules: $ref: '#/components/schemas/AlbumRules' UpdateAlbumRulesRequest: type: object required: [rules] properties: name: type: string minLength: 1 nullable: true description: When provided, renames the album rules: $ref: '#/components/schemas/AlbumRules' SetAlbumCoverRequest: type: object required: [mediaId] properties: mediaId: type: string format: uuid nullable: true description: ID of a photo in this album to use as cover, or null to clear # ── Media ───────────────────────────────────────────────────────────────── MediaType: type: string enum: [photo, video] MediaStatus: type: string enum: [queued, uploading, synced, failed] Media: type: object required: [id, userId, type, status, url, createdAt] properties: id: type: string format: uuid albumId: type: string format: uuid nullable: true userId: type: string format: uuid type: $ref: '#/components/schemas/MediaType' status: $ref: '#/components/schemas/MediaStatus' url: type: string format: uri description: Authenticated media URL — requires bearer token to fetch createdAt: type: string format: date-time CreateMediaRequest: type: object required: [type, objectPath] properties: albumId: type: string format: uuid nullable: true description: Album to associate the media with. Guests must supply their album's ID. type: $ref: '#/components/schemas/MediaType' objectPath: type: string description: "Path returned from POST /storage/uploads/request-url, e.g. /objects/uploads/" example: /objects/uploads/3f8a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c MoveMediaRequest: type: object required: [albumId] properties: albumId: type: string format: uuid description: ID of the destination album # ── Members ─────────────────────────────────────────────────────────────── MemberRole: type: string enum: [admin, editor, contributor] Member: type: object required: [id, name, email, role] properties: id: type: string description: Clerk user ID name: type: string email: type: string format: email role: $ref: '#/components/schemas/MemberRole' UpdateMemberRoleRequest: type: object required: [role] properties: role: $ref: '#/components/schemas/MemberRole' # ── Invites ─────────────────────────────────────────────────────────────── Invite: type: object required: [code, role, createdAt, expiresAt] properties: code: type: string description: 8-digit numeric invite code role: type: string description: Role granted when the invite is used createdAt: type: string format: date-time expiresAt: type: string format: date-time description: Invite codes expire after 7 days createdBy: type: string format: uuid nullable: true CreateInviteRequest: type: object properties: email: type: string format: email nullable: true description: If provided, sends the invite code to this email address role: $ref: '#/components/schemas/MemberRole' nullable: true description: Defaults to contributor CreateInviteResponse: type: object required: [code, expiresAt] properties: code: type: string description: 8-digit numeric invite code expiresAt: type: string format: date-time sentTo: type: string format: email nullable: true description: Email address the invite was sent to, if delivery succeeded # ── Guest Codes ─────────────────────────────────────────────────────────── GuestCode: type: object required: [code, albumId, createdAt, expiresAt] properties: code: type: string description: 4-digit numeric guest code albumId: type: string format: uuid albumName: type: string nullable: true createdAt: type: string format: date-time expiresAt: type: string format: date-time description: Guest codes expire after 24 hours createdBy: type: string format: uuid nullable: true CreateGuestCodeRequest: type: object required: [albumId] properties: albumId: type: string format: uuid description: Album to which guests using this code will have access CreateGuestCodeResponse: type: object required: [code, expiresAt] properties: code: type: string description: 4-digit numeric guest code (expires in 24 hours) expiresAt: type: string format: date-time # ── Storage ─────────────────────────────────────────────────────────────── UploadUrlRequest: type: object required: [contentType] properties: contentType: type: string minLength: 1 description: MIME type of the file to be uploaded example: image/jpeg UploadUrlResponse: type: object required: [uploadURL, objectPath] properties: uploadURL: type: string format: uri description: Presigned URL — PUT the raw file binary directly to this URL (no auth header) objectPath: type: string description: Server-assigned path — save this and pass it to POST /media # ── Activity ────────────────────────────────────────────────────────────── ActivityEvent: type: object required: [id, action, timestamp] properties: id: type: string format: uuid userId: type: string description: Clerk user ID of the actor nullable: true mediaId: type: string format: uuid nullable: true action: type: string description: Human-readable description of the event example: added a photo to Summer 2026 timestamp: type: string format: date-time # ── Notification Prefs ──────────────────────────────────────────────────── MutedAlbumsResponse: type: object required: [mutedAlbumIds] properties: mutedAlbumIds: type: array items: type: string format: uuid description: IDs of albums for which push notifications are muted # ── Videos ──────────────────────────────────────────────────────────────── VideoRecord: type: object required: [id, filename, status, createdAt] properties: id: type: string description: "Server-assigned video ID, e.g. vid_" filename: type: string description: Original filename supplied at upload time albumId: type: string nullable: true userId: type: string nullable: true status: type: string enum: [pending, processing, indexing, ready, error] description: Processing pipeline stage error: type: string nullable: true description: Error message if status is error durationSec: type: number nullable: true description: Total duration in seconds (available after processing) width: type: integer nullable: true height: type: integer nullable: true createdAt: type: integer description: Unix timestamp (ms) of the upload hlsUrl: type: string nullable: true description: "URL to the HLS master playlist (only set when status = ready)" thumbnailUrl: type: string nullable: true description: "URL to the first extracted frame (set when status = ready or indexing)" VideoFrame: type: object required: [timestampSec, imageUrl] properties: timestampSec: type: number description: Position of the frame within the video caption: type: string nullable: true description: AI-generated caption for this frame imageUrl: type: string description: URL to the JPEG frame image # ── Search ──────────────────────────────────────────────────────────────── SearchMoment: type: object required: [timestampSec] properties: timestampSec: type: number caption: type: string nullable: true score: type: number SearchResult: type: object required: [videoId, filename, bestMoment, hlsUrl] properties: videoId: type: string filename: type: string durationSec: type: number nullable: true bestMoment: type: object required: [timestampSec, imageUrl] properties: timestampSec: type: number caption: type: string nullable: true reason: type: string description: How the match was found (e.g. "keyword match") score: type: number imageUrl: type: string hlsUrl: type: string otherMoments: type: array items: $ref: '#/components/schemas/SearchMoment' description: Other matching moments within the same video (up to 5) # ── Admin ───────────────────────────────────────────────────────────────── NotificationEventCounts: type: object required: [success, failure, pruned] properties: success: type: integer failure: type: integer pruned: type: integer NotificationStats: type: object required: [windowStart, windowEnd, summary, byHour] properties: windowStart: type: string format: date-time description: Start of the 24-hour reporting window windowEnd: type: string format: date-time summary: allOf: - $ref: '#/components/schemas/NotificationEventCounts' - type: object properties: total: type: integer byHour: type: object additionalProperties: $ref: '#/components/schemas/NotificationEventCounts' description: Event counts keyed by hour (ISO 8601 truncated to the hour) paths: # ── Health ────────────────────────────────────────────────────────────────── /healthz: get: tags: [Health] summary: Health check description: Returns server status. Use for reachability checks. operationId: getHealth responses: "200": description: Server is healthy content: application/json: schema: $ref: '#/components/schemas/HealthStatus' # ── Auth ──────────────────────────────────────────────────────────────────── /auth/clerk-me: get: tags: [Auth] summary: Get current web-admin session (Clerk) description: Returns the authenticated web-admin user resolved via Clerk session. Used by the web admin app only; mobile clients should use `GET /auth/me` with a bearer token instead. operationId: clerkGetMe responses: "200": description: Current Clerk-authenticated user content: application/json: schema: $ref: '#/components/schemas/MeResponse' "401": description: Not signed in via Clerk content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /auth/login: post: tags: [Auth] summary: Email/password login (deprecated) description: This endpoint is permanently removed. Returns 410 Gone. Use `POST /auth/magic-link` instead. operationId: legacyLogin deprecated: true responses: "410": description: Endpoint removed — use the magic-link flow content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /auth/magic-link: post: tags: [Auth] summary: Send a sign-in code description: Sends a 6-digit sign-in code to the user's email address. The code expires in 10 minutes. Up to 5 failed verification attempts are allowed before the code is locked. operationId: requestMagicLink requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MagicLinkRequest' responses: "200": description: Code sent content: application/json: schema: $ref: '#/components/schemas/MagicLinkResponse' "400": description: Invalid email content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "502": description: Email delivery failed (production only) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /auth/verify: post: tags: [Auth] summary: Verify a sign-in code description: | Exchanges a 6-digit email code for a user session token. The returned token should be stored securely (e.g. iOS Keychain) and attached to all subsequent requests as a bearer token. Session tokens expire after 60 days. Pass `guestToken` to upgrade an existing guest session to a full user account — the server transfers the guest's group membership to the user and invalidates the guest session. operationId: verifyMagicCode requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/VerifyCodeRequest' responses: "200": description: Session created content: application/json: schema: $ref: '#/components/schemas/Session' "400": description: Invalid or expired code content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "429": description: Too many failed attempts — request a new code content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /auth/me: get: tags: [Auth] summary: Get current session description: Returns the authenticated user's profile, group, and role. operationId: getMe security: - bearerAuth: [] responses: "200": description: Current session info content: application/json: schema: $ref: '#/components/schemas/MeResponse' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /auth/logout: post: tags: [Auth] summary: Sign out description: Invalidates the current session and deregisters any APNs device tokens tied to it. operationId: logout security: - bearerAuth: [] responses: "204": description: Signed out successfully /auth/guest: post: tags: [Auth] summary: Join as a guest description: Exchanges a 4-digit album guest code for a guest session token. Guest tokens are scoped to a single album, expire after 4 hours, and allow viewing and uploading media only to that album. operationId: loginAsGuest requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/GuestLoginRequest' responses: "200": description: Guest session created content: application/json: schema: $ref: '#/components/schemas/GuestSessionResponse' "400": description: Invalid or expired guest code content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /auth/device-token: post: tags: [Auth] summary: Register an APNs device token description: Registers an iOS device token for push notifications. The token is scoped to the current session; logging out automatically deregisters it. operationId: registerDeviceToken security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RegisterDeviceTokenRequest' responses: "204": description: Token registered "400": description: Missing or invalid token content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' delete: tags: [Auth] summary: Deregister an APNs device token description: Removes an iOS device token from push notification delivery. operationId: deregisterDeviceToken security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DeregisterDeviceTokenRequest' responses: "204": description: Token removed "400": description: Missing or invalid token content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Albums ────────────────────────────────────────────────────────────────── /albums: get: tags: [Albums] summary: List albums description: Returns all albums in the authenticated user's group, ordered by creation date. operationId: listAlbums security: - bearerAuth: [] responses: "200": description: List of albums content: application/json: schema: type: array items: $ref: '#/components/schemas/Album' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' post: tags: [Albums] summary: Create an album description: Creates a new album in the group. Requires Editor or Admin role. operationId: createAlbum security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateAlbumRequest' responses: "200": description: Album created content: application/json: schema: $ref: '#/components/schemas/Album' "400": description: Invalid input content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /albums/{id}: patch: tags: [Albums] summary: Update an album description: Renames an album and/or updates its capture rules. Requires Editor or Admin role. operationId: updateAlbum security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateAlbumRulesRequest' responses: "200": description: Album updated content: application/json: schema: $ref: '#/components/schemas/Album' "400": description: Invalid input content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Album not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' delete: tags: [Albums] summary: Delete an album description: Deletes an album and all associated media records. Requires Editor or Admin role. operationId: deleteAlbum security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string format: uuid responses: "204": description: Album deleted "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Album not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /albums/{id}/cover: put: tags: [Albums] summary: Set album cover description: Sets a photo as the album's cover image, or clears it by passing `null`. Only photos (not videos) may be used as covers. Requires Editor or Admin role. operationId: setAlbumCover security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SetAlbumCoverRequest' responses: "200": description: Album updated with new cover content: application/json: schema: $ref: '#/components/schemas/Album' "400": description: Invalid input or non-photo media specified content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Album or media not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Media ─────────────────────────────────────────────────────────────────── /media: get: tags: [Media] summary: List media description: | Returns up to 200 media records for the group, ordered newest first. Pass `albumId` to filter by album. Guests can only see media from their scoped album regardless of query parameters. operationId: listMedia security: - bearerAuth: [] parameters: - name: albumId in: query required: false schema: type: string format: uuid description: Filter by album responses: "200": description: List of media items content: application/json: schema: type: array items: $ref: '#/components/schemas/Media' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' post: tags: [Media] summary: Register a media record description: | Finalises a media upload by creating a server-side record. Must be called after uploading the file binary to the presigned URL from `POST /storage/uploads/request-url`. The server verifies that the caller holds a valid upload grant for the supplied `objectPath` before creating the record. Guests must supply `albumId` matching their session's album. operationId: createMedia security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateMediaRequest' responses: "200": description: Media record created content: application/json: schema: $ref: '#/components/schemas/Media' "400": description: Invalid input or media type mismatch content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: No valid upload grant for this object path content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Album not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /media/{id}: patch: tags: [Media] summary: Move media to another album description: Moves media from its current album to a different album (replaces the current album link). Requires Editor or Admin role. operationId: moveMedia security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MoveMediaRequest' responses: "200": description: Media moved content: application/json: schema: $ref: '#/components/schemas/Media' "400": description: Invalid input, media has no current album, or already in target album content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Media or target album not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' delete: tags: [Media] summary: Delete media description: Deletes a media record. Contributors can only delete their own uploads; Editors and Admins can delete any media in the group. operationId: deleteMedia security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string format: uuid responses: "204": description: Media deleted "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Cannot delete another user's media content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Media not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /media/{id}/album: patch: tags: [Media] summary: Add media to an album description: Adds an additional album association to a media item without removing existing ones. Requires Editor or Admin role. operationId: addMediaToAlbum security: - bearerAuth: [] parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MoveMediaRequest' responses: "200": description: Album association added content: application/json: schema: $ref: '#/components/schemas/Media' "400": description: albumId is required content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Media or target album not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Members ───────────────────────────────────────────────────────────────── /members: get: tags: [Members] summary: List members description: Returns all members in the group, ordered by join date. operationId: listMembers security: - bearerAuth: [] responses: "200": description: List of members content: application/json: schema: type: array items: $ref: '#/components/schemas/Member' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /members/{userId}: patch: tags: [Members] summary: Update member role description: Changes a group member's role. Requires Admin role. operationId: updateMemberRole security: - bearerAuth: [] parameters: - name: userId in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateMemberRoleRequest' responses: "200": description: Member updated content: application/json: schema: $ref: '#/components/schemas/Member' "400": description: Invalid role content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Admin) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Member not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Invites ───────────────────────────────────────────────────────────────── /invites: get: tags: [Invites] summary: List invite codes description: Returns active (non-expired) member invite codes for the group. Requires Admin role. operationId: listInvites security: - bearerAuth: [] responses: "200": description: List of active invite codes content: application/json: schema: type: array items: $ref: '#/components/schemas/Invite' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Admin) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' post: tags: [Invites] summary: Create an invite code description: Generates an 8-digit member invite code that expires in 7 days. Optionally emails the code. Requires Admin role. operationId: createInvite security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateInviteRequest' responses: "200": description: Invite code created content: application/json: schema: $ref: '#/components/schemas/CreateInviteResponse' "400": description: Invalid input content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Admin) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /invites/{code}: delete: tags: [Invites] summary: Revoke an invite code description: Deletes an invite code so it can no longer be used. Requires Admin role. operationId: revokeInvite security: - bearerAuth: [] parameters: - name: code in: path required: true schema: type: string description: The 8-digit invite code to revoke responses: "204": description: Invite revoked "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Admin) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Invite not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Guest Codes ───────────────────────────────────────────────────────────── /guest-codes: get: tags: [Guest Codes] summary: List guest codes description: Returns active (non-expired) guest codes for the group. Requires Editor or Admin role. operationId: listGuestCodes security: - bearerAuth: [] responses: "200": description: List of active guest codes content: application/json: schema: type: array items: $ref: '#/components/schemas/GuestCode' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' post: tags: [Guest Codes] summary: Create a guest code description: Generates a 4-digit guest code for an album that expires in 24 hours. Requires Editor or Admin role. operationId: createGuestCode security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateGuestCodeRequest' responses: "200": description: Guest code created content: application/json: schema: $ref: '#/components/schemas/CreateGuestCodeResponse' "400": description: Invalid input content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Album not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /guest-codes/{code}: delete: tags: [Guest Codes] summary: Revoke a guest code description: Deletes a guest code so it can no longer be used to join as a guest. Requires Editor or Admin role. operationId: revokeGuestCode security: - bearerAuth: [] parameters: - name: code in: path required: true schema: type: string description: The 4-digit guest code to revoke responses: "204": description: Guest code revoked "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Editor+) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Guest code not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Storage ───────────────────────────────────────────────────────────────── /storage/uploads/request-url: post: tags: [Storage] summary: Request a presigned upload URL description: | Returns a presigned URL for uploading a file directly to object storage. This is step 1 of the 3-step media upload flow: 1. `POST /storage/uploads/request-url` — get presigned URL and `objectPath` 2. `PUT ` — upload raw file binary directly (no auth header) 3. `POST /media` — register the media record with the server The server creates an upload grant tied to the returned `objectPath`. Grants expire after 60 minutes. Guests can only upload to their scoped album. operationId: requestUploadUrl security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UploadUrlRequest' responses: "200": description: Presigned upload URL content: application/json: schema: $ref: '#/components/schemas/UploadUrlResponse' "400": description: Invalid content type content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "500": description: Failed to generate upload URL content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /storage/objects/{objectPath}: get: tags: [Storage] summary: Stream a media object description: | Streams a private media object. The `url` field in any media record points to this endpoint. Authenticated users can access any object belonging to their group. Guests can only access objects linked to their scoped album. operationId: getStorageObject security: - bearerAuth: [] parameters: - name: objectPath in: path required: true schema: type: string description: "Object path as returned in the media `url` field, e.g. `objects/uploads/`" responses: "200": description: Object binary stream content: image/jpeg: schema: type: string format: binary image/png: schema: type: string format: binary video/mp4: schema: type: string format: binary "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Object exists but is not accessible to this caller content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Object not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Activity ──────────────────────────────────────────────────────────────── /activity: get: tags: [Activity] summary: List activity description: Returns the 100 most recent activity events for the group, ordered newest first. operationId: listActivity security: - bearerAuth: [] responses: "200": description: List of activity events content: application/json: schema: type: array items: $ref: '#/components/schemas/ActivityEvent' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Notification Preferences ──────────────────────────────────────────────── /notification-prefs/muted-albums: get: tags: [Notification Preferences] summary: List muted albums description: Returns the IDs of albums for which the authenticated user has muted push notifications. operationId: getMutedAlbums security: - bearerAuth: [] responses: "200": description: Muted album IDs content: application/json: schema: $ref: '#/components/schemas/MutedAlbumsResponse' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /notification-prefs/albums/{albumId}/mute: put: tags: [Notification Preferences] summary: Mute album notifications description: Mutes push notifications for a specific album. Returns the updated list of muted album IDs. operationId: muteAlbum security: - bearerAuth: [] parameters: - name: albumId in: path required: true schema: type: string format: uuid responses: "200": description: Updated muted album IDs content: application/json: schema: $ref: '#/components/schemas/MutedAlbumsResponse' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Album not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' delete: tags: [Notification Preferences] summary: Unmute album notifications description: Re-enables push notifications for a specific album. Returns the updated list of muted album IDs. operationId: unmuteAlbum security: - bearerAuth: [] parameters: - name: albumId in: path required: true schema: type: string format: uuid responses: "200": description: Updated muted album IDs content: application/json: schema: $ref: '#/components/schemas/MutedAlbumsResponse' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "404": description: Album not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' # ── Video Processing ───────────────────────────────────────────────────────── /videos: post: tags: [Videos] summary: Upload a video for processing description: | Accepts a raw multipart video file upload. The server stores the file, kicks off background processing (ffmpeg transcoding, HLS packaging, AI frame captioning), and returns immediately with a `pending` video record. This is a direct multipart upload — different from the object-storage-based photo/video flow in `POST /media`. Use this endpoint when you need server-side transcoding and HLS delivery. operationId: uploadVideo requestBody: required: true content: multipart/form-data: schema: type: object required: [file] properties: file: type: string description: Raw video file binary (mp4, mov, etc.) albumId: type: string description: Optional album ID to associate the video with userId: type: string description: Optional user ID to attribute the upload to responses: "202": description: Video accepted for processing content: application/json: schema: $ref: '#/components/schemas/VideoRecord' "400": description: Missing file content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' get: tags: [Videos] summary: List videos description: Returns up to 200 video records ordered newest first. operationId: listVideos responses: "200": description: List of video records content: application/json: schema: type: object required: [videos] properties: videos: type: array items: $ref: '#/components/schemas/VideoRecord' /videos/{id}: get: tags: [Videos] summary: Get a video description: Returns a single video record including the list of captioned frames. operationId: getVideo parameters: - name: id in: path required: true schema: type: string description: Video ID (e.g. `vid_`) responses: "200": description: Video record with frames content: application/json: schema: allOf: - $ref: '#/components/schemas/VideoRecord' - type: object properties: frames: type: array items: $ref: '#/components/schemas/VideoFrame' "404": description: Video not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' delete: tags: [Videos] summary: Delete a video description: Deletes the video record and removes all associated files from disk (HLS segments, frames, original). operationId: deleteVideo parameters: - name: id in: path required: true schema: type: string responses: "200": description: Video deleted content: application/json: schema: type: object properties: ok: type: boolean example: true "404": description: Video not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /videos/{id}/hls/{file}: get: tags: [Videos] summary: Stream HLS playlist or segment description: Serves an HLS master playlist (`master.m3u8`), variant playlist, or transport stream segment (`.ts`). Segments are cached immutably; playlists are served with `no-cache`. operationId: getVideoHlsFile parameters: - name: id in: path required: true schema: type: string - name: file in: path required: true schema: type: string description: Filename, e.g. `master.m3u8` or `seg_000.ts` responses: "200": description: HLS playlist or segment content: application/vnd.apple.mpegurl: schema: type: string format: binary video/mp2t: schema: type: string format: binary "400": description: Invalid filename (path traversal attempt) "404": description: File not found /videos/{id}/frames/{file}: get: tags: [Videos] summary: Get a video frame image description: Returns a JPEG thumbnail frame extracted from the video during processing. operationId: getVideoFrame parameters: - name: id in: path required: true schema: type: string - name: file in: path required: true schema: type: string description: Frame filename, e.g. `frame_001.jpg` responses: "200": description: JPEG frame image content: image/jpeg: schema: type: string format: binary "400": description: Invalid filename "404": description: Frame not found # ── Search ─────────────────────────────────────────────────────────────────── /search: get: tags: [Search] summary: Search videos by caption description: | Searches video frames by natural-language query. When an AI model is available the server uses semantic ranking; otherwise it falls back to keyword overlap. Returns the best matching moment per video, ordered by relevance score. operationId: searchVideos parameters: - name: q in: query required: true schema: type: string description: Natural-language search query responses: "200": description: Search results content: application/json: schema: type: object required: [query, results] properties: query: type: string results: type: array items: $ref: '#/components/schemas/SearchResult' totalCandidates: type: integer description: Total number of indexed frames searched message: type: string nullable: true description: Optional informational message (e.g. no indexed videos yet) # ── Admin ──────────────────────────────────────────────────────────────────── /admin/notifications/stats: get: tags: [Admin] summary: APNs notification delivery stats description: Returns APNs push notification delivery counts (success / failure / pruned) for the last 24 hours, broken down by hour and summarised in totals. Requires Admin role. operationId: getNotificationStats security: - bearerAuth: [] responses: "200": description: Notification delivery statistics content: application/json: schema: $ref: '#/components/schemas/NotificationStats' "401": description: Not authenticated content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' "403": description: Insufficient role (requires Admin) content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope'