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 publicgeneral bucket with watermarking applied to user uploads.
Path Parameters
The database ID of the media item to share. Get this from
GET /api/user/media.Request Body
Whether to share the media to the global Community feed.
true- Creates a persistent copy in thegeneralbucket and displays in Communityfalse- Removes any existing community copy and tag assignments
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)
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
- Generate share code - Unique code for the media item
- Copy to general bucket:
- Downloads file from
user-mediabucket - Applies JOIP watermark to user uploads (images only)
- Uploads to
generalbucket with unique filename
- Downloads file from
- Create community record - Entry in
community_mediatable - Apply tags - Associates selected tags with the community media
- Update media record - Sets
isShared=trueandshareToCommunity=true
When shareToCommunity=false
- Update media record - Sets
shareToCommunity=false - Remove community copy:
- Deletes file from
generalbucket - Removes
community_mediarecord - Removes all tag assignments
- Deletes file from
Watermarking
Applies to: User uploads (source: "upload") with watermarkable MIME types
Watermarkable types:
image/jpegimage/pngimage/webp
smart-caption- AI-generated captionsbabecock- Babecock Studio compositeshypnococks- 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.userIdmatches authenticated user - Returns
404 Not Foundif media doesn’t exist or belongs to another user
Response
Unique share code for accessing the media via public URL
Full shareable URL:
/shared/media/{shareCode}Public URL of the file in the
general bucket (when shareToCommunity=true)Database ID of the community media record (when
shareToCommunity=true)Success Response Example
Error Responses
400 Bad Request
Invalid media ID:404 Not Found
Media not found or unauthorized:500 Internal Server Error
Failed to create share link: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
Related Endpoints
DELETE /api/media/:id/share
Completely remove sharing:- Deletes share code
- Removes community copy if shared
- Sets
isShared=falseandshareToCommunity=false
POST /api/user/media/share
Share by storage path instead of database ID:- Accepts
filePathin 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