{"ok":true,"apiVersion":"v1","app":{"id":"marketplace","name":"Marketplace","version":"0.1.0"},"timestamp":"2026-07-29T12:18:19.302Z","data":{"openapi":"3.1.0","info":{"title":"Marketplace API","version":"0.1.0","description":"Digital asset marketplace API for creating, listing, selling, and analyzing digital assets."},"servers":[{"url":"https://fjozfegsxseblmpplcrb.supabase.co/functions/v1/api-v1"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key"},"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"StandardSuccessEnvelope":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"apiVersion":{"type":"string"},"app":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"type":"string"}}},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object"}}},"StandardErrorEnvelope":{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"apiVersion":{"type":"string"},"app":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"version":{"type":"string"}}},"timestamp":{"type":"string","format":"date-time"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}},"FeedbackRequest":{"type":"object","required":["title","message","category","severity","source"],"properties":{"title":{"type":"string","maxLength":200,"description":"Feedback title"},"message":{"type":"string","maxLength":5000,"description":"Detailed feedback message"},"category":{"type":"string","enum":["bug","feature_request","improvement","integration_request","support","other"],"description":"Feedback category"},"severity":{"type":"string","enum":["low","medium","high","critical"],"description":"Severity level"},"source":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["user","app","agent","external"],"description":"Source type"},"appId":{"type":"string","nullable":true,"description":"Source application ID"},"userId":{"type":"string","nullable":true,"description":"Source user ID"}}},"target":{"type":"object","nullable":true,"properties":{"appId":{"type":"string","nullable":true,"description":"Target application ID"},"capabilityId":{"type":"string","nullable":true,"description":"Target capability ID"},"path":{"type":"string","nullable":true,"description":"Target API path"}}},"context":{"type":"object","nullable":true,"properties":{"requestId":{"type":"string","nullable":true,"description":"Related request ID"},"environment":{"type":"string","nullable":true,"description":"Environment (e.g. production, staging)"},"url":{"type":"string","nullable":true,"description":"Related URL"},"metadata":{"type":"object","description":"Arbitrary metadata object"}}}}},"AssetCategory":{"type":"string","enum":["prompt_pack","skill_pack","harness_pack"],"description":"Valid asset category"},"AssetStatus":{"type":"string","enum":["draft","published","archived"],"description":"Asset lifecycle status"},"FulfillmentType":{"type":"string","enum":["downloadable_file","downloadable_json","downloadable_csv","private_asset_page","package_export","manual"],"description":"How the asset is delivered"},"OrderStatus":{"type":"string","enum":["pending","paid","refunded"],"description":"Order payment status"},"SortField":{"type":"string","enum":["created_at","updated_at","title","price"],"description":"Sortable field name"},"CreateAssetRequest":{"type":"object","required":["title","slug","price"],"properties":{"title":{"type":"string","minLength":1,"maxLength":200,"description":"Asset title"},"slug":{"type":"string","minLength":1,"maxLength":200,"description":"URL-safe slug (must be unique)"},"price":{"type":"integer","minimum":0,"description":"Price in cents (e.g. 999 = $9.99)"},"category":{"$ref":"#/components/schemas/AssetCategory","default":"prompt_pack"},"short_description":{"type":"string","maxLength":500,"description":"Brief description"},"full_description":{"type":"string","maxLength":5000,"description":"Full description"},"tags":{"type":"array","items":{"type":"string"},"description":"Array of string tags"},"audience":{"type":"string","description":"Target audience description"},"fulfillment_type":{"$ref":"#/components/schemas/FulfillmentType","default":"downloadable_file"},"payload":{"type":"object","description":"Arbitrary JSON payload for asset content"},"metadata":{"type":"object","description":"Arbitrary JSON metadata"},"preview_image_url":{"type":"string","format":"uri","description":"URL to a preview image"}}},"UpdateAssetRequest":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200,"description":"Updated title"},"slug":{"type":"string","minLength":1,"maxLength":200,"description":"Updated slug"},"price":{"type":"integer","minimum":0,"description":"Updated price in cents"},"status":{"$ref":"#/components/schemas/AssetStatus"},"category":{"$ref":"#/components/schemas/AssetCategory"},"fulfillment_type":{"$ref":"#/components/schemas/FulfillmentType"},"short_description":{"type":"string","maxLength":500,"description":"Updated brief description"},"full_description":{"type":"string","maxLength":5000,"description":"Updated full description"},"tags":{"type":"array","items":{"type":"string"},"description":"Updated tags"},"audience":{"type":"string","description":"Updated target audience"},"payload":{"type":"object","description":"Updated JSON payload"},"metadata":{"type":"object","description":"Updated JSON metadata"},"preview_image_url":{"type":"string","format":"uri","description":"Updated preview image URL"}}},"CheckoutRequest":{"type":"object","required":["asset_id"],"properties":{"asset_id":{"type":"string","format":"uuid","description":"UUID of the published asset to purchase"}}},"AnalyticsResponse":{"type":"object","properties":{"total_assets":{"type":"integer","description":"Total number of assets owned by the user"},"published_assets":{"type":"integer","description":"Number of published assets"},"total_purchases":{"type":"integer","description":"Total completed purchases across all assets"},"total_revenue":{"type":"integer","description":"Total revenue in cents from completed purchases"},"total_pending":{"type":"integer","description":"Total pending orders"},"total_pending_revenue":{"type":"integer","description":"Total pending revenue in cents"},"assets":{"type":"array","items":{"type":"object","properties":{"asset_id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string"},"category":{"$ref":"#/components/schemas/AssetCategory"},"status":{"$ref":"#/components/schemas/AssetStatus"},"price":{"type":"integer"},"purchases":{"type":"integer"},"gross_revenue":{"type":"integer"},"pending_count":{"type":"integer"},"pending_revenue":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}}}}}},"paths":{"/health":{"get":{"summary":"Health check","description":"Quick machine-readable health check. No auth required.","tags":["Standard"],"security":[],"responses":{"200":{"description":"Healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}}}}},"/manifest":{"get":{"summary":"API manifest","description":"Machine-readable discovery document for apps and AI agents. No auth required.","tags":["Standard"],"security":[],"responses":{"200":{"description":"Manifest","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}}}}},"/openapi.json":{"get":{"summary":"OpenAPI specification","description":"Formal OpenAPI 3.1.0 JSON spec. No auth required.","tags":["Standard"],"security":[],"responses":{"200":{"description":"OpenAPI JSON","content":{"application/json":{}}}}}},"/assets":{"get":{"summary":"List assets","description":"Paginated list of assets. Supports cursor, category, status, tag, sort, order, limit params.","tags":["Assets"],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":25,"minimum":1,"maximum":100},"description":"Max items to return"},{"name":"cursor","in":"query","schema":{"type":"string","format":"uuid"},"description":"Pagination cursor (UUID of last item)"},{"name":"category","in":"query","schema":{"$ref":"#/components/schemas/AssetCategory"},"description":"Filter by asset category"},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/AssetStatus","default":"published"},"description":"Filter by asset status"},{"name":"tag","in":"query","schema":{"type":"string"},"description":"Filter by tag (exact match)"},{"name":"sort","in":"query","schema":{"$ref":"#/components/schemas/SortField","default":"created_at"},"description":"Sort field"},{"name":"order","in":"query","schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"description":"Sort direction"}],"responses":{"200":{"description":"Asset list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}}}},"post":{"summary":"Create asset","description":"Create a new digital asset in draft status. Requires assets:write scope.","tags":["Assets"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAssetRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}}}}},"/assets/{id}":{"get":{"summary":"Get asset","description":"Get a single asset by UUID.","tags":["Assets"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}}}},"patch":{"summary":"Update asset","description":"Partial update of an asset you own. Requires assets:write scope.","tags":["Assets"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Asset UUID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAssetRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}}}}},"/listings":{"get":{"summary":"List listings","description":"Paginated published marketplace listings.","tags":["Listings"],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":25}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"featured","in":"query","schema":{"type":"string","enum":["true","false"]}}],"responses":{"200":{"description":"Listing list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}}}}},"/listings/{slug}":{"get":{"summary":"Get listing","description":"Get a single listing by slug with its associated asset.","tags":["Listings"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Listing with asset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}}}}},"/orders":{"get":{"summary":"List orders","description":"Paginated orders for the authenticated user. PII is redacted.","tags":["Orders"],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":25,"minimum":1,"maximum":100},"description":"Max items to return"},{"name":"cursor","in":"query","schema":{"type":"string","format":"date-time"},"description":"Pagination cursor (created_at ISO timestamp)"},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/OrderStatus"},"description":"Filter by order status"}],"responses":{"200":{"description":"Order list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}}}}},"/orders/{id}":{"get":{"summary":"Get order","description":"Get a single order by UUID.","tags":["Orders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}}}}},"/checkout":{"post":{"summary":"Create checkout","description":"Create a Stripe checkout session. Rate limited to 10/min. Requires checkout:create scope.","tags":["Checkout"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutRequest"}}}},"responses":{"201":{"description":"Checkout session created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}}}}},"/feedback":{"post":{"summary":"Submit feedback","description":"Submit a structured bug report, feature request, improvement, support request, or app-to-app integration request.","tags":["Standard"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackRequest"}}}},"responses":{"201":{"description":"Feedback submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}}}}},"/analytics":{"get":{"summary":"Get analytics","description":"Returns full marketplace analytics: totals and per-asset breakdowns of purchases, revenue, and pending orders. Requires analytics:read scope.","tags":["Analytics"],"responses":{"200":{"description":"Analytics summary","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/StandardSuccessEnvelope"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AnalyticsResponse"}}}]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}}}}},"/purchases":{"get":{"summary":"List purchases","description":"Paginated list of the authenticated user's purchased assets with asset metadata. Requires purchases:read scope.","tags":["Purchases"],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":25,"minimum":1,"maximum":100},"description":"Max items to return"},{"name":"cursor","in":"query","schema":{"type":"string","format":"uuid"},"description":"Pagination cursor (UUID of last purchase)"}],"responses":{"200":{"description":"Purchase list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}}}}},"/purchases/{id}":{"get":{"summary":"Get purchase","description":"Returns a single purchase by ID with full asset and order details. Requires purchases:read scope.","tags":["Purchases"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Purchase UUID"}],"responses":{"200":{"description":"Purchase with asset and order details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}}}}},"/purchases/{id}/download":{"get":{"summary":"Get purchase download","description":"Returns a signed download URL or inline payload for a purchased asset. Requires purchases:read scope.","tags":["Purchases"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Purchase UUID"}],"responses":{"200":{"description":"Download URL or payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardSuccessEnvelope"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StandardErrorEnvelope"}}}}}}}}}}