Skip to main content
This endpoint requires authentication. Users can only share their own media files.

Overview

Generate a shareable link for a media item and optionally share it to the Community feed. When shared to community, the media is copied to the public general bucket with watermarking applied to user uploads.

Path Parameters

number
required
The database ID of the media item to share. Get this from GET /api/user/media.

Request Body

boolean
default:true
Whether to share the media to the global Community feed.
  • true - Creates a persistent copy in the general bucket and displays in Community
  • false - Removes any existing community copy and tag assignments
array
Array of tag slugs to apply to the shared media (required when sharing user uploads to community).Example: ["brunette", "solo", "lingerie"]Validation:
  • At least one tag required for upload images shared to community
  • Tags must exist in the canonical tags system
  • Maximum per configuration (typically 10 tags)
boolean
Confirmation that user agrees to community sharing policy (required when sharing user uploads to community).Must be true when shareToCommunity=true for source: "upload" images.

Request Example

Community Sharing Process

When shareToCommunity=true

  1. Generate share code - Unique code for the media item
  2. Copy to general bucket:
    • Downloads file from user-media bucket
    • Applies JOIP watermark to user uploads (images only)
    • Uploads to general bucket with unique filename
  3. Create community record - Entry in community_media table
  4. Apply tags - Associates selected tags with the community media
  5. Update media record - Sets isShared=true and shareToCommunity=true

When shareToCommunity=false

  1. Update media record - Sets shareToCommunity=false
  2. Remove community copy:
    • Deletes file from general bucket
    • Removes community_media record
    • Removes all tag assignments

Watermarking

Applies to: User uploads (source: "upload") with watermarkable MIME types Watermarkable types:
  • image/jpeg
  • image/png
  • image/webp
Non-watermarked sources:
  • smart-caption - AI-generated captions
  • babecock - Babecock Studio composites
  • hypnococks - HypnoCocks renders
  • Videos and GIFs (any source)

Concurrent Share Handling

The endpoint uses advisory locks to handle concurrent share requests:
  • Prevents duplicate community records
  • Atomic updates to existing records
  • Safe for multiple users or browser tabs

Authorization

  • Users can only share their own media
  • Endpoint verifies media.userId matches authenticated user
  • Returns 404 Not Found if media doesn’t exist or belongs to another user

Response

string
required
Unique share code for accessing the media via public URL
string
required
Full shareable URL: /shared/media/{shareCode}
string
Public URL of the file in the general bucket (when shareToCommunity=true)
number
Database ID of the community media record (when shareToCommunity=true)

Success Response Example

Error Responses

400 Bad Request

Invalid media ID:
Missing policy agreement (for user upload images):
Missing tags (for user upload images):

404 Not Found

Media not found or unauthorized:

500 Internal Server Error

Failed to create share link:
General error:

Activity Tracking

Successful shares are logged with:
  • Action: media_shared
  • Feature: media_gallery
  • Details: Media ID, share code, community sharing status

Example Usage

cURL

JavaScript (Fetch API)

React Example with Tag Selection

Unshare from Community

DELETE /api/media/:id/share

Completely remove sharing:
  • Deletes share code
  • Removes community copy if shared
  • Sets isShared=false and shareToCommunity=false

POST /api/user/media/share

Share by storage path instead of database ID:
  • Accepts filePath in request body
  • Creates database record if needed
  • Same sharing behavior otherwise

Notes

  • Share codes are unique and unguessable (UUID-based)
  • Community copies are persistent and remain even if original is deleted from user’s vault
  • Watermarking is applied automatically to user upload images
  • Generated media (Smart Captions, Babecock, HypnoCocks) is not watermarked
  • Tag assignments are only stored for community media, not the original
  • Multiple concurrent share requests are handled safely with database locks
  • Shared media appears in the Community feed at /community