{"openapi":"3.1.0","info":{"title":"Zegazone Third-Party API","version":"2026-06-03.1","description":"Agent-facing API for Zegazone collections and media.\n\nHuman-readable docs: https://www.zegazone.com/api-docs\n\nDiscovery: https://www.zegazone.com/llms.txt","contact":{"name":"Zegazone","url":"https://www.zegazone.com"}},"servers":[{"url":"https://api.zegaphone.com","description":"Zegazone API (Supabase Edge Functions)"}],"tags":[{"name":"API"},{"name":"Collaboration"},{"name":"Collections"},{"name":"Discovery"},{"name":"Media"},{"name":"Meta"},{"name":"Profile"},{"name":"Social"},{"name":"UI"}],"paths":{"/functions/v1/thirdparty-v1":{"post":{"summary":"Execute a Zegazone third-party operation","description":"Single RPC-style endpoint. Set `op` to the operation name and include operation-specific fields in the JSON body. Authenticate with a third-party OAuth access token.","operationId":"thirdparty_v1_execute","tags":["Third-Party API"],"security":[{"thirdPartyOAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/aliases_follow"},{"$ref":"#/components/schemas/aliases_following_list"},{"$ref":"#/components/schemas/aliases_list"},{"$ref":"#/components/schemas/aliases_unfollow"},{"$ref":"#/components/schemas/bookmarks_create"},{"$ref":"#/components/schemas/bookmarks_delete"},{"$ref":"#/components/schemas/bookmarks_list"},{"$ref":"#/components/schemas/collaborators_invite"},{"$ref":"#/components/schemas/collaborators_invite_accept"},{"$ref":"#/components/schemas/collaborators_invite_decline"},{"$ref":"#/components/schemas/collaborators_invites_list"},{"$ref":"#/components/schemas/collaborators_invites_received"},{"$ref":"#/components/schemas/collaborators_list"},{"$ref":"#/components/schemas/collaborators_revoke"},{"$ref":"#/components/schemas/collaborators_update_permissions"},{"$ref":"#/components/schemas/collections_archive"},{"$ref":"#/components/schemas/collections_batch_get"},{"$ref":"#/components/schemas/collections_browse"},{"$ref":"#/components/schemas/collections_create"},{"$ref":"#/components/schemas/collections_delete"},{"$ref":"#/components/schemas/collections_export"},{"$ref":"#/components/schemas/collections_get"},{"$ref":"#/components/schemas/collections_get_by_slug"},{"$ref":"#/components/schemas/collections_get_upload_url"},{"$ref":"#/components/schemas/collections_like"},{"$ref":"#/components/schemas/collections_liked_list"},{"$ref":"#/components/schemas/collections_list"},{"$ref":"#/components/schemas/collections_publish"},{"$ref":"#/components/schemas/collections_reorder"},{"$ref":"#/components/schemas/collections_restore"},{"$ref":"#/components/schemas/collections_search"},{"$ref":"#/components/schemas/collections_share_url"},{"$ref":"#/components/schemas/collections_stats_get"},{"$ref":"#/components/schemas/collections_unarchive"},{"$ref":"#/components/schemas/collections_unlike"},{"$ref":"#/components/schemas/collections_unpublish"},{"$ref":"#/components/schemas/collections_update"},{"$ref":"#/components/schemas/mcp_revoke_session"},{"$ref":"#/components/schemas/media_archive"},{"$ref":"#/components/schemas/media_batch_list"},{"$ref":"#/components/schemas/media_copy"},{"$ref":"#/components/schemas/media_create"},{"$ref":"#/components/schemas/media_delete"},{"$ref":"#/components/schemas/media_describe"},{"$ref":"#/components/schemas/media_download"},{"$ref":"#/components/schemas/media_download_url"},{"$ref":"#/components/schemas/media_get"},{"$ref":"#/components/schemas/media_get_upload_url"},{"$ref":"#/components/schemas/media_list"},{"$ref":"#/components/schemas/media_move"},{"$ref":"#/components/schemas/media_reorder"},{"$ref":"#/components/schemas/media_replace"},{"$ref":"#/components/schemas/media_restore"},{"$ref":"#/components/schemas/media_search"},{"$ref":"#/components/schemas/media_text_note_add"},{"$ref":"#/components/schemas/media_text_note_delete"},{"$ref":"#/components/schemas/media_text_note_get"},{"$ref":"#/components/schemas/media_text_note_update"},{"$ref":"#/components/schemas/media_thumbnail_finalize"},{"$ref":"#/components/schemas/media_thumbnail_uploaded"},{"$ref":"#/components/schemas/media_unarchive"},{"$ref":"#/components/schemas/media_update"},{"$ref":"#/components/schemas/operation_describe"},{"$ref":"#/components/schemas/operations_list"},{"$ref":"#/components/schemas/ping"},{"$ref":"#/components/schemas/profile_get"},{"$ref":"#/components/schemas/profile_update"},{"$ref":"#/components/schemas/schema_get"},{"$ref":"#/components/schemas/ui_state_get"},{"$ref":"#/components/schemas/ui_state_set"}],"discriminator":{"propertyName":"op","mapping":{"aliases.follow":"#/components/schemas/aliases_follow","aliases.following.list":"#/components/schemas/aliases_following_list","aliases.list":"#/components/schemas/aliases_list","aliases.unfollow":"#/components/schemas/aliases_unfollow","bookmarks.create":"#/components/schemas/bookmarks_create","bookmarks.delete":"#/components/schemas/bookmarks_delete","bookmarks.list":"#/components/schemas/bookmarks_list","collaborators.invite":"#/components/schemas/collaborators_invite","collaborators.invite.accept":"#/components/schemas/collaborators_invite_accept","collaborators.invite.decline":"#/components/schemas/collaborators_invite_decline","collaborators.invites.list":"#/components/schemas/collaborators_invites_list","collaborators.invites.received":"#/components/schemas/collaborators_invites_received","collaborators.list":"#/components/schemas/collaborators_list","collaborators.revoke":"#/components/schemas/collaborators_revoke","collaborators.update_permissions":"#/components/schemas/collaborators_update_permissions","collections.archive":"#/components/schemas/collections_archive","collections.batch.get":"#/components/schemas/collections_batch_get","collections.browse":"#/components/schemas/collections_browse","collections.create":"#/components/schemas/collections_create","collections.delete":"#/components/schemas/collections_delete","collections.export":"#/components/schemas/collections_export","collections.get":"#/components/schemas/collections_get","collections.get_by_slug":"#/components/schemas/collections_get_by_slug","collections.get_upload_url":"#/components/schemas/collections_get_upload_url","collections.like":"#/components/schemas/collections_like","collections.liked.list":"#/components/schemas/collections_liked_list","collections.list":"#/components/schemas/collections_list","collections.publish":"#/components/schemas/collections_publish","collections.reorder":"#/components/schemas/collections_reorder","collections.restore":"#/components/schemas/collections_restore","collections.search":"#/components/schemas/collections_search","collections.share_url":"#/components/schemas/collections_share_url","collections.stats.get":"#/components/schemas/collections_stats_get","collections.unarchive":"#/components/schemas/collections_unarchive","collections.unlike":"#/components/schemas/collections_unlike","collections.unpublish":"#/components/schemas/collections_unpublish","collections.update":"#/components/schemas/collections_update","mcp.revoke_session":"#/components/schemas/mcp_revoke_session","media.archive":"#/components/schemas/media_archive","media.batch.list":"#/components/schemas/media_batch_list","media.copy":"#/components/schemas/media_copy","media.create":"#/components/schemas/media_create","media.delete":"#/components/schemas/media_delete","media.describe":"#/components/schemas/media_describe","media.download":"#/components/schemas/media_download","media.download_url":"#/components/schemas/media_download_url","media.get":"#/components/schemas/media_get","media.get_upload_url":"#/components/schemas/media_get_upload_url","media.list":"#/components/schemas/media_list","media.move":"#/components/schemas/media_move","media.reorder":"#/components/schemas/media_reorder","media.replace":"#/components/schemas/media_replace","media.restore":"#/components/schemas/media_restore","media.search":"#/components/schemas/media_search","media.text_note.add":"#/components/schemas/media_text_note_add","media.text_note.delete":"#/components/schemas/media_text_note_delete","media.text_note.get":"#/components/schemas/media_text_note_get","media.text_note.update":"#/components/schemas/media_text_note_update","media.thumbnail_finalize":"#/components/schemas/media_thumbnail_finalize","media.thumbnail_uploaded":"#/components/schemas/media_thumbnail_uploaded","media.unarchive":"#/components/schemas/media_unarchive","media.update":"#/components/schemas/media_update","operation.describe":"#/components/schemas/operation_describe","operations.list":"#/components/schemas/operations_list","ping":"#/components/schemas/ping","profile.get":"#/components/schemas/profile_get","profile.update":"#/components/schemas/profile_update","schema.get":"#/components/schemas/schema_get","ui.state.get":"#/components/schemas/ui_state_get","ui.state.set":"#/components/schemas/ui_state_set"}}}}}},"responses":{"200":{"description":"Operation result (shape varies by op)","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"429":{"description":"Rate limited"},"500":{"description":"Server error"}}}}},"components":{"schemas":{"aliases_follow":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"aliases.follow"},"alias_id":{"type":"string","format":"uuid"},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","alias_id"]},"aliases_follow_meta":{"type":"object","description":"Follow another user publish alias (profile_aliases row). Required scope: `collections:write`."},"aliases_following_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"aliases.following.list"}},"required":["op"]},"aliases_following_list_meta":{"type":"object","description":"List aliases and primary usernames the token subject follows. Required scope: `collections:read`."},"aliases_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"aliases.list"}},"required":["op"]},"aliases_list_meta":{"type":"object","description":"List publish handles (primary username + profile_aliases) for the token subject. Required scope: `collections:read`."},"aliases_unfollow":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"aliases.unfollow"},"alias_id":{"type":"string","format":"uuid"},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","alias_id"]},"aliases_unfollow_meta":{"type":"object","description":"Unfollow a publish alias. Required scope: `collections:write`."},"bookmarks_create":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"bookmarks.create"},"title":{"type":"string","minLength":1,"maxLength":500},"collection_ids":{"type":"string"},"source":{"type":"string","default":"agent"}},"required":["op","title","collection_ids"]},"bookmarks_create_meta":{"type":"object","description":"Save a named bookmark of collection ids for later recall in the player. Required scope: `collections:read`."},"bookmarks_delete":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"bookmarks.delete"},"bookmark_id":{"type":"string","format":"uuid"}},"required":["op","bookmark_id"]},"bookmarks_delete_meta":{"type":"object","description":"Delete a bookmark by id. Required scope: `collections:read`."},"bookmarks_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"bookmarks.list"}},"required":["op"]},"bookmarks_list_meta":{"type":"object","description":"List collection browse bookmarks saved by the token subject. Required scope: `collections:read`."},"collaborators_invite":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collaborators.invite"},"collection_id":{"type":"integer","minimum":1},"username":{"type":"string","minLength":1},"can_upload":{"type":"boolean"},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id","username"]},"collaborators_invite_meta":{"type":"object","description":"Invite a Zegazone user to collaborate on a restricted/private owned collection by username. Required scope: `collections:write`."},"collaborators_invite_accept":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collaborators.invite.accept"},"collection_id":{"type":"integer","minimum":1},"inviter_user_id":{"type":"string","format":"uuid"},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id","inviter_user_id"]},"collaborators_invite_accept_meta":{"type":"object","description":"Accept a pending collaboration invite. Required scope: `collections:write`."},"collaborators_invite_decline":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collaborators.invite.decline"},"collection_id":{"type":"integer","minimum":1},"inviter_user_id":{"type":"string","format":"uuid"},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id","inviter_user_id"]},"collaborators_invite_decline_meta":{"type":"object","description":"Decline a pending collaboration invite. Required scope: `collections:write`."},"collaborators_invites_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collaborators.invites.list"}},"required":["op"]},"collaborators_invites_list_meta":{"type":"object","description":"List pending collaboration invites sent by the token subject. Required scope: `collections:read`."},"collaborators_invites_received":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collaborators.invites.received"}},"required":["op"]},"collaborators_invites_received_meta":{"type":"object","description":"List pending collaboration invites received by the token subject. Required scope: `collections:read`."},"collaborators_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collaborators.list"},"collection_id":{"type":"integer","minimum":1}},"required":["op","collection_id"]},"collaborators_list_meta":{"type":"object","description":"List accepted collaborators on an owned collection. Required scope: `collections:read`."},"collaborators_revoke":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collaborators.revoke"},"collection_id":{"type":"integer","minimum":1},"user_id":{"type":"string","format":"uuid"},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id","user_id"]},"collaborators_revoke_meta":{"type":"object","description":"Remove a collaborator or cancel a pending invite on an owned collection. Required scope: `collections:write`."},"collaborators_update_permissions":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collaborators.update_permissions"},"collection_id":{"type":"integer","minimum":1},"user_id":{"type":"string","format":"uuid"},"can_upload":{"type":"boolean"},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id","user_id"]},"collaborators_update_permissions_meta":{"type":"object","description":"Update upload/edit/delete permissions for an existing collaborator or pending invite. Required scope: `collections:write`."},"collections_archive":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.archive"},"collection_id":{"type":"integer","minimum":1},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id"]},"collections_archive_meta":{"type":"object","description":"Set is_archived=true on an owned collection (hidden from default lists). Required scope: `collections:write`."},"collections_batch_get":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.batch.get"},"ids":{"type":"array","items":{"type":"integer"}},"include_archived":{"type":"boolean","default":false}},"required":["op","ids"]},"collections_batch_get_meta":{"type":"object","description":"Fetch up to 30 collections by id in one call (owned, non-deleted only). Order matches the request ids where possible. Required scope: `collections:read`."},"collections_browse":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.browse"},"scope":{"type":"array","items":{"type":"string"}},"limit":{"type":"integer","minimum":1,"maximum":100},"offset":{"type":"integer","minimum":0}},"required":["op","scope"]},"collections_browse_meta":{"type":"object","description":"Browse collections without a search query. Uses browse_collections_scoped for public/following/liked; own/shared via service-role queries. Scope own/shared need collections:read. No OAuth scope required."},"collections_create":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.create"},"name":{"type":"string","minLength":1},"thumbnail_url":{"type":"string","format":"url"},"description":{"type":"string","maxLength":4000},"is_nsfw":{"type":"boolean","default":false},"share_access_level":{"type":"string","enum":["private","public","registered","restricted"],"default":"private"},"tags":{"type":"array","items":{"type":"string"}},"searchable":{"type":"boolean","default":true},"alias_id":{"type":"string","format":"uuid"},"playback_prefs":{"type":"string"},"parent_collection_id":{"type":"integer","minimum":1},"link_position":{"type":"integer","minimum":0},"link_description":{"type":"string","maxLength":4000}},"required":["op","name"]},"collections_create_meta":{"type":"object","description":"Create a new collection owned by the token subject. If thumbnail_url is http(s), the image is downloaded to R2; raster images are processed through the same GCF image pipeline as media uploads (WebP main + thumbnail on the media table, then the collection stores the resulting r2:// thumbnail). When parent_collection_id is set, creates a sub-collection (is_subcollection=true) and inserts the inline subcollection stub media row in the parent collection (requires media:write in addition to collections:write). Required scope: `collections:write`."},"collections_delete":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.delete"},"collection_id":{"type":"integer","minimum":1},"mode":{"type":"string","enum":["soft","hard"],"default":"soft"},"cascade_media":{"type":"boolean","default":false},"confirm":{"type":"boolean","default":false},"dry_run":{"type":"boolean","default":false},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id"]},"collections_delete_meta":{"type":"object","description":"Delete an owned collection: soft (is_deleted) by default; hard removes the row (DB cascades media). Non-empty soft-delete requires cascade_media or hard mode. Required scope: `collections:delete`."},"collections_export":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.export"},"collection_id":{"type":"integer","minimum":1},"format":{"type":"string","enum":["json","csv"],"default":"json"},"include_archived":{"type":"boolean","default":false}},"required":["op","collection_id"]},"collections_export_meta":{"type":"object","description":"Export one owned collection’s media metadata as JSON or CSV (no binary file bodies; use media.download per item for R2 content). Required scope: `collections:read`."},"collections_get":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.get"},"collection_id":{"type":"integer","minimum":1}},"required":["op","collection_id"]},"collections_get_meta":{"type":"object","description":"Fetch one collection by id when the token subject owns it or is an accepted collaborator. Required scope: `collections:read`."},"collections_get_by_slug":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.get_by_slug"},"handle":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1}},"required":["op","handle","slug"]},"collections_get_by_slug_meta":{"type":"object","description":"Resolve a collection from its public URL handle and slug (www.zegazone.com/{handle}/{slug}). Returns the row when the collection is public/registered or the caller has read access. Required scope: `collections:read`."},"collections_get_upload_url":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.get_upload_url"},"collection_id":{"type":"integer","minimum":1},"content_type":{"type":"string","format":"mime"},"filename":{"type":"string","maxLength":180},"purpose":{"type":"string","enum":["cover"],"default":"cover"}},"required":["op","collection_id","content_type"]},"collections_get_upload_url_meta":{"type":"object","description":"Mint a presigned R2 PUT URL for a collection cover image only (purpose=cover). After PUT, set collections.update thumbnail_url to the returned r2_key. Do NOT use this for media item thumbnails — use media.get_upload_url with purpose=thumbnail, then media.thumbnail_finalize. Required scope: `collections:write`."},"collections_like":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.like"},"collection_id":{"type":"integer","minimum":1},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id"]},"collections_like_meta":{"type":"object","description":"Like a public collection (uses collection_like_set RPC, same as like-collection edge function). Required scope: `collections:write`."},"collections_liked_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.liked.list"},"limit":{"type":"integer","minimum":1,"maximum":500},"offset":{"type":"integer","minimum":0}},"required":["op"]},"collections_liked_list_meta":{"type":"object","description":"List collections the token subject has liked. Required scope: `collections:read`."},"collections_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.list"},"name_contains":{"type":"string"},"tag":{"type":"string"},"is_nsfw":{"type":"boolean"},"include_archived":{"type":"boolean","default":false},"limit":{"type":"integer","minimum":1,"maximum":500,"default":100},"offset":{"type":"integer","minimum":0,"default":0}},"required":["op"]},"collections_list_meta":{"type":"object","description":"List collections owned by the token subject. Required scope: `collections:read`."},"collections_publish":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.publish"},"collection_id":{"type":"integer","minimum":1},"slug":{"type":"string","minLength":1},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id","slug"]},"collections_publish_meta":{"type":"object","description":"Publish an owned collection (share_access_level=public, set share_slug). Required scope: `collections:write`."},"collections_reorder":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.reorder"},"ordered_ids":{"type":"array","items":{"type":"integer"}},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","ordered_ids"]},"collections_reorder_meta":{"type":"object","description":"Assign collection position order by explicit ordered_ids (subset of owned non-deleted collections). Required scope: `collections:write`."},"collections_restore":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.restore"},"collection_id":{"type":"integer","minimum":1},"confirm":{"type":"boolean","default":false},"dry_run":{"type":"boolean","default":false},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id"]},"collections_restore_meta":{"type":"object","description":"Restore an owned soft-deleted collection (is_deleted = false). Required scope: `collections:write`."},"collections_search":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.search"},"query":{"type":"string","minLength":3},"scope":{"type":"array","items":{"type":"string"}},"limit":{"type":"integer","minimum":1,"maximum":50},"offset":{"type":"integer","minimum":0}},"required":["op","query"]},"collections_search_meta":{"type":"object","description":"Search published collections (FTS + trigram). Proxies search_collections_scoped RPC (search-collections edge function). No extra OAuth scope; following/liked scopes need a user-bound token. No OAuth scope required."},"collections_share_url":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.share_url"},"collection_id":{"type":"integer","minimum":1}},"required":["op","collection_id"]},"collections_share_url_meta":{"type":"object","description":"Get the public share URL for a published collection (www.zegazone.com/{handle}/{slug}). Required scope: `collections:read`."},"collections_stats_get":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.stats.get"},"collection_id":{"type":"integer","minimum":1}},"required":["op","collection_id"]},"collections_stats_get_meta":{"type":"object","description":"Read like/view stats for a collection the caller can access. Required scope: `collections:read`."},"collections_unarchive":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.unarchive"},"collection_id":{"type":"integer","minimum":1},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id"]},"collections_unarchive_meta":{"type":"object","description":"Set is_archived=false on an owned collection. Required scope: `collections:write`."},"collections_unlike":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.unlike"},"collection_id":{"type":"integer","minimum":1},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id"]},"collections_unlike_meta":{"type":"object","description":"Remove your like from a collection. Required scope: `collections:write`."},"collections_unpublish":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.unpublish"},"collection_id":{"type":"integer","minimum":1},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id"]},"collections_unpublish_meta":{"type":"object","description":"Make an owned collection private. Required scope: `collections:write`."},"collections_update":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"collections.update"},"collection_id":{"type":"integer","minimum":1},"name":{"type":"string","minLength":1},"description":{"type":"string","maxLength":4000,"nullable":true},"tags":{"type":"array","items":{"type":"string"}},"thumbnail_url":{"type":"string","format":"url"},"is_nsfw":{"type":"boolean"},"share_access_level":{"type":"string","enum":["private","public","registered","restricted"]},"position":{"type":"integer","minimum":0},"searchable":{"type":"boolean"},"alias_id":{"type":"string","format":"uuid","nullable":true},"playback_prefs":{"type":"string","nullable":true}},"required":["op","collection_id"]},"collections_update_meta":{"type":"object","description":"Update one owned collection in place. Only provided fields are changed; optional thumbnail_url can be ingested into R2 like collections.create. Required scope: `collections:write`."},"mcp_revoke_session":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"mcp.revoke_session"},"client_id":{"type":"string"},"credential_id":{"type":"string","format":"uuid"},"confirm":{"type":"boolean","default":false},"dry_run":{"type":"boolean","default":false},"idempotency_key":{"type":"string","maxLength":128}},"required":["op"]},"mcp_revoke_session_meta":{"type":"object","description":"Revoke hosted MCP OAuth sessions for the authenticated user (D1 credentials + oauth_refresh_tokens). Accepts third-party access token or first-party Supabase session JWT from zegazone.com settings. No OAuth scope required."},"media_archive":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.archive"},"media_id":{"type":"integer","minimum":1},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","media_id"]},"media_archive_meta":{"type":"object","description":"Set is_archived=true on owned media. Required scope: `media:write`."},"media_batch_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.batch.list"},"collection_ids":{"type":"array","items":{"type":"integer"}},"include_archived":{"type":"boolean","default":false},"limit":{"type":"integer","minimum":1,"maximum":500,"default":100},"offset":{"type":"integer","minimum":0,"default":0}},"required":["op","collection_ids"]},"media_batch_list_meta":{"type":"object","description":"List media across multiple owned collections in one request (max 30 ids). Supports the same limit/offset as media.list on the combined result set. Required scope: `media:read`."},"media_copy":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.copy"},"media_id":{"type":"integer","minimum":1},"target_collection_id":{"type":"integer","minimum":1},"name":{"type":"string","maxLength":180},"position":{"type":"integer","minimum":0},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","media_id","target_collection_id"]},"media_copy_meta":{"type":"object","description":"Duplicate one owned media row into another owned collection (same URLs; new row id). Required scope: `media:write`."},"media_create":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.create"},"collection_id":{"type":"integer","minimum":1},"source_url":{"type":"string"},"viewer":{"type":"string","enum":["audio","code","file","html","image","markdown","microsoft","pdf","text","video","web","website"]},"name":{"type":"string","maxLength":180},"description":{"type":"string","maxLength":4000},"position":{"type":"integer","minimum":0},"type":{"type":"string","format":"mime"},"thumbnail_url":{"type":"string","format":"url"},"tags":{"type":"array","items":{"type":"string"}},"is_nsfw":{"type":"boolean","default":false},"screenshot_url":{"type":"string","format":"url"},"background_image_url":{"type":"string","format":"url"},"locked_for_collaborators":{"type":"boolean","default":false},"subcollection_collection_id":{"type":"integer","minimum":1,"nullable":true}},"required":["op","collection_id","source_url","viewer"]},"media_create_meta":{"type":"object","description":"Create a media row in an owned collection. viewer controls whether URL is treated as website link or ingested to R2. YouTube/Vimeo URLs are always stored as website links (external embed) even if viewer is video. Website items without thumbnail_url get OG image auto-fetched for carousel thumbnail. Required scope: `media:write`."},"media_delete":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.delete"},"media_id":{"type":"integer","minimum":1},"media_ids":{"type":"array","items":{"type":"integer"}},"mode":{"type":"string","enum":["soft","hard"],"default":"hard"},"confirm":{"type":"boolean","default":false},"dry_run":{"type":"boolean","default":false},"idempotency_key":{"type":"string","maxLength":128}},"required":["op"]},"media_delete_meta":{"type":"object","description":"Delete owned media: hard (row delete, default, matches in-app) or soft (is_deleted). Batch via media_ids. Required scope: `media:delete`."},"media_describe":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.describe"},"media_id":{"type":"integer","minimum":1}},"required":["op","media_id"]},"media_describe_meta":{"type":"object","description":"Return full metadata for one readable media item, including resolved proxy URLs and inferred viewer information. Proxy URLs require Zegazone bearer auth — use media.download_url for a fetchable URL. Required scope: `media:read`."},"media_download":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.download"},"media_id":{"type":"integer","minimum":1},"as_attachment":{"type":"boolean","default":false},"file_name":{"type":"string"}},"required":["op","media_id"]},"media_download_meta":{"type":"object","description":"Download private R2-backed media bytes with OAuth bearer auth. Required scope: `media:read`."},"media_download_url":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.download_url"},"media_id":{"type":"integer","minimum":1},"expires_in":{"type":"integer","minimum":1,"maximum":3600,"default":300}},"required":["op","media_id"]},"media_download_url_meta":{"type":"object","description":"Mint a short-lived proxied download URL on api.zegaphone.com for a readable media item. Token is embedded in the URL — no bearer auth required for fetch. Required scope: `media:read`."},"media_get":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.get"},"media_id":{"type":"integer","minimum":1}},"required":["op","media_id"]},"media_get_meta":{"type":"object","description":"Fetch one media row by id when the token subject can read its parent collection. Required scope: `media:read`."},"media_get_upload_url":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.get_upload_url"},"collection_id":{"type":"integer","minimum":1},"filename":{"type":"string","maxLength":180},"content_type":{"type":"string","format":"mime"},"purpose":{"type":"string","enum":["media","thumbnail","cover"],"default":"media"}},"required":["op","collection_id","filename","content_type"]},"media_get_upload_url_meta":{"type":"object","description":"Mint a presigned R2 PUT URL for uploading file bytes directly (agents/MCP). After PUT with purpose=thumbnail, set thumbnail_url on the media row then call media.thumbnail_finalize to GCF-resize (200px thumb + 800px background). Do NOT use collections.get_upload_url for media thumbnails. Required scope: `media:write`."},"media_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.list"},"collection_id":{"type":"integer","minimum":1},"tag":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"name_contains":{"type":"string"},"description_contains":{"type":"string"},"type":{"type":"string"},"viewer":{"type":"string","enum":["audio","code","file","html","image","markdown","microsoft","pdf","text","video","web","website"]},"created_after":{"type":"string","format":"date-time"},"created_before":{"type":"string","format":"date-time"},"is_nsfw":{"type":"boolean"},"include_archived":{"type":"boolean","default":false},"limit":{"type":"integer","minimum":1,"maximum":500,"default":100},"offset":{"type":"integer","minimum":0,"default":0}},"required":["op"]},"media_list_meta":{"type":"object","description":"List media rows in accessible collections with optional filters. Required scope: `media:read`."},"media_move":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.move"},"target_collection_id":{"type":"integer","minimum":1},"media_id":{"type":"integer","minimum":1},"media_ids":{"type":"array","items":{"type":"integer"}},"position":{"type":"integer","minimum":0},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","target_collection_id"]},"media_move_meta":{"type":"object","description":"Move one or more owned media rows into another owned collection; optional start position. Required scope: `media:write`."},"media_reorder":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.reorder"},"collection_id":{"type":"integer","minimum":1},"ordered_media_ids":{"type":"array","items":{"type":"integer"}},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","collection_id","ordered_media_ids"]},"media_reorder_meta":{"type":"object","description":"Renumber positions 0..n-1 for all non-deleted media in one owned collection. Required scope: `media:write`."},"media_replace":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.replace"},"media_id":{"type":"integer","minimum":1},"source_url":{"type":"string","format":"url"},"viewer":{"type":"string","enum":["audio","code","file","html","image","markdown","microsoft","pdf","text","video","web","website"]},"name":{"type":"string","maxLength":180},"type":{"type":"string","format":"mime"},"thumbnail_url":{"type":"string","format":"url"},"subcollection_collection_id":{"type":"integer","minimum":1,"nullable":true}},"required":["op","media_id","source_url","viewer"]},"media_replace_meta":{"type":"object","description":"Replace the main content of an owned media item: same ingestion rules as media.create (website = external main_url; otherwise download to R2, raster images run the GCF pipeline). Optional name/type/thumbnail_url updates. Required scope: `media:write`."},"media_restore":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.restore"},"media_id":{"type":"integer","minimum":1},"confirm":{"type":"boolean","default":false},"dry_run":{"type":"boolean","default":false},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","media_id"]},"media_restore_meta":{"type":"object","description":"Restore owned soft-deleted media (is_deleted = false). Required scope: `media:write`."},"media_search":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.search"},"query":{"type":"string","minLength":1},"collection_id":{"type":"integer","minimum":1},"include_archived":{"type":"boolean","default":false},"limit":{"type":"integer","minimum":1,"maximum":500,"default":100},"offset":{"type":"integer","minimum":0,"default":0}},"required":["op","query"]},"media_search_meta":{"type":"object","description":"Search accessible media by name, description, and tags (ILIKE + tag overlap). Optional collection_id scopes to one collection. Required scope: `media:read`."},"media_text_note_add":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.text_note.add"},"collection_id":{"type":"integer","minimum":1},"text":{"type":"string","maxLength":524288},"body":{"type":"string","maxLength":524288},"name":{"type":"string","maxLength":180},"display_mode":{"type":"string","enum":["plain","markdown","code"],"default":"plain"},"viewer":{"type":"string","enum":["text","markdown","code"]},"description":{"type":"string","maxLength":4000},"position":{"type":"integer","minimum":0},"thumbnail_url":{"type":"string","format":"url"},"thumbnail_position":{"type":"integer","minimum":0},"subcollection_collection_id":{"type":"integer","minimum":1,"nullable":true}},"required":["op","collection_id"]},"media_text_note_add_meta":{"type":"object","description":"Create an inline text-note media row (`text_note` body, `main_url` = inline://text-note). Same storage as app “text note” uploads; no R2 object. Rendering: set `display_mode` (plain|markdown|code) or `viewer` (text|markdown|code); `text` is an alias for plain. If both are sent, they must agree (plain↔text). Required scope: `media:write`."},"media_text_note_delete":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.text_note.delete"},"media_id":{"type":"integer","minimum":1},"force":{"type":"boolean","default":false}},"required":["op","media_id"]},"media_text_note_delete_meta":{"type":"object","description":"Delete one owned inline text-note media row (`main_url` = inline://text-note). Required scope: `media:write`."},"media_text_note_get":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.text_note.get"},"media_id":{"type":"integer","minimum":1}},"required":["op","media_id"]},"media_text_note_get_meta":{"type":"object","description":"Read `text_note` and metadata for one inline text-note media row (`main_url` = inline://text-note). Caller must have read access to the parent collection. Required scope: `media:read`."},"media_text_note_update":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.text_note.update"},"media_id":{"type":"integer","minimum":1},"text":{"type":"string","maxLength":524288},"body":{"type":"string","maxLength":524288},"name":{"type":"string","maxLength":180},"display_mode":{"type":"string","enum":["plain","markdown","code"],"default":"plain"},"viewer":{"type":"string","enum":["text","markdown","code"]},"description":{"type":"string","maxLength":4000,"nullable":true},"thumbnail_url":{"type":"string","format":"url"},"thumbnail_position":{"type":"integer","minimum":0}},"required":["op","media_id"]},"media_text_note_update_meta":{"type":"object","description":"Update `text_note` content (and optional display/name/description) for one owned inline text-note media row. Omitted `display_mode` and `viewer` leave type/viewer unchanged. Same display rules as `media.text_note.add`. Required scope: `media:write`."},"media_thumbnail_finalize":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.thumbnail_finalize"},"media_id":{"type":"integer","minimum":1}},"required":["op","media_id"]},"media_thumbnail_finalize_meta":{"type":"object","description":"After uploading raw image bytes via media.get_upload_url (purpose=thumbnail) and setting thumbnail_url on the media row, call this to GCF-resize to 200px WebP carousel thumb + 800px background in R2 and update thumbnail_url + background_image_url. Also runs automatically when media.create/update sets an r2:// thumbnail key. Required scope: `media:write`."},"media_thumbnail_uploaded":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.thumbnail_uploaded"},"media_id":{"type":"integer","minimum":1},"thumbnail_url":{"type":"string"}},"required":["op","media_id"]},"media_thumbnail_uploaded_meta":{"type":"object","description":"Deprecated alias for media.thumbnail_finalize. After PUT bytes to media.get_upload_url (purpose=thumbnail), sets thumbnail_url if provided then runs GCF finalize (200px WebP thumb + 800px background). Prefer media.thumbnail_finalize. Required scope: `media:write`."},"media_unarchive":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.unarchive"},"media_id":{"type":"integer","minimum":1},"idempotency_key":{"type":"string","maxLength":128}},"required":["op","media_id"]},"media_unarchive_meta":{"type":"object","description":"Set is_archived=false on owned media. Required scope: `media:write`."},"media_update":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"media.update"},"media_id":{"type":"integer","minimum":1},"name":{"type":"string","maxLength":180},"description":{"type":"string","maxLength":4000,"nullable":true},"position":{"type":"integer","minimum":0},"is_nsfw":{"type":"boolean"},"thumbnail_url":{"type":"string","format":"url","nullable":true},"viewer":{"type":"string","enum":["audio","code","file","html","image","markdown","microsoft","pdf","text","video","web","website"]},"type":{"type":"string","format":"mime"},"tags":{"type":"array","items":{"type":"string"}},"text_note":{"type":"string","maxLength":524288},"display_mode":{"type":"string","enum":["plain","markdown","code"],"default":"plain"},"screenshot_url":{"type":"string","format":"url","nullable":true},"background_image_url":{"type":"string","format":"url","nullable":true},"locked_for_collaborators":{"type":"boolean"},"subcollection_collection_id":{"type":"integer","minimum":1,"nullable":true}},"required":["op","media_id"]},"media_update_meta":{"type":"object","description":"Update fields on an existing owned media row. When thumbnail_url is set to an r2:// key from media.get_upload_url, the server auto-runs media.thumbnail_finalize (GCF 200px thumb + 800px background). After uploading via media.get_upload_url, you must call media.thumbnail_finalize if not setting thumbnail_url here. Do NOT use collections.get_upload_url for media thumbnails. Required scope: `media:write`."},"operation_describe":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"operation.describe"},"name":{"type":"string"}},"required":["op","name"]},"operation_describe_meta":{"type":"object","description":"Return the schema.request entry for one operation name (from schema.get.operations). No OAuth scope required."},"operations_list":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"operations.list"}},"required":["op"]},"operations_list_meta":{"type":"object","description":"List thirdparty-v1 operation names and required OAuth scopes (compact). No OAuth scope required."},"ping":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"ping"}},"required":["op"]},"ping_meta":{"type":"object","description":"Health/auth sanity check for the current access token. No OAuth scope required."},"profile_get":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"profile.get"}},"required":["op"]},"profile_get_meta":{"type":"object","description":"Get the token subject profile (username, display name, follower counts, bio, aliases). No OAuth scope required."},"profile_update":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"profile.update"},"display_name":{"type":"string","nullable":true},"bio":{"type":"string","maxLength":4000,"nullable":true},"idempotency_key":{"type":"string","maxLength":128}},"required":["op"]},"profile_update_meta":{"type":"object","description":"Update display_name (profiles.full_name) and/or bio (app_settings.about_you). Required scope: `profile:write`."},"schema_get":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"schema.get"}},"required":["op"]},"schema_get_meta":{"type":"object","description":"Returns this API schema contract for tooling and bots. No OAuth scope required."},"ui_state_get":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"ui.state.get"}},"required":["op"]},"ui_state_get_meta":{"type":"object","description":"Return the latest synchronized UI state for the token subject. Required scope: `collections:read + media:read`."},"ui_state_set":{"type":"object","additionalProperties":false,"properties":{"op":{"type":"string","const":"ui.state.set"},"collection_id":{"type":"integer","minimum":1,"nullable":true},"media_id":{"type":"integer","minimum":1,"nullable":true},"source":{"type":"string","default":"agent"},"agent_id":{"type":"string","nullable":true},"view_mode":{"type":"string","enum":["carousel","grid"],"nullable":true},"fullscreen":{"type":"boolean"},"collections_panel_open":{"type":"boolean"},"playback_position":{"type":"number","minimum":0,"nullable":true},"browse_results":{"type":"string","nullable":true},"browse_title":{"type":"string","nullable":true},"browse_source":{"type":"string","nullable":true}},"required":["op"]},"ui_state_set_meta":{"type":"object","description":"Persist and broadcast the active UI selection, player chrome, and agent browse grid for the token subject. Required scope: `collections:read + media:read`."}},"securitySchemes":{"thirdPartyOAuth":{"type":"oauth2","description":"OAuth 2.0 PKCE via Zegazone. See /api-docs for pairing instructions.","flows":{"authorizationCode":{"authorizationUrl":"https://www.zegazone.com/?oauth=1","tokenUrl":"https://api.zegaphone.com/functions/v1/thirdparty-oauth-token","scopes":{"collections:read":"Read collections","collections:write":"Create and update collections","collections:delete":"Delete collections","media:read":"Read media","media:write":"Create and update media","media:delete":"Delete media","profile:write":"Update profile","collaborators:write":"Manage collaborators"}}}}}},"externalDocs":{"description":"API documentation","url":"https://www.zegazone.com/api-docs"}}