{"openapi":"3.1.0","info":{"title":"Inverity API","version":"1","description":"REST API for the Inverity media optimization platform. Compress, convert, and deliver images and video programmatically. The Truth in Every Pixel.","contact":{"name":"Inverity Support","url":"https://inverity.ai","email":"support@inverity.ai"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://api.inverity.ai","description":"Production"}],"tags":[{"name":"Health","description":"Service liveness"},{"name":"Auth","description":"Session and OAuth"},{"name":"Account","description":"Portal account and plan management"},{"name":"Assets","description":"Asset upload, optimization, download, versioning"},{"name":"Jobs","description":"Async job tracking and retry"},{"name":"Reports","description":"Optimization summary and statistics"},{"name":"Analytics","description":"DAM analytics summary (manager role)"},{"name":"Workflows","description":"DAM workflow definitions under /v1/dam/workflows (viewer read, manager write). Not the HubSpot custom-action endpoints under /v1/workflows."},{"name":"Settings","description":"Governance policy"},{"name":"Profiles","description":"Optimization profile catalogue"},{"name":"Scan","description":"Bulk scan findings"},{"name":"Audit","description":"Immutable audit log"}],"components":{"securitySchemes":{"BearerSession":{"type":"http","scheme":"bearer","description":"Signed session token returned by the OAuth callback or your internal token mint."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"oneOf":[{"type":"string"},{"type":"object"}]}}},"AssetStatus":{"type":"string","enum":["uploaded","queued","optimized","warn","failed","skipped","replaced","rolled_back"]},"OptimizationProfile":{"type":"string","enum":["visually_lossless","website_balanced","website_aggressive","blog_content","email_safe","social","transparent_graphics","archive_safe"]},"CodecBackend":{"type":"string","enum":["source","classical","learned_entropy","neural_lossless","end_to_end_neural"]},"DeliveryVariantPreset":{"type":"string","enum":["web","email","social"]},"ActorRole":{"type":"string","enum":["viewer","editor","manager","admin","super_admin"]},"JobStatus":{"type":"string","enum":["queued","running","completed","failed","partial","retrying"]},"JobType":{"type":"string","enum":["upload","video_prepare","optimize","scan","replace","rollback","workflow"]},"Asset":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"mimeType":{"type":"string"},"cmsFileId":{"type":["string","null"]},"folderPath":{"type":["string","null"]},"width":{"type":["number","null"]},"height":{"type":["number","null"]},"originalSizeBytes":{"type":"number"},"optimizedSizeBytes":{"type":["number","null"]},"savingsBytes":{"type":["number","null"]},"savingsPercent":{"type":["number","null"]},"profile":{"oneOf":[{"$ref":"#/components/schemas/OptimizationProfile"},{"type":"null"}]},"status":{"$ref":"#/components/schemas/AssetStatus"},"codecBackend":{"$ref":"#/components/schemas/CodecBackend"},"modelVersion":{"type":["string","null"]},"aiTags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"AssetVersion":{"type":"object","properties":{"id":{"type":"string"},"assetId":{"type":"string"},"kind":{"type":"string","enum":["original","optimized","replacement","rollback"]},"objectKey":{"type":"string"},"format":{"type":"string"},"cmsFileId":{"type":["string","null"]},"sizeBytes":{"type":"number"},"width":{"type":["number","null"]},"height":{"type":["number","null"]},"savingsBytes":{"type":["number","null"]},"savingsPercent":{"type":["number","null"]},"codecBackend":{"$ref":"#/components/schemas/CodecBackend"},"qaStatus":{"type":"string","enum":["pending","pass","warn","fail"]},"createdAt":{"type":"string","format":"date-time"}}},"Job":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"status":{"$ref":"#/components/schemas/JobStatus"},"type":{"$ref":"#/components/schemas/JobType"},"assetIds":{"type":"array","items":{"type":"string"}},"processedCount":{"type":"number"},"failedCount":{"type":"number"},"retryCount":{"type":"number"},"attemptCount":{"type":"number"},"queueName":{"type":"string"},"terminalFailureReason":{"type":["string","null"]},"terminalFailedAt":{"type":["string","null"],"format":"date-time"},"lastAttemptedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"errors":{"type":"array","items":{"type":"string"}}}},"JobRef":{"type":"object","required":["jobId","assetIds"],"properties":{"jobId":{"type":"string"},"assetIds":{"type":"array","items":{"type":"string"}}}},"UploadJobRef":{"type":"object","required":["jobId","assetIds","optimizeOnUpload"],"properties":{"jobId":{"type":["string","null"],"description":"null when every file matched an asset already in the library (nothing to process)."},"assetIds":{"type":"array","items":{"type":"string"}},"optimizeOnUpload":{"type":"boolean","description":"What this upload ran with: the request's optimizeOnUpload, else the account default. false = stored exactly as uploaded, no charge."}}},"OptimizeJobRef":{"type":"object","required":["jobId","assetIds"],"properties":{"jobId":{"type":"string"},"assetIds":{"type":"array","items":{"type":"string"},"description":"The ids queued for optimization (videos are not among them)."},"refused":{"type":"array","description":"Present when some selected assets were not queued. Each has code video_optimize_later_unsupported: video can't be optimized after upload yet.","items":{"type":"object","required":["assetId","code"],"properties":{"assetId":{"type":"string"},"code":{"type":"string","enum":["video_optimize_later_unsupported"]}}}}}},"DeliveryVariant":{"type":"object","properties":{"preset":{"$ref":"#/components/schemas/DeliveryVariantPreset"},"objectKey":{"type":"string"},"width":{"type":"number"},"height":{"type":"number"},"format":{"type":"string"},"fileSizeBytes":{"type":"number"},"codecBackend":{"$ref":"#/components/schemas/CodecBackend"},"requestedCodecBackend":{"$ref":"#/components/schemas/CodecBackend"},"qualityMetrics":{"type":["object","null"],"properties":{"ssim":{"type":"number"},"peakSignalToNoiseRatioDb":{"type":"number"},"meanAbsoluteError":{"type":"number"}}},"fallbackObjectKey":{"type":["string","null"]},"fallbackFormat":{"type":["string","null"]}}},"WorkflowGraph":{"type":"object","required":["nodes","edges"],"description":"A directed acyclic graph of action nodes. Validated on write: node ids must be unique, every edge endpoint must name an existing node, self-edges and duplicate edges are rejected, exactly one node must have no incoming edge, every node must be reachable from it, and the serialized document must not exceed 65536 bytes.","properties":{"nodes":{"type":"array","maxItems":64,"items":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","minLength":1,"maxLength":64},"type":{"type":"string","enum":["brand_compliance","add_to_collection"]},"config":{"type":"object","description":"Scalar values only (string, number, boolean, null).","additionalProperties":{"type":["string","number","boolean","null"]}}}}},"edges":{"type":"array","maxItems":256,"items":{"type":"object","required":["from","to"],"properties":{"from":{"type":"string","minLength":1,"maxLength":64},"to":{"type":"string","minLength":1,"maxLength":64}}}}}},"Workflow":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["draft","active","paused"]},"triggerType":{"type":"string","enum":["asset.uploaded"]},"triggerConfig":{"type":"object"},"graph":{"$ref":"#/components/schemas/WorkflowGraph"},"version":{"type":"integer","description":"Incremented whenever the definition (graph or trigger) changes; a name- or status-only edit leaves it alone."},"createdBy":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"WorkflowCreateRequest":{"type":"object","required":["name","triggerType","graph"],"properties":{"name":{"type":"string","minLength":1,"maxLength":200},"status":{"type":"string","enum":["draft","active","paused"]},"triggerType":{"type":"string","enum":["asset.uploaded"],"description":"The only trigger with a live hook point today. Others are rejected rather than accepted and silently never fired."},"triggerConfig":{"type":"object"},"graph":{"$ref":"#/components/schemas/WorkflowGraph"}}},"WorkflowUpdateRequest":{"type":"object","description":"Partial update. Omitted fields are left unchanged.","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"status":{"type":"string","enum":["draft","active","paused"]},"triggerType":{"type":"string","enum":["asset.uploaded"]},"triggerConfig":{"type":"object"},"graph":{"$ref":"#/components/schemas/WorkflowGraph"}}}},"responses":{"Unauthorized":{"description":"Missing or invalid session token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"Caller's role does not meet the minimum required for this endpoint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Resource not found, or belongs to a different tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"UnprocessableEntity":{"description":"Validation or policy violation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit or concurrency cap reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"security":[{"BearerSession":[]}],"paths":{"/health":{"get":{"tags":["Health"],"summary":"Service liveness","operationId":"getHealth","security":[],"responses":{"200":{"description":"Service is alive","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"}}}}}}}}},"/v1/session":{"get":{"tags":["Auth"],"summary":"Get current session","operationId":"getSession","responses":{"200":{"description":"Current session context","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"tenantId":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","system","workflow"]},"role":{"$ref":"#/components/schemas/ActorRole"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/assets":{"get":{"tags":["Assets"],"summary":"List or search assets","description":"With no query parameters this returns the tenant's full asset list, unchanged and unpaginated. Sending any parameter below opts in to server-side filtering and keyset pagination, and adds nextCursor/hasMore to the response.","operationId":"listAssets","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200},"description":"Case-insensitive substring match over asset name, AI tags and AI alt text."},{"name":"type","in":"query","required":false,"schema":{"type":"string","enum":["image","video","audio","document"]},"description":"Mime-family filter. Any other value (including \"all\") means no filter."},{"name":"mimeType","in":"query","required":false,"schema":{"type":"string"},"description":"Exact MIME type (image/png) or prefix (image/)."},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"Exact match on the stored asset status."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500},"description":"Page size. Omit for an unpaginated result."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque keyset cursor from a previous response's nextCursor."}],"responses":{"200":{"description":"Asset list for the authenticated tenant","content":{"application/json":{"schema":{"type":"object","properties":{"assets":{"type":"array","items":{"$ref":"#/components/schemas/Asset"}},"nextCursor":{"type":"string","nullable":true,"description":"Cursor for the next page, or null on the last page. Absent when no query parameters were sent."},"hasMore":{"type":"boolean","description":"True when nextCursor is set. Absent when no query parameters were sent."}}}}}},"400":{"description":"Invalid query parameter (bad limit or malformed cursor)."},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/uploads":{"post":{"tags":["Assets"],"summary":"Upload images (optimized, or stored as uploaded when optimization is off)","operationId":"uploadAssets","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["files"],"properties":{"files":{"type":"array","items":{"type":"string","format":"binary"},"description":"Image files (JPEG, PNG, WebP, AVIF). Max 20 MB/file."},"profile":{"$ref":"#/components/schemas/OptimizationProfile"},"replaceMode":{"type":"string","enum":["parallel","replace"],"default":"parallel"},"optimizeOnUpload":{"type":"string","enum":["true","false"],"description":"Optimize this upload. Absent means use the account default (GET /v1/settings/upload-optimization). \"false\" stores the files exactly as uploaded: no optimized copy, no transcode, no token charge; the asset ends 'skipped' with optimizationDecision 'skipped_by_user'."}}}}}},"responses":{"202":{"description":"Upload accepted. The job optimizes the files, or stores them as uploaded when optimizeOnUpload is false.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadJobRef"}}}},"400":{"description":"No files provided or invalid profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"description":"Batch exceeds plan limits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/videos/upload":{"post":{"tags":["Assets"],"summary":"Upload videos (transcoded, or stored as uploaded when optimization is off)","operationId":"uploadVideos","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["files"],"properties":{"files":{"type":"array","items":{"type":"string","format":"binary"},"description":"Video files. Size and count limits come from the plan's video entitlement."},"profile":{"type":"string","enum":["visually_lossless","website_balanced","website_aggressive","blog_content","email_safe","social","transparent_graphics","archive_safe"],"default":"website_balanced","description":"Encoding profile. An unknown value falls back to website_balanced."},"optimizeOnUpload":{"type":"string","enum":["true","false"],"description":"Transcode this upload. Absent means use the account default (GET /v1/settings/upload-optimization). \"false\" stores each video exactly as uploaded: no transcode, no token charge; the malware scan, preview and embed still run. MOV, WebM and MKV files, and HEVC MP4s, kept as uploaded may not play in every browser."}}}}}},"responses":{"202":{"description":"Upload accepted and video job queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadJobRef"}}}},"400":{"description":"No video files, or an invalid optimizeOnUpload value","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"description":"Exceeds the plan's video limits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Unsupported video type or container","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"423":{"description":"The account is being deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/assets/optimize":{"post":{"tags":["Assets"],"summary":"Optimize existing assets","operationId":"optimizeAssets","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["assetIds"],"properties":{"assetIds":{"type":"array","items":{"type":"string"},"minItems":1},"profile":{"$ref":"#/components/schemas/OptimizationProfile"},"replaceMode":{"type":"string","enum":["parallel","replace"],"default":"parallel"}}}}}},"responses":{"202":{"description":"Job queued for the selected images. Videos in the selection are not queued; they are listed in refused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptimizeJobRef"}}}},"400":{"description":"Validation failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"code video_optimize_later_unsupported: every selected asset is a video, and video can't be optimized after upload yet. Nothing was queued; assetIds and refused list the videos.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Batch exceeds plan limits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/assets/scan":{"post":{"tags":["Assets"],"summary":"Scan all assets for optimization opportunities","operationId":"scanAssets","responses":{"200":{"description":"All assets already queued","content":{"application/json":{"schema":{"type":"object","properties":{"jobId":{"type":"null"},"queuedAssetCount":{"type":"number","example":0},"queuedAssetIds":{"type":"array","items":{"type":"string"}}}}}}},"202":{"description":"Scan job queued","content":{"application/json":{"schema":{"type":"object","properties":{"jobId":{"type":"string"},"queuedAssetCount":{"type":"number"},"queuedAssetIds":{"type":"array","items":{"type":"string"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/assets/{assetId}/analyze":{"post":{"tags":["Assets"],"summary":"Dry-run analyze a single asset","operationId":"analyzeAsset","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"profile":{"$ref":"#/components/schemas/OptimizationProfile"}}}}}},"responses":{"200":{"description":"Analysis result","content":{"application/json":{"schema":{"type":"object","properties":{"assetId":{"type":"string"},"profile":{"$ref":"#/components/schemas/OptimizationProfile"},"recommendation":{"type":"object","properties":{"outputFormat":{"type":"string"},"savingsBytes":{"type":"number"},"savingsPercent":{"type":"number"},"skipped":{"type":"boolean"},"skipReason":{"type":["string","null"]},"width":{"type":"number"},"height":{"type":"number"},"assetClass":{"type":"string"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/assets/{assetId}/versions":{"get":{"tags":["Assets"],"summary":"List versions of an asset","operationId":"listAssetVersions","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Version list","content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"type":"array","items":{"$ref":"#/components/schemas/AssetVersion"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/assets/{assetId}/download":{"get":{"tags":["Assets"],"summary":"Download the active version of an asset","operationId":"downloadAsset","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Binary file stream","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/assets/{assetId}/variants/{preset}/generate":{"post":{"tags":["Assets"],"summary":"Generate a delivery variant","operationId":"generateDeliveryVariant","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}},{"name":"preset","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DeliveryVariantPreset"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"preferredBackend":{"type":"string","enum":["classical","end_to_end_neural"]}}}}}},"responses":{"200":{"description":"Generated variant","content":{"application/json":{"schema":{"type":"object","properties":{"variant":{"$ref":"#/components/schemas/DeliveryVariant"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"}}}},"/v1/assets/{assetId}/variants/{preset}/download":{"get":{"tags":["Assets"],"summary":"Download a delivery variant","operationId":"downloadDeliveryVariant","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}},{"name":"preset","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DeliveryVariantPreset"}}],"responses":{"200":{"description":"Binary file stream","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/assets/{assetId}/approval":{"post":{"tags":["Assets"],"summary":"Approve or reject a pending asset version","operationId":"reviewAssetApproval","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["versionId","decision"],"properties":{"versionId":{"type":"string"},"decision":{"type":"string","enum":["approved","rejected"]},"note":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"Updated asset","content":{"application/json":{"schema":{"type":"object","properties":{"asset":{"$ref":"#/components/schemas/Asset"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/assets/{assetId}/rollback":{"post":{"tags":["Assets"],"summary":"Roll back an asset to a previous version","operationId":"rollbackAsset","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"versionId":{"type":"string","description":"Omit to roll back to original"}}}}}},"responses":{"202":{"description":"Rollback job queued","content":{"application/json":{"schema":{"type":"object","properties":{"jobId":{"type":"string"},"asset":{"$ref":"#/components/schemas/Asset"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/assets/{assetId}/sync":{"post":{"tags":["Assets"],"summary":"Force a HubSpot sync for an asset","operationId":"syncAsset","parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Sync job queued","content":{"application/json":{"schema":{"type":"object","properties":{"jobId":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/jobs":{"get":{"tags":["Jobs"],"summary":"List jobs","operationId":"listJobs","parameters":[{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Pagination cursor"},{"name":"status","in":"query","schema":{"$ref":"#/components/schemas/JobStatus"}},{"name":"terminalOnly","in":"query","schema":{"type":"boolean"},"description":"Return only terminal-state jobs"}],"responses":{"200":{"description":"Job list","content":{"application/json":{"schema":{"type":"object","properties":{"jobs":{"type":"array","items":{"$ref":"#/components/schemas/Job"}},"nextCursor":{"type":["string","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/jobs/{jobId}":{"get":{"tags":["Jobs"],"summary":"Get a single job","operationId":"getJob","parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job detail","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/Job"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/jobs/{jobId}/retry":{"post":{"tags":["Jobs"],"summary":"Retry a failed job","operationId":"retryJob","parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","minLength":1,"maxLength":500}}}}}},"responses":{"200":{"description":"Updated job","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/Job"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/v1/reports/summary":{"get":{"tags":["Reports"],"summary":"Optimization summary report","operationId":"getReportSummary","responses":{"200":{"description":"Summary report","content":{"application/json":{"schema":{"type":"object","properties":{"report":{"type":"object","properties":{"totalAssets":{"type":"number"},"optimizedAssets":{"type":"number"},"totalBytesOriginal":{"type":"number"},"totalBytesOptimized":{"type":"number"},"totalBytesSaved":{"type":"number"},"optimizationRate":{"type":"number"},"warnAssets":{"type":"number"},"failedAssets":{"type":"number"},"plan":{"type":"object","properties":{"planKey":{"type":"string"},"planLabel":{"type":"string"},"billingStatus":{"type":"string"},"limits":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"used":{"type":"number"},"included":{"type":"number"},"percentUsed":{"type":"number"}}}}}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/analytics/summary":{"get":{"tags":["Analytics"],"summary":"DAM analytics summary for a window","description":"Phase 7b A-3. Requires the `manager` role, not merely an authenticated viewer: `adoptionHealth` is derived from per-user activity and `topAssets` exposes what the team is working on. HONESTY CONTRACT: counts may legitimately be 0, but every RATIO is nullable and is `null` (never 0) when its denominator is 0, because 'measured zero' and 'not measurable' are different facts. `unmeasured` lists the dotted path of every headline this response could not measure. `window.source` is `live` (audit_logs) for windows up to 85 days and `rollup` (analytics_daily) beyond that, because audit_logs is pruned at 90 days; in `rollup` mode distinct-actor and per-asset figures are reported as unmeasured rather than approximated by summing daily values.","operationId":"getAnalyticsSummary","parameters":[{"name":"window","in":"query","required":false,"description":"Window as `30d`, `12w`, `6m`, or a bare day count. Defaults to 30d, max 400d.","schema":{"type":"string","example":"30d"}}],"responses":{"200":{"description":"Analytics summary","content":{"application/json":{"schema":{"type":"object","properties":{"window":{"type":"object","properties":{"days":{"type":"number"},"since":{"type":"string","format":"date-time"},"until":{"type":"string","format":"date-time"},"eventsSince":{"type":"string","format":"date-time"},"source":{"type":"string","enum":["live","rollup"]}}},"generatedAt":{"type":"string","format":"date-time"},"assetsManaged":{"type":"object","properties":{"total":{"type":"number"},"addedInWindow":{"type":"number"}}},"rightsCompliance":{"type":"object","properties":{"totalAssets":{"type":"number"},"withRights":{"type":"number"},"expiring":{"type":"number"},"expired":{"type":"number"},"cleared":{"type":"number"}}},"rightsIntelligence":{"type":"object","properties":{"totalAssets":{"type":"number"},"withLicenseType":{"type":"number"},"buckets":{"type":"array","items":{"type":"object","properties":{"licenseType":{"type":"string","nullable":true},"count":{"type":"number"}}}}}},"assetReuse":{"type":"object","properties":{"totalAssets":{"type":"number"},"assetsConsumed":{"type":"number","nullable":true},"rate":{"type":"number","nullable":true},"eventsObserved":{"type":"number"}}},"timeToApprove":{"type":"object","properties":{"reviewedInWindow":{"type":"number"},"measurable":{"type":"number"},"medianHours":{"type":"number","nullable":true},"p90Hours":{"type":"number","nullable":true},"pendingNow":{"type":"number"},"oldestPendingHours":{"type":"number","nullable":true}}},"topAssets":{"type":"array","description":"Views and downloads only. There is deliberately no ROI field.","items":{"type":"object","properties":{"assetId":{"type":"string"},"name":{"type":"string","nullable":true},"views":{"type":"number"},"downloads":{"type":"number"},"total":{"type":"number"}}}},"adoptionHealth":{"type":"object","properties":{"dau":{"type":"number","nullable":true},"wau":{"type":"number","nullable":true},"activeInWindow":{"type":"number","nullable":true},"stickiness":{"type":"number","nullable":true},"workflowRuns":{"type":"object","properties":{"total":{"type":"number"},"completed":{"type":"number"},"failed":{"type":"number"},"completionRate":{"type":"number","nullable":true}}}}},"contentSupplyChain":{"type":"object","properties":{"stages":{"type":"object","properties":{"ingesting":{"type":"number"},"processing":{"type":"number"},"awaitingApproval":{"type":"number"},"approved":{"type":"number"},"rejected":{"type":"number"},"published":{"type":"number"}}},"durationsHours":{"type":"object","description":"Only `approval` is instrumented (requestedAt -> reviewedAt). The other stage boundaries have no start timestamp, so they are null and are never estimated.","properties":{"approval":{"type":"number","nullable":true},"ingest":{"type":"number","nullable":true},"processing":{"type":"number","nullable":true}}}}},"search":{"type":"object","properties":{"queriesInWindow":{"type":"number"},"queriesPerDay":{"type":"number","nullable":true},"zeroResultCount":{"type":"number"},"zeroResultRate":{"type":"number","nullable":true}}},"unmeasured":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"Malformed window parameter"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Requires the manager role"}}}},"/v1/dam/workflows":{"get":{"tags":["Workflows"],"summary":"List DAM workflows","description":"Phase 7b-2 W-1. Tenant-scoped list of DAM-authored workflow definitions, newest first. Readable by any authenticated role. NOTE THE PATH: `/v1/dam/workflows`, not `/v1/workflows`. `/v1/workflows/*` was the HubSpot custom-action namespace, a different system backed by different tables; its removed paths answer 404.","operationId":"listDamWorkflows","responses":{"200":{"description":"Workflow list","content":{"application/json":{"schema":{"type":"object","properties":{"workflows":{"type":"array","items":{"$ref":"#/components/schemas/Workflow"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Workflows"],"summary":"Create a DAM workflow","description":"Requires the `manager` role, not merely an authenticated viewer: a workflow exists to spend money without a human in the loop, so authoring one is a privileged act while reading one is not. `graph` is validated at this boundary and a 400 is returned for a duplicate node id, an edge referencing an unknown node, a self-edge, a duplicate edge, a cyclic graph, a graph with zero or more than one entry node, an unreachable node, or a document over 64 KB. This is deliberate: an unvalidated graph becomes a dispatcher failure later, in a worker, after earlier steps have already run.","operationId":"createDamWorkflow","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowCreateRequest"}}}},"responses":{"200":{"description":"Workflow created","content":{"application/json":{"schema":{"type":"object","properties":{"workflow":{"$ref":"#/components/schemas/Workflow"}}}}}},"400":{"description":"Validation failed (including graph shape and size)"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Requires the manager role"}}}},"/v1/dam/workflows/{id}":{"get":{"tags":["Workflows"],"summary":"Get a DAM workflow","description":"Readable by any authenticated role. Returns 404 for both an unknown id and an id belonging to another tenant — the two are deliberately indistinguishable, so this endpoint is not an existence oracle for other tenants' workflow ids.","operationId":"getDamWorkflow","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Workflow","content":{"application/json":{"schema":{"type":"object","properties":{"workflow":{"$ref":"#/components/schemas/Workflow"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Workflow not found in this tenant"}}},"patch":{"tags":["Workflows"],"summary":"Update a DAM workflow","description":"Requires the `manager` role. Partial update: omitted fields are left unchanged. Changing `graph`, `triggerType` or `triggerConfig` increments `version`; a name- or status-only edit does not. `graph` is re-validated in full on every update.","operationId":"updateDamWorkflow","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowUpdateRequest"}}}},"responses":{"200":{"description":"Workflow updated","content":{"application/json":{"schema":{"type":"object","properties":{"workflow":{"$ref":"#/components/schemas/Workflow"}}}}}},"400":{"description":"Validation failed (including graph shape and size)"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Requires the manager role"},"404":{"description":"Workflow not found in this tenant"}}},"delete":{"tags":["Workflows"],"summary":"Delete a DAM workflow","description":"Requires the `manager` role. Runs and step runs for this workflow cascade with it.","operationId":"deleteDamWorkflow","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Deleted"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Requires the manager role"},"404":{"description":"Workflow not found in this tenant"}}}},"/v1/scan/findings":{"get":{"tags":["Scan"],"summary":"Get latest scan findings","operationId":"getScanFindings","responses":{"200":{"description":"Scan findings for all assets","content":{"application/json":{"schema":{"type":"object","properties":{"findings":{"type":"array","items":{"type":"object","properties":{"assetId":{"type":"string"},"assetName":{"type":"string"},"status":{"type":"string","enum":["candidate","skipped"]},"profile":{"$ref":"#/components/schemas/OptimizationProfile"},"savingsBytes":{"type":"number"},"savingsPercent":{"type":"number"},"recommendedFormat":{"type":"string"},"scannedAt":{"type":"string","format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/settings/upload-optimization":{"get":{"tags":["Settings"],"summary":"Get the account's Optimize-on-upload default","description":"What an upload that sends no optimizeOnUpload field gets. Any signed-in role can read it.","operationId":"getUploadOptimization","responses":{"200":{"description":"Account default","content":{"application/json":{"schema":{"type":"object","required":["optimizeOnUpload"],"properties":{"optimizeOnUpload":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"put":{"tags":["Settings"],"summary":"Set the account's Optimize-on-upload default","description":"Admin only. Changes only this default; it does not mark the governance policy reviewed.","operationId":"updateUploadOptimization","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["optimizeOnUpload"],"properties":{"optimizeOnUpload":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Saved default","content":{"application/json":{"schema":{"type":"object","required":["optimizeOnUpload"],"properties":{"optimizeOnUpload":{"type":"boolean"}}}}}},"400":{"description":"Validation failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/v1/settings/policy":{"get":{"tags":["Settings"],"summary":"Get governance policy","operationId":"getPolicy","responses":{"200":{"description":"Tenant policy","content":{"application/json":{"schema":{"type":"object","properties":{"policy":{"type":"object","properties":{"allowedFormats":{"type":"array","items":{"type":"string"}},"maxWidth":{"type":"number"},"maxHeight":{"type":"number"},"minimumSavingsPercentToReplace":{"type":"number"},"defaultProfile":{"$ref":"#/components/schemas/OptimizationProfile"},"requireApprovalForWarn":{"type":"boolean"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"put":{"tags":["Settings"],"summary":"Update governance policy","operationId":"updatePolicy","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Full Policy object matching the GET response shape"}}}},"responses":{"200":{"description":"Updated policy","content":{"application/json":{"schema":{"type":"object","properties":{"policy":{"type":"object"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/UnprocessableEntity"}}}},"/v1/profiles":{"get":{"tags":["Profiles"],"summary":"List optimization profiles","operationId":"listProfiles","responses":{"200":{"description":"Available profiles with labels, descriptions, and guidance","content":{"application/json":{"schema":{"type":"object","properties":{"profiles":{"type":"array","items":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/OptimizationProfile"},"label":{"type":"string"},"description":{"type":"string"},"guidance":{"type":"object","properties":{"bestFor":{"type":"string"},"deliveryBias":{"type":"string"},"formatBias":{"type":"string"}}}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/audit/logs":{"get":{"tags":["Audit"],"summary":"List audit log entries","operationId":"listAuditLogs","parameters":[{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Pagination cursor"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"Audit log entries","content":{"application/json":{"schema":{"type":"object","properties":{"logs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string"},"action":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"metadata":{"type":"object"},"createdAt":{"type":"string","format":"date-time"}}}},"nextCursor":{"type":["string","null"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}}}}