{"openapi":"3.1.0","info":{"title":"Idea Library API","version":"0.1.0","description":"Private inspiration library. Claims preserve source_shown, model_inferred and user_stated origins."},"servers":[{"url":"/"}],"components":{"securitySchemes":{"machineToken":{"type":"http","scheme":"bearer","bearerFormat":"idea_<prefix>_<secret>","description":"Scoped, revocable machine token. Required scopes are documented on each operation."},"ownerSession":{"type":"apiKey","in":"cookie","name":"better-auth.session_token","description":"Owner session. HTTPS deployments use __Secure-better-auth.session_token. Mutations require a same-origin Origin or Sec-Fetch-Site header."}},"schemas":{"UploadMetaInput":{"type":"object","properties":{"note":{"type":["string","null"],"maxLength":4000,"default":null},"board":{"type":["string","null"],"maxLength":300,"default":null},"title":{"type":["string","null"],"maxLength":300,"default":null}}}},"parameters":{}},"paths":{"/api/health":{"get":{"operationId":"get__api_health","description":"Public endpoint.","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/status":{"get":{"operationId":"get__api_status","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"demoMode":{"type":"boolean"},"providers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string","enum":["vision_text","embedding","web_search"]},"provider":{"type":"string"},"model":{"type":["string","null"]},"configured":{"type":"boolean"},"allowedForPrivateContent":{"type":"boolean"},"demo":{"type":"boolean","default":false},"usage":{"type":"object","properties":{"calls":{"type":"integer","minimum":0},"inputTokens":{"type":"integer","minimum":0},"outputTokens":{"type":"integer","minimum":0}},"default":{"calls":0,"inputTokens":0,"outputTokens":0},"required":["calls","inputTokens","outputTokens"]}},"required":["id","role","provider","model","configured","allowedForPrivateContent"]}},"connectors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"kind":{"type":"string","enum":["x_bookmarks","pinterest","dribbble"]},"externalAccountId":{"type":["string","null"]},"displayName":{"type":["string","null"]},"state":{"type":"string","enum":["not_configured","authorization_required","connected","syncing","rate_limited","permission_blocked","error","unsupported_capability","fixture_mode"]},"stateDetail":{"type":["string","null"],"maxLength":1000},"scopes":{"type":"array","items":{"type":"string"},"default":[]},"pollIntervalMinutes":{"type":"integer","exclusiveMinimum":0,"default":30},"backfillLimit":{"type":"integer","exclusiveMinimum":0,"default":800},"coverage":{"type":"object","properties":{"oldestObservedAt":{"type":["string","null"],"format":"date-time"},"newestObservedAt":{"type":["string","null"],"format":"date-time"},"count":{"type":"integer","minimum":0}},"default":{"oldestObservedAt":null,"newestObservedAt":null,"count":0},"required":["oldestObservedAt","newestObservedAt","count"]},"lastSyncAt":{"type":["string","null"],"format":"date-time"},"lastError":{"type":["string","null"],"maxLength":2000},"rateLimitResetAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","kind","externalAccountId","displayName","state","stateDetail","lastSyncAt","lastError","rateLimitResetAt","createdAt","updatedAt"]}},"storage":{"type":"object","properties":{"backend":{"type":"string"},"bytesUsed":{"type":"integer","minimum":0},"objects":{"type":"integer","minimum":0}},"required":["backend","bytesUsed","objects"]},"ingestion":{"type":"object","properties":{"queued":{"type":"integer"},"failed":{"type":"integer"},"partial":{"type":"integer"},"retries":{"type":"integer"}},"required":["queued","failed","partial","retries"]},"db":{"type":"object","properties":{"ok":{"type":"boolean"},"migrations":{"type":["integer","null"]}},"required":["ok","migrations"]},"worker":{"type":"object","properties":{"lastHeartbeatAt":{"type":["string","null"],"format":"date-time"},"ok":{"type":"boolean"}},"required":["lastHeartbeatAt","ok"]},"captureSandbox":{"type":"string","enum":["available","unsupported: capture sandbox unavailable"]},"version":{"type":"string"}},"required":["demoMode","providers","connectors","storage","ingestion","db","worker","captureSandbox","version"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/capture":{"post":{"operationId":"post__api_capture","description":"Requires capture token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["capture"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"note":{"type":["string","null"],"maxLength":4000,"default":null},"board":{"type":["string","null"],"maxLength":300,"default":null},"page":{"type":["object","null"],"properties":{"title":{"type":["string","null"],"maxLength":500,"default":null},"selectedText":{"type":["string","null"],"maxLength":20000,"default":null},"screenshotBase64":{"type":["string","null"],"maxLength":12000000,"default":null},"viewport":{"type":["object","null"],"properties":{"width":{"type":"integer"},"height":{"type":"integer"},"deviceScaleFactor":{"type":"number"}},"default":null,"required":["width","height","deviceScaleFactor"]}},"default":null}},"required":["url"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"saveId":{"type":"string"},"sourceId":{"type":"string"},"runId":{"type":["string","null"]},"deduplicated":{"type":"boolean"}},"required":["saveId","sourceId","runId","deduplicated"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"options":{"operationId":"options__api_capture","description":"CORS preflight; only APP_BASE_URL and CAPTURE_ALLOWED_ORIGINS are accepted.","security":[],"responses":{"204":{"description":"Success"},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/upload":{"post":{"security":[{"ownerSession":[]},{"machineToken":[]}],"description":"Requires capture scope. Total multipart body is limited by UPLOAD_MAX_BYTES; files must have PNG/JPEG/WebP/GIF signatures.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"files[]":{"type":"array","items":{"type":"string","format":"binary"},"minItems":1,"maxItems":20},"meta":{"type":"string","description":"JSON-encoded UploadMetaInput"}},"required":["files[]","meta"]}}}},"responses":{"202":{"description":"Durably accepted","content":{"application/json":{"schema":{"type":"object","properties":{"saveId":{"type":"string"},"sourceId":{"type":"string"},"runId":{"type":["string","null"]},"deduplicated":{"type":"boolean"}},"required":["saveId","sourceId","runId","deduplicated"]}}}},"400":{"description":"Invalid files or metadata","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Authentication required"},"403":{"description":"Capture scope or same-origin session required"},"413":{"description":"Upload size limit exceeded"},"415":{"description":"Unsupported image signature or MIME mismatch"},"429":{"description":"Token rate limited"}}}},"/api/saves":{"get":{"operationId":"get__api_saves","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":30},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","enum":["saved","research_candidate"]},"required":false,"name":"kind","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"save":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"sourceId":{"type":"string"},"connectorAccountId":{"type":["string","null"]},"board":{"type":["string","null"],"maxLength":300},"platformSavedAt":{"type":["string","null"],"format":"date-time"},"firstObservedAt":{"type":"string","format":"date-time"},"reason":{"type":["string","null"],"maxLength":4000},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","sourceId","connectorAccountId","board","platformSavedAt","firstObservedAt","reason","createdAt","updatedAt"]},"source":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string","enum":["x","pinterest","dribbble","web","upload"]},"platformId":{"type":"string","minLength":1},"canonicalUrl":{"type":"string","format":"uri"},"creatorHandle":{"type":["string","null"],"maxLength":200},"creatorName":{"type":["string","null"],"maxLength":200},"publishedAt":{"type":["string","null"],"format":"date-time"},"firstObservedAt":{"type":"string","format":"date-time"},"accessState":{"type":"string","enum":["public","authorized","inaccessible","unknown"],"default":"unknown"},"retention":{"type":"string","enum":["keep","reference_only"],"default":"keep"},"currentVersionId":{"type":["string","null"]},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","platform","platformId","canonicalUrl","creatorHandle","creatorName","publishedAt","firstObservedAt","currentVersionId","createdAt","updatedAt"]},"fragments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceId":{"type":"string"},"sourceVersionId":{"type":"string"},"saveId":{"type":["string","null"]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":4000},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"mechanism":{"type":["string","null"],"maxLength":120},"uncertainties":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"anchor":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["text_span"]},"sourceVersionId":{"type":"string"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}},"required":["kind","sourceVersionId","start","end"]},{"type":"object","properties":{"kind":{"type":"string","enum":["image_region"]},"assetId":{"type":"string"},"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["kind","assetId","rect"]},{"type":"object","properties":{"kind":{"type":"string","enum":["video_range"]},"assetId":{"type":"string"},"startMs":{"type":"integer","minimum":0},"endMs":{"type":"integer","minimum":0}},"required":["kind","assetId","startMs","endMs"]}]},"cropAssetId":{"type":["string","null"]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"enrichmentVersion":{"type":"string"},"userCorrections":{"type":"object","properties":{"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":4000},"concepts":{"type":["array","null"],"items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]}},"updatedAt":{"type":["string","null"],"format":"date-time"}},"default":{"title":null,"description":null,"concepts":null,"updatedAt":null},"required":["title","description","concepts","updatedAt"]},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","sourceId","sourceVersionId","saveId","title","description","mechanism","anchor","cropAssetId","origin","enrichmentVersion","createdAt","updatedAt"]}},"assets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceVersionId":{"type":["string","null"]},"parentAssetId":{"type":["string","null"]},"objectKey":{"type":"string"},"mimeType":{"type":"string"},"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"bytes":{"type":"integer","minimum":0},"checksum":{"type":"string"},"capturedAt":{"type":"string","format":"date-time"},"viewport":{"type":["object","null"],"properties":{"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"deviceScaleFactor":{"type":"number","exclusiveMinimum":0,"default":1}},"required":["width","height"]},"origin":{"type":"string","enum":["attachment","live_screenshot","crop","upload","research_fetch"]},"exportPolicy":{"type":"string","enum":["bundle","reference_only","restricted"]},"derivatives":{"type":"object","properties":{"webp":{"type":["string","null"]},"thumb":{"type":["string","null"]}},"default":{"webp":null,"thumb":null},"required":["webp","thumb"]},"cropRect":{"type":["object","null"],"properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"default":null,"required":["x","y","width","height"]},"label":{"type":["string","null"],"maxLength":200,"default":null},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sourceVersionId","parentAssetId","objectKey","mimeType","width","height","bytes","checksum","capturedAt","viewport","origin","exportPolicy","createdAt"]}},"stages":{"type":"array","items":{"type":"object","properties":{"saveId":{"type":"string"},"stage":{"type":"string","enum":["received","normalized","captured","interpreted","indexed","ready"]},"state":{"type":"string","enum":["pending","running","done","partial","blocked","failed"]},"attempts":{"type":"integer","minimum":0},"lastError":{"type":["string","null"],"maxLength":2000},"updatedAt":{"type":"string","format":"date-time"}},"required":["saveId","stage","state","attempts","lastError","updatedAt"]}}},"required":["save","source","fragments","assets","stages"]}},"nextCursor":{"type":["string","null"]}},"required":["items","nextCursor"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/saves/{id}/retry":{"post":{"operationId":"post__api_saves_id_retry","description":"Requires capture token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["capture"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}},"required":["runId"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/saves/{id}":{"delete":{"operationId":"delete__api_saves_id_","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Success"},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/search":{"post":{"operationId":"post__api_search","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":1000},"exclude":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":10,"default":[]},"likeFragmentIds":{"type":"array","items":{"type":"string"},"maxItems":10,"default":[]},"filters":{"type":"object","properties":{"savedOnly":{"type":"boolean","default":true},"sourceIds":{"type":"array","items":{"type":"string"},"maxItems":50,"default":[]},"collectionId":{"type":["string","null"],"default":null},"components":{"type":"array","items":{"type":"string","maxLength":80},"maxItems":20,"default":[]},"dateKind":{"type":["string","null"],"enum":["published_at","saved_at","first_observed_at","captured_at",null],"default":null},"dateFrom":{"type":["string","null"],"format":"date-time","default":null},"dateTo":{"type":["string","null"],"format":"date-time","default":null},"platforms":{"type":"array","items":{"type":"string"},"maxItems":10,"default":[]}},"default":{"savedOnly":true,"sourceIds":[],"collectionId":null,"components":[],"dateKind":null,"dateFrom":null,"dateTo":null,"platforms":[]}},"limit":{"type":"integer","minimum":1,"maximum":50,"default":12},"debug":{"type":"boolean","default":false}},"required":["query"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"hits":{"type":"array","items":{"type":"object","properties":{"fragmentId":{"type":["string","null"]},"candidateId":{"type":["string","null"]},"kind":{"type":"string","enum":["saved","research_candidate"]},"title":{"type":"string"},"why":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":2000},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"evidence":{"type":"array","items":{"type":"string"},"default":[]}},"required":["text","origin"]},"description":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":2000},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"evidence":{"type":"array","items":{"type":"string"},"default":[]}},"required":["text","origin"]},"concepts":{"type":"array","items":{"type":"string"}},"mechanism":{"type":["string","null"]},"cropAssetId":{"type":["string","null"]},"assetIds":{"type":"array","items":{"type":"string"}},"sourceId":{"type":["string","null"]},"sourceUrl":{"type":["string","null"]},"creator":{"type":["string","null"]},"dates":{"type":"object","properties":{"publishedAt":{"type":["string","null"],"format":"date-time"},"platformSavedAt":{"type":["string","null"],"format":"date-time"},"firstObservedAt":{"type":["string","null"],"format":"date-time"},"capturedAt":{"type":["string","null"],"format":"date-time"}},"required":["publishedAt","platformSavedAt","firstObservedAt","capturedAt"]},"scores":{"type":"object","properties":{"lexicalRank":{"type":["integer","null"]},"vectorRank":{"type":["integer","null"]},"fusedScore":{"type":"number"},"rerankScore":{"type":["number","null"]}},"required":["lexicalRank","vectorRank","fusedScore","rerankScore"]}},"required":["fragmentId","candidateId","kind","title","why","description","concepts","mechanism","cropAssetId","assetIds","sourceId","sourceUrl","creator","dates"]}},"noGoodMatch":{"type":"boolean"},"retrievalMode":{"type":"string","enum":["lexical_only","hybrid","hybrid_reranked","demo_deterministic"]},"message":{"type":["string","null"]}},"required":["hits","noGoodMatch","retrievalMode","message"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/references/{fragmentId}":{"get":{"operationId":"get__api_references_fragmentId_","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"fragmentId","in":"path"}],"responses":{"200":{"description":"Reference; supports Accept: text/markdown","content":{"application/json":{"schema":{"type":"object","properties":{"fragment":{"type":"object","properties":{"id":{"type":"string"},"sourceId":{"type":"string"},"sourceVersionId":{"type":"string"},"saveId":{"type":["string","null"]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":4000},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"mechanism":{"type":["string","null"],"maxLength":120},"uncertainties":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"anchor":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["text_span"]},"sourceVersionId":{"type":"string"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}},"required":["kind","sourceVersionId","start","end"]},{"type":"object","properties":{"kind":{"type":"string","enum":["image_region"]},"assetId":{"type":"string"},"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["kind","assetId","rect"]},{"type":"object","properties":{"kind":{"type":"string","enum":["video_range"]},"assetId":{"type":"string"},"startMs":{"type":"integer","minimum":0},"endMs":{"type":"integer","minimum":0}},"required":["kind","assetId","startMs","endMs"]}]},"cropAssetId":{"type":["string","null"]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"enrichmentVersion":{"type":"string"},"userCorrections":{"type":"object","properties":{"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":4000},"concepts":{"type":["array","null"],"items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]}},"updatedAt":{"type":["string","null"],"format":"date-time"}},"default":{"title":null,"description":null,"concepts":null,"updatedAt":null},"required":["title","description","concepts","updatedAt"]},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","sourceId","sourceVersionId","saveId","title","description","mechanism","anchor","cropAssetId","origin","enrichmentVersion","createdAt","updatedAt"]},"source":{"type":["object","null"],"properties":{"id":{"type":"string"},"platform":{"type":"string","enum":["x","pinterest","dribbble","web","upload"]},"platformId":{"type":"string","minLength":1},"canonicalUrl":{"type":"string","format":"uri"},"creatorHandle":{"type":["string","null"],"maxLength":200},"creatorName":{"type":["string","null"],"maxLength":200},"publishedAt":{"type":["string","null"],"format":"date-time"},"firstObservedAt":{"type":"string","format":"date-time"},"accessState":{"type":"string","enum":["public","authorized","inaccessible","unknown"],"default":"unknown"},"retention":{"type":"string","enum":["keep","reference_only"],"default":"keep"},"currentVersionId":{"type":["string","null"]},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","platform","platformId","canonicalUrl","creatorHandle","creatorName","publishedAt","firstObservedAt","currentVersionId","createdAt","updatedAt"]},"save":{"type":["object","null"],"properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"sourceId":{"type":"string"},"connectorAccountId":{"type":["string","null"]},"board":{"type":["string","null"],"maxLength":300},"platformSavedAt":{"type":["string","null"],"format":"date-time"},"firstObservedAt":{"type":"string","format":"date-time"},"reason":{"type":["string","null"],"maxLength":4000},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","sourceId","connectorAccountId","board","platformSavedAt","firstObservedAt","reason","createdAt","updatedAt"]},"assets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceVersionId":{"type":["string","null"]},"parentAssetId":{"type":["string","null"]},"objectKey":{"type":"string"},"mimeType":{"type":"string"},"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"bytes":{"type":"integer","minimum":0},"checksum":{"type":"string"},"capturedAt":{"type":"string","format":"date-time"},"viewport":{"type":["object","null"],"properties":{"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"deviceScaleFactor":{"type":"number","exclusiveMinimum":0,"default":1}},"required":["width","height"]},"origin":{"type":"string","enum":["attachment","live_screenshot","crop","upload","research_fetch"]},"exportPolicy":{"type":"string","enum":["bundle","reference_only","restricted"]},"derivatives":{"type":"object","properties":{"webp":{"type":["string","null"]},"thumb":{"type":["string","null"]}},"default":{"webp":null,"thumb":null},"required":["webp","thumb"]},"cropRect":{"type":["object","null"],"properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"default":null,"required":["x","y","width","height"]},"label":{"type":["string","null"],"maxLength":200,"default":null},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sourceVersionId","parentAssetId","objectKey","mimeType","width","height","bytes","checksum","capturedAt","viewport","origin","exportPolicy","createdAt"]}},"claims":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":2000},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"evidence":{"type":"array","items":{"type":"string"},"default":[]}},"required":["text","origin"]}},"ingestion":{"type":"array","items":{"type":"object","properties":{"stage":{"type":"string"},"state":{"type":"string"},"attempts":{"type":"integer"},"lastError":{"type":["string","null"]}},"required":["stage","state","attempts","lastError"]},"default":[]}},"required":["fragment","source","save","assets","claims"]}},"text/markdown":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"patch":{"operationId":"patch__api_references_fragmentId_","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"fragmentId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":4000},"concepts":{"type":["array","null"],"items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"sourceId":{"type":"string"},"sourceVersionId":{"type":"string"},"saveId":{"type":["string","null"]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":4000},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"mechanism":{"type":["string","null"],"maxLength":120},"uncertainties":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"anchor":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["text_span"]},"sourceVersionId":{"type":"string"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}},"required":["kind","sourceVersionId","start","end"]},{"type":"object","properties":{"kind":{"type":"string","enum":["image_region"]},"assetId":{"type":"string"},"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["kind","assetId","rect"]},{"type":"object","properties":{"kind":{"type":"string","enum":["video_range"]},"assetId":{"type":"string"},"startMs":{"type":"integer","minimum":0},"endMs":{"type":"integer","minimum":0}},"required":["kind","assetId","startMs","endMs"]}]},"cropAssetId":{"type":["string","null"]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"enrichmentVersion":{"type":"string"},"userCorrections":{"type":"object","properties":{"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":4000},"concepts":{"type":["array","null"],"items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]}},"updatedAt":{"type":["string","null"],"format":"date-time"}},"default":{"title":null,"description":null,"concepts":null,"updatedAt":null},"required":["title","description","concepts","updatedAt"]},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","sourceId","sourceVersionId","saveId","title","description","mechanism","anchor","cropAssetId","origin","enrichmentVersion","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/references/{fragmentId}/crop":{"post":{"operationId":"post__api_references_fragmentId_crop","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"fragmentId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["rect"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"sourceId":{"type":"string"},"sourceVersionId":{"type":"string"},"saveId":{"type":["string","null"]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":4000},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"mechanism":{"type":["string","null"],"maxLength":120},"uncertainties":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"anchor":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["text_span"]},"sourceVersionId":{"type":"string"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}},"required":["kind","sourceVersionId","start","end"]},{"type":"object","properties":{"kind":{"type":"string","enum":["image_region"]},"assetId":{"type":"string"},"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["kind","assetId","rect"]},{"type":"object","properties":{"kind":{"type":"string","enum":["video_range"]},"assetId":{"type":"string"},"startMs":{"type":"integer","minimum":0},"endMs":{"type":"integer","minimum":0}},"required":["kind","assetId","startMs","endMs"]}]},"cropAssetId":{"type":["string","null"]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"enrichmentVersion":{"type":"string"},"userCorrections":{"type":"object","properties":{"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":4000},"concepts":{"type":["array","null"],"items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]}},"updatedAt":{"type":["string","null"],"format":"date-time"}},"default":{"title":null,"description":null,"concepts":null,"updatedAt":null},"required":["title","description","concepts","updatedAt"]},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","sourceId","sourceVersionId","saveId","title","description","mechanism","anchor","cropAssetId","origin","enrichmentVersion","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/references/{fragmentId}/reenrich":{"post":{"operationId":"post__api_references_fragmentId_reenrich","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"fragmentId","in":"path"}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}},"required":["runId"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/assets/{id}":{"get":{"operationId":"get__api_assets_id_","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["orig","webp","thumb"],"default":"webp"},"required":false,"name":"variant","in":"query"}],"responses":{"200":{"description":"Success","content":{"image/*":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"patch":{"operationId":"patch__api_assets_id_","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"exportPolicy":{"type":"string","enum":["bundle","reference_only","restricted"]}},"required":["exportPolicy"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"sourceVersionId":{"type":["string","null"]},"parentAssetId":{"type":["string","null"]},"objectKey":{"type":"string"},"mimeType":{"type":"string"},"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"bytes":{"type":"integer","minimum":0},"checksum":{"type":"string"},"capturedAt":{"type":"string","format":"date-time"},"viewport":{"type":["object","null"],"properties":{"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"deviceScaleFactor":{"type":"number","exclusiveMinimum":0,"default":1}},"required":["width","height"]},"origin":{"type":"string","enum":["attachment","live_screenshot","crop","upload","research_fetch"]},"exportPolicy":{"type":"string","enum":["bundle","reference_only","restricted"]},"derivatives":{"type":"object","properties":{"webp":{"type":["string","null"]},"thumb":{"type":["string","null"]}},"default":{"webp":null,"thumb":null},"required":["webp","thumb"]},"cropRect":{"type":["object","null"],"properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"default":null,"required":["x","y","width","height"]},"label":{"type":["string","null"],"maxLength":200,"default":null},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sourceVersionId","parentAssetId","objectKey","mimeType","width","height","bytes","checksum","capturedAt","viewport","origin","exportPolicy","createdAt"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/related":{"post":{"operationId":"post__api_related","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fragmentId":{"type":"string"},"types":{"type":"array","items":{"type":"string","enum":["links_to","example_of","similar_layout","similar_style","variation_of","contrasts_with"]},"default":[]},"status":{"type":"array","items":{"type":"string","enum":["suggested","confirmed","rejected"]},"default":["suggested","confirmed"]},"limit":{"type":"integer","minimum":1,"maximum":60,"default":20},"expand":{"type":"boolean","default":false}},"required":["fragmentId"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"relationships":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["links_to","example_of","similar_layout","similar_style","variation_of","contrasts_with"]},"from":{"type":"object","properties":{"type":{"type":"string","enum":["fragment","source"]},"id":{"type":"string"}},"required":["type","id"]},"to":{"type":"object","properties":{"type":{"type":"string","enum":["fragment","source"]},"id":{"type":"string"}},"required":["type","id"]},"explanation":{"type":"string","maxLength":2000},"evidenceIds":{"type":"array","items":{"type":"string"},"default":[]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"status":{"type":"string","enum":["suggested","confirmed","rejected"]},"score":{"type":["number","null"],"minimum":0,"maximum":1,"default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","type","from","to","explanation","origin","status","createdAt","updatedAt"]}},"neighbors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceId":{"type":"string"},"sourceVersionId":{"type":"string"},"saveId":{"type":["string","null"]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":4000},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"mechanism":{"type":["string","null"],"maxLength":120},"uncertainties":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"anchor":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["text_span"]},"sourceVersionId":{"type":"string"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}},"required":["kind","sourceVersionId","start","end"]},{"type":"object","properties":{"kind":{"type":"string","enum":["image_region"]},"assetId":{"type":"string"},"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["kind","assetId","rect"]},{"type":"object","properties":{"kind":{"type":"string","enum":["video_range"]},"assetId":{"type":"string"},"startMs":{"type":"integer","minimum":0},"endMs":{"type":"integer","minimum":0}},"required":["kind","assetId","startMs","endMs"]}]},"cropAssetId":{"type":["string","null"]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"enrichmentVersion":{"type":"string"},"userCorrections":{"type":"object","properties":{"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":4000},"concepts":{"type":["array","null"],"items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]}},"updatedAt":{"type":["string","null"],"format":"date-time"}},"default":{"title":null,"description":null,"concepts":null,"updatedAt":null},"required":["title","description","concepts","updatedAt"]},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","sourceId","sourceVersionId","saveId","title","description","mechanism","anchor","cropAssetId","origin","enrichmentVersion","createdAt","updatedAt"]}}},"required":["relationships","neighbors"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/relationships/decide":{"post":{"operationId":"post__api_relationships_decide","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"relationshipId":{"type":"string"},"status":{"type":"string","enum":["confirmed","rejected"]}},"required":["relationshipId","status"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["links_to","example_of","similar_layout","similar_style","variation_of","contrasts_with"]},"from":{"type":"object","properties":{"type":{"type":"string","enum":["fragment","source"]},"id":{"type":"string"}},"required":["type","id"]},"to":{"type":"object","properties":{"type":{"type":"string","enum":["fragment","source"]},"id":{"type":"string"}},"required":["type","id"]},"explanation":{"type":"string","maxLength":2000},"evidenceIds":{"type":"array","items":{"type":"string"},"default":[]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"status":{"type":"string","enum":["suggested","confirmed","rejected"]},"score":{"type":["number","null"],"minimum":0,"maximum":1,"default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","type","from","to","explanation","origin","status","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/collections":{"get":{"operationId":"get__api_collections","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"title":{"type":"string","minLength":1,"maxLength":200},"goal":{"type":"string","maxLength":4000,"default":""},"constraints":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"chosenDirection":{"type":"string","maxLength":4000,"default":""},"unresolvedDecisions":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"version":{"type":"integer","minimum":0},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","title","version","createdAt","updatedAt"]}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"post":{"operationId":"post__api_collections","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"goal":{"type":"string","maxLength":4000,"default":""}},"required":["title"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"title":{"type":"string","minLength":1,"maxLength":200},"goal":{"type":"string","maxLength":4000,"default":""},"constraints":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"chosenDirection":{"type":"string","maxLength":4000,"default":""},"unresolvedDecisions":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"version":{"type":"integer","minimum":0},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","title","version","createdAt","updatedAt"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/collections/{id}":{"get":{"operationId":"get__api_collections_id_","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Collection; supports Accept: text/markdown","content":{"application/json":{"schema":{"type":"object","properties":{"collection":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"title":{"type":"string","minLength":1,"maxLength":200},"goal":{"type":"string","maxLength":4000,"default":""},"constraints":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"chosenDirection":{"type":"string","maxLength":4000,"default":""},"unresolvedDecisions":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"version":{"type":"integer","minimum":0},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","title","version","createdAt","updatedAt"]},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"fragmentId":{"type":["string","null"]},"assetId":{"type":["string","null"]},"researchCandidateId":{"type":["string","null"]},"disposition":{"type":"string","enum":["included","excluded"],"default":"included"},"borrowNote":{"type":["string","null"],"maxLength":4000},"avoidNote":{"type":["string","null"],"maxLength":4000},"pinned":{"type":"boolean","default":false},"order":{"type":"integer","minimum":0},"position":{"type":["object","null"],"properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cropOverrideAssetId":{"type":["string","null"],"default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","collectionId","fragmentId","assetId","researchCandidateId","borrowNote","avoidNote","order","position","createdAt","updatedAt"]}},"fragments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceId":{"type":"string"},"sourceVersionId":{"type":"string"},"saveId":{"type":["string","null"]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":4000},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"mechanism":{"type":["string","null"],"maxLength":120},"uncertainties":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"anchor":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["text_span"]},"sourceVersionId":{"type":"string"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}},"required":["kind","sourceVersionId","start","end"]},{"type":"object","properties":{"kind":{"type":"string","enum":["image_region"]},"assetId":{"type":"string"},"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["kind","assetId","rect"]},{"type":"object","properties":{"kind":{"type":"string","enum":["video_range"]},"assetId":{"type":"string"},"startMs":{"type":"integer","minimum":0},"endMs":{"type":"integer","minimum":0}},"required":["kind","assetId","startMs","endMs"]}]},"cropAssetId":{"type":["string","null"]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"enrichmentVersion":{"type":"string"},"userCorrections":{"type":"object","properties":{"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":4000},"concepts":{"type":["array","null"],"items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]}},"updatedAt":{"type":["string","null"],"format":"date-time"}},"default":{"title":null,"description":null,"concepts":null,"updatedAt":null},"required":["title","description","concepts","updatedAt"]},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","sourceId","sourceVersionId","saveId","title","description","mechanism","anchor","cropAssetId","origin","enrichmentVersion","createdAt","updatedAt"]}},"candidates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"runId":{"type":"string"},"url":{"type":"string","format":"uri"},"title":{"type":["string","null"],"maxLength":300},"contribution":{"type":"string","maxLength":2000},"verified":{"type":"boolean"},"assetIds":{"type":"array","items":{"type":"string"},"default":[]},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"],"default":"model_inferred"},"selectedIntoCollectionId":{"type":["string","null"],"default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","runId","url","title","contribution","verified","createdAt"]}},"assets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceVersionId":{"type":["string","null"]},"parentAssetId":{"type":["string","null"]},"objectKey":{"type":"string"},"mimeType":{"type":"string"},"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"bytes":{"type":"integer","minimum":0},"checksum":{"type":"string"},"capturedAt":{"type":"string","format":"date-time"},"viewport":{"type":["object","null"],"properties":{"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"deviceScaleFactor":{"type":"number","exclusiveMinimum":0,"default":1}},"required":["width","height"]},"origin":{"type":"string","enum":["attachment","live_screenshot","crop","upload","research_fetch"]},"exportPolicy":{"type":"string","enum":["bundle","reference_only","restricted"]},"derivatives":{"type":"object","properties":{"webp":{"type":["string","null"]},"thumb":{"type":["string","null"]}},"default":{"webp":null,"thumb":null},"required":["webp","thumb"]},"cropRect":{"type":["object","null"],"properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"default":null,"required":["x","y","width","height"]},"label":{"type":["string","null"],"maxLength":200,"default":null},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sourceVersionId","parentAssetId","objectKey","mimeType","width","height","bytes","checksum","capturedAt","viewport","origin","exportPolicy","createdAt"]}},"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string","enum":["x","pinterest","dribbble","web","upload"]},"platformId":{"type":"string","minLength":1},"canonicalUrl":{"type":"string","format":"uri"},"creatorHandle":{"type":["string","null"],"maxLength":200},"creatorName":{"type":["string","null"],"maxLength":200},"publishedAt":{"type":["string","null"],"format":"date-time"},"firstObservedAt":{"type":"string","format":"date-time"},"accessState":{"type":"string","enum":["public","authorized","inaccessible","unknown"],"default":"unknown"},"retention":{"type":"string","enum":["keep","reference_only"],"default":"keep"},"currentVersionId":{"type":["string","null"]},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","platform","platformId","canonicalUrl","creatorHandle","creatorName","publishedAt","firstObservedAt","currentVersionId","createdAt","updatedAt"]}},"relationships":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["links_to","example_of","similar_layout","similar_style","variation_of","contrasts_with"]},"from":{"type":"object","properties":{"type":{"type":"string","enum":["fragment","source"]},"id":{"type":"string"}},"required":["type","id"]},"to":{"type":"object","properties":{"type":{"type":"string","enum":["fragment","source"]},"id":{"type":"string"}},"required":["type","id"]},"explanation":{"type":"string","maxLength":2000},"evidenceIds":{"type":"array","items":{"type":"string"},"default":[]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"status":{"type":"string","enum":["suggested","confirmed","rejected"]},"score":{"type":["number","null"],"minimum":0,"maximum":1,"default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","type","from","to","explanation","origin","status","createdAt","updatedAt"]}},"searches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"query":{"type":"string","minLength":1,"maxLength":1000},"kind":{"type":"string","enum":["library","research","manual"],"default":"library"},"runId":{"type":["string","null"],"default":null},"status":{"type":"string","enum":["searching","ready","error"],"default":"ready"},"position":{"type":["object","null"],"properties":{"x":{"type":"number"},"y":{"type":"number"}},"default":null,"required":["x","y"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","collectionId","query","createdAt","updatedAt"]},"default":[]},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"searchId":{"type":"string"},"memberId":{"type":"string"},"score":{"type":["number","null"],"default":null},"reason":{"type":["string","null"],"maxLength":1000,"default":null},"cutAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","collectionId","searchId","memberId","createdAt"]},"default":[]}},"required":["collection","members","fragments","candidates","assets","sources","relationships"]}},"text/markdown":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"patch":{"operationId":"patch__api_collections_id_","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"collectionId":{"type":"string"},"expectedVersion":{"type":"integer","minimum":0},"title":{"type":"string","minLength":1,"maxLength":200},"goal":{"type":"string","maxLength":4000},"constraints":{"type":"array","items":{"type":"string","maxLength":500}},"chosenDirection":{"type":"string","maxLength":4000},"unresolvedDecisions":{"type":"array","items":{"type":"string","maxLength":500}},"members":{"type":"array","items":{"type":"object","properties":{"memberId":{"type":["string","null"],"default":null},"fragmentId":{"type":["string","null"],"default":null},"assetId":{"type":["string","null"],"default":null},"researchCandidateId":{"type":["string","null"],"default":null},"remove":{"type":"boolean","default":false},"disposition":{"type":"string","enum":["included","excluded"]},"borrowNote":{"type":["string","null"],"maxLength":4000},"avoidNote":{"type":["string","null"],"maxLength":4000},"pinned":{"type":"boolean"},"order":{"type":"integer","minimum":0},"position":{"type":["object","null"],"properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cropOverride":{"type":["object","null"],"properties":{"assetId":{"type":"string"},"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["assetId","rect"]}}},"maxItems":200,"default":[]},"searches":{"type":"array","items":{"type":"object","properties":{"searchId":{"type":["string","null"],"default":null},"query":{"type":"string","minLength":1,"maxLength":1000},"kind":{"type":"string","enum":["library","research","manual"]},"runId":{"type":["string","null"]},"status":{"type":"string","enum":["searching","ready","error"]},"position":{"type":["object","null"],"properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"remove":{"type":"boolean","default":false}}},"maxItems":50,"default":[]},"edges":{"type":"array","items":{"type":"object","properties":{"edgeId":{"type":["string","null"],"default":null},"searchId":{"type":["string","null"],"default":null},"memberId":{"type":["string","null"],"default":null},"fragmentId":{"type":["string","null"],"default":null},"assetId":{"type":["string","null"],"default":null},"researchCandidateId":{"type":["string","null"],"default":null},"score":{"type":["number","null"]},"reason":{"type":["string","null"],"maxLength":1000},"cut":{"type":"boolean"},"remove":{"type":"boolean","default":false}}},"maxItems":500,"default":[]}},"required":["collectionId","expectedVersion"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"collection":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"title":{"type":"string","minLength":1,"maxLength":200},"goal":{"type":"string","maxLength":4000,"default":""},"constraints":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"chosenDirection":{"type":"string","maxLength":4000,"default":""},"unresolvedDecisions":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"version":{"type":"integer","minimum":0},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","title","version","createdAt","updatedAt"]},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"fragmentId":{"type":["string","null"]},"assetId":{"type":["string","null"]},"researchCandidateId":{"type":["string","null"]},"disposition":{"type":"string","enum":["included","excluded"],"default":"included"},"borrowNote":{"type":["string","null"],"maxLength":4000},"avoidNote":{"type":["string","null"],"maxLength":4000},"pinned":{"type":"boolean","default":false},"order":{"type":"integer","minimum":0},"position":{"type":["object","null"],"properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cropOverrideAssetId":{"type":["string","null"],"default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","collectionId","fragmentId","assetId","researchCandidateId","borrowNote","avoidNote","order","position","createdAt","updatedAt"]}},"fragments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceId":{"type":"string"},"sourceVersionId":{"type":"string"},"saveId":{"type":["string","null"]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":4000},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"mechanism":{"type":["string","null"],"maxLength":120},"uncertainties":{"type":"array","items":{"type":"string","maxLength":500},"default":[]},"anchor":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["text_span"]},"sourceVersionId":{"type":"string"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0}},"required":["kind","sourceVersionId","start","end"]},{"type":"object","properties":{"kind":{"type":"string","enum":["image_region"]},"assetId":{"type":"string"},"rect":{"type":"object","properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"required":["x","y","width","height"]}},"required":["kind","assetId","rect"]},{"type":"object","properties":{"kind":{"type":"string","enum":["video_range"]},"assetId":{"type":"string"},"startMs":{"type":"integer","minimum":0},"endMs":{"type":"integer","minimum":0}},"required":["kind","assetId","startMs","endMs"]}]},"cropAssetId":{"type":["string","null"]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"enrichmentVersion":{"type":"string"},"userCorrections":{"type":"object","properties":{"title":{"type":["string","null"],"maxLength":200},"description":{"type":["string","null"],"maxLength":4000},"concepts":{"type":["array","null"],"items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]}},"updatedAt":{"type":["string","null"],"format":"date-time"}},"default":{"title":null,"description":null,"concepts":null,"updatedAt":null},"required":["title","description","concepts","updatedAt"]},"kind":{"type":"string","enum":["saved","research_candidate"],"default":"saved"},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","sourceId","sourceVersionId","saveId","title","description","mechanism","anchor","cropAssetId","origin","enrichmentVersion","createdAt","updatedAt"]}},"candidates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"runId":{"type":"string"},"url":{"type":"string","format":"uri"},"title":{"type":["string","null"],"maxLength":300},"contribution":{"type":"string","maxLength":2000},"verified":{"type":"boolean"},"assetIds":{"type":"array","items":{"type":"string"},"default":[]},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"],"default":"model_inferred"},"selectedIntoCollectionId":{"type":["string","null"],"default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","runId","url","title","contribution","verified","createdAt"]}},"assets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sourceVersionId":{"type":["string","null"]},"parentAssetId":{"type":["string","null"]},"objectKey":{"type":"string"},"mimeType":{"type":"string"},"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"bytes":{"type":"integer","minimum":0},"checksum":{"type":"string"},"capturedAt":{"type":"string","format":"date-time"},"viewport":{"type":["object","null"],"properties":{"width":{"type":"integer","exclusiveMinimum":0},"height":{"type":"integer","exclusiveMinimum":0},"deviceScaleFactor":{"type":"number","exclusiveMinimum":0,"default":1}},"required":["width","height"]},"origin":{"type":"string","enum":["attachment","live_screenshot","crop","upload","research_fetch"]},"exportPolicy":{"type":"string","enum":["bundle","reference_only","restricted"]},"derivatives":{"type":"object","properties":{"webp":{"type":["string","null"]},"thumb":{"type":["string","null"]}},"default":{"webp":null,"thumb":null},"required":["webp","thumb"]},"cropRect":{"type":["object","null"],"properties":{"x":{"type":"number","minimum":0,"maximum":1},"y":{"type":"number","minimum":0,"maximum":1},"width":{"type":"number","minimum":0,"maximum":1},"height":{"type":"number","minimum":0,"maximum":1}},"default":null,"required":["x","y","width","height"]},"label":{"type":["string","null"],"maxLength":200,"default":null},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sourceVersionId","parentAssetId","objectKey","mimeType","width","height","bytes","checksum","capturedAt","viewport","origin","exportPolicy","createdAt"]}},"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string","enum":["x","pinterest","dribbble","web","upload"]},"platformId":{"type":"string","minLength":1},"canonicalUrl":{"type":"string","format":"uri"},"creatorHandle":{"type":["string","null"],"maxLength":200},"creatorName":{"type":["string","null"],"maxLength":200},"publishedAt":{"type":["string","null"],"format":"date-time"},"firstObservedAt":{"type":"string","format":"date-time"},"accessState":{"type":"string","enum":["public","authorized","inaccessible","unknown"],"default":"unknown"},"retention":{"type":"string","enum":["keep","reference_only"],"default":"keep"},"currentVersionId":{"type":["string","null"]},"deletedAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","platform","platformId","canonicalUrl","creatorHandle","creatorName","publishedAt","firstObservedAt","currentVersionId","createdAt","updatedAt"]}},"relationships":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["links_to","example_of","similar_layout","similar_style","variation_of","contrasts_with"]},"from":{"type":"object","properties":{"type":{"type":"string","enum":["fragment","source"]},"id":{"type":"string"}},"required":["type","id"]},"to":{"type":"object","properties":{"type":{"type":"string","enum":["fragment","source"]},"id":{"type":"string"}},"required":["type","id"]},"explanation":{"type":"string","maxLength":2000},"evidenceIds":{"type":"array","items":{"type":"string"},"default":[]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"]},"status":{"type":"string","enum":["suggested","confirmed","rejected"]},"score":{"type":["number","null"],"minimum":0,"maximum":1,"default":null},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","type","from","to","explanation","origin","status","createdAt","updatedAt"]}},"searches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"query":{"type":"string","minLength":1,"maxLength":1000},"kind":{"type":"string","enum":["library","research","manual"],"default":"library"},"runId":{"type":["string","null"],"default":null},"status":{"type":"string","enum":["searching","ready","error"],"default":"ready"},"position":{"type":["object","null"],"properties":{"x":{"type":"number"},"y":{"type":"number"}},"default":null,"required":["x","y"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","collectionId","query","createdAt","updatedAt"]},"default":[]},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"searchId":{"type":"string"},"memberId":{"type":"string"},"score":{"type":["number","null"],"default":null},"reason":{"type":["string","null"],"maxLength":1000,"default":null},"cutAt":{"type":["string","null"],"format":"date-time","default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","collectionId","searchId","memberId","createdAt"]},"default":[]}},"required":["collection","members","fragments","candidates","assets","sources","relationships"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"409":{"description":"Collection version mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["version_conflict"]},"currentVersion":{"type":"integer"},"message":{"type":"string"},"details":{"type":"object","properties":{"currentVersion":{"type":"integer"}},"required":["currentVersion"]}},"required":["error","currentVersion","message","details"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/collections/{id}/export":{"post":{"operationId":"post__api_collections_id_export","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"collectionId":{"type":"string"},"expectedVersion":{"type":["integer","null"],"minimum":0,"default":null},"limits":{"type":"object","properties":{"maxImages":{"type":"integer","exclusiveMinimum":0,"default":60},"maxBytes":{"type":"integer","exclusiveMinimum":0,"default":157286400},"maxTextChars":{"type":"integer","exclusiveMinimum":0,"default":200000}},"default":{}},"researchMediaPolicy":{"type":"string","enum":["bundle","reference_only"],"default":"bundle"},"audience":{"type":"string","enum":["project","agent"],"default":"project"}},"required":["collectionId"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"},"collectionVersion":{"type":"integer"}},"required":["runId","collectionVersion"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"409":{"description":"Collection version mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","enum":["version_conflict"]},"currentVersion":{"type":"integer"},"message":{"type":"string"},"details":{"type":"object","properties":{"currentVersion":{"type":"integer"}},"required":["currentVersion"]}},"required":["error","currentVersion","message","details"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/exports/{runId}":{"get":{"operationId":"get__api_exports_runId_","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Export not ready","content":{"application/json":{"schema":{"type":"object","properties":{"state":{"type":"string","enum":["queued","running","paused","cancelling","cancelled","succeeded","partial","failed"]}},"required":["state"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/research":{"post":{"operationId":"post__api_research","description":"Requires research token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["research"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"collectionId":{"type":"string"},"question":{"type":"string","minLength":3,"maxLength":1000},"fragmentIds":{"type":"array","items":{"type":"string"},"maxItems":20,"default":[]},"budget":{"type":"object","properties":{"maxSearches":{"type":"integer","minimum":0,"default":6},"maxPages":{"type":"integer","minimum":0,"default":12},"maxCandidates":{"type":"integer","minimum":0,"default":8},"maxModelCalls":{"type":"integer","minimum":0,"default":40},"maxTokens":{"type":"integer","minimum":0,"default":200000},"maxDurationMs":{"type":"integer","exclusiveMinimum":0,"default":600000}},"default":{}}},"required":["collectionId","question"]}}}},"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}},"required":["runId"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/runs":{"get":{"operationId":"get__api_runs","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"parameters":[{"schema":{"type":"string","enum":["ingestion","research","export","connector_sync","reenrich"]},"required":false,"name":"type","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":30},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["ingestion","research","export","connector_sync","reenrich"]},"state":{"type":"string","enum":["queued","running","paused","cancelling","cancelled","succeeded","partial","failed"]},"ownerId":{"type":"string"},"subjectId":{"type":["string","null"]},"input":{"type":"object","additionalProperties":{},"default":{}},"checkpoint":{"type":"object","additionalProperties":{},"default":{}},"budget":{"type":["object","null"],"properties":{"maxSearches":{"type":"integer","minimum":0,"default":6},"maxPages":{"type":"integer","minimum":0,"default":12},"maxCandidates":{"type":"integer","minimum":0,"default":8},"maxModelCalls":{"type":"integer","minimum":0,"default":40},"maxTokens":{"type":"integer","minimum":0,"default":200000},"maxDurationMs":{"type":"integer","exclusiveMinimum":0,"default":600000}},"default":null},"usage":{"type":"object","properties":{"searches":{"type":"integer","minimum":0,"default":0},"pages":{"type":"integer","minimum":0,"default":0},"candidates":{"type":"integer","minimum":0,"default":0},"modelCalls":{"type":"integer","minimum":0,"default":0},"inputTokens":{"type":"integer","minimum":0,"default":0},"outputTokens":{"type":"integer","minimum":0,"default":0},"retries":{"type":"integer","minimum":0,"default":0},"costUsd":{"type":["number","null"],"minimum":0,"default":null}},"default":{"searches":0,"pages":0,"candidates":0,"modelCalls":0,"inputTokens":0,"outputTokens":0,"retries":0,"costUsd":null}},"errors":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"stage":{"type":"string"},"code":{"type":"string"},"message":{"type":"string","maxLength":2000},"retryable":{"type":"boolean","default":false}},"required":["at","stage","code","message"]},"default":[]},"artifacts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"id":{"type":["string","null"]},"objectKey":{"type":["string","null"]}},"required":["kind","id","objectKey"]},"default":[]},"outboundQueries":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"provider":{"type":"string"},"query":{"type":"string"}},"required":["at","provider","query"]},"default":[]},"fetchedUrls":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"url":{"type":"string","format":"uri"},"status":{"type":"string","enum":["ok","blocked_by_guard","http_error","timeout","too_large","unverified"]},"httpStatus":{"type":["integer","null"],"default":null},"note":{"type":["string","null"],"maxLength":500,"default":null}},"required":["at","url","status"]},"default":[]},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","type","state","ownerId","subjectId","startedAt","finishedAt","createdAt","updatedAt"]}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/runs/{id}":{"get":{"operationId":"get__api_runs_id_","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["ingestion","research","export","connector_sync","reenrich"]},"state":{"type":"string","enum":["queued","running","paused","cancelling","cancelled","succeeded","partial","failed"]},"ownerId":{"type":"string"},"subjectId":{"type":["string","null"]},"input":{"type":"object","additionalProperties":{},"default":{}},"checkpoint":{"type":"object","additionalProperties":{},"default":{}},"budget":{"type":["object","null"],"properties":{"maxSearches":{"type":"integer","minimum":0,"default":6},"maxPages":{"type":"integer","minimum":0,"default":12},"maxCandidates":{"type":"integer","minimum":0,"default":8},"maxModelCalls":{"type":"integer","minimum":0,"default":40},"maxTokens":{"type":"integer","minimum":0,"default":200000},"maxDurationMs":{"type":"integer","exclusiveMinimum":0,"default":600000}},"default":null},"usage":{"type":"object","properties":{"searches":{"type":"integer","minimum":0,"default":0},"pages":{"type":"integer","minimum":0,"default":0},"candidates":{"type":"integer","minimum":0,"default":0},"modelCalls":{"type":"integer","minimum":0,"default":0},"inputTokens":{"type":"integer","minimum":0,"default":0},"outputTokens":{"type":"integer","minimum":0,"default":0},"retries":{"type":"integer","minimum":0,"default":0},"costUsd":{"type":["number","null"],"minimum":0,"default":null}},"default":{"searches":0,"pages":0,"candidates":0,"modelCalls":0,"inputTokens":0,"outputTokens":0,"retries":0,"costUsd":null}},"errors":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"stage":{"type":"string"},"code":{"type":"string"},"message":{"type":"string","maxLength":2000},"retryable":{"type":"boolean","default":false}},"required":["at","stage","code","message"]},"default":[]},"artifacts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"id":{"type":["string","null"]},"objectKey":{"type":["string","null"]}},"required":["kind","id","objectKey"]},"default":[]},"outboundQueries":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"provider":{"type":"string"},"query":{"type":"string"}},"required":["at","provider","query"]},"default":[]},"fetchedUrls":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"url":{"type":"string","format":"uri"},"status":{"type":"string","enum":["ok","blocked_by_guard","http_error","timeout","too_large","unverified"]},"httpStatus":{"type":["integer","null"],"default":null},"note":{"type":["string","null"],"maxLength":500,"default":null}},"required":["at","url","status"]},"default":[]},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","type","state","ownerId","subjectId","startedAt","finishedAt","createdAt","updatedAt"]},"progress":{"type":"object","properties":{"phase":{"type":"string"},"message":{"type":["string","null"]}},"required":["phase","message"]},"candidates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"runId":{"type":"string"},"url":{"type":"string","format":"uri"},"title":{"type":["string","null"],"maxLength":300},"contribution":{"type":"string","maxLength":2000},"verified":{"type":"boolean"},"assetIds":{"type":"array","items":{"type":"string"},"default":[]},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"],"default":"model_inferred"},"selectedIntoCollectionId":{"type":["string","null"],"default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","runId","url","title","contribution","verified","createdAt"]},"default":[]}},"required":["run","progress"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/runs/{id}/cancel":{"post":{"operationId":"post__api_runs_id_cancel","description":"Requires research token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["research"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["ingestion","research","export","connector_sync","reenrich"]},"state":{"type":"string","enum":["queued","running","paused","cancelling","cancelled","succeeded","partial","failed"]},"ownerId":{"type":"string"},"subjectId":{"type":["string","null"]},"input":{"type":"object","additionalProperties":{},"default":{}},"checkpoint":{"type":"object","additionalProperties":{},"default":{}},"budget":{"type":["object","null"],"properties":{"maxSearches":{"type":"integer","minimum":0,"default":6},"maxPages":{"type":"integer","minimum":0,"default":12},"maxCandidates":{"type":"integer","minimum":0,"default":8},"maxModelCalls":{"type":"integer","minimum":0,"default":40},"maxTokens":{"type":"integer","minimum":0,"default":200000},"maxDurationMs":{"type":"integer","exclusiveMinimum":0,"default":600000}},"default":null},"usage":{"type":"object","properties":{"searches":{"type":"integer","minimum":0,"default":0},"pages":{"type":"integer","minimum":0,"default":0},"candidates":{"type":"integer","minimum":0,"default":0},"modelCalls":{"type":"integer","minimum":0,"default":0},"inputTokens":{"type":"integer","minimum":0,"default":0},"outputTokens":{"type":"integer","minimum":0,"default":0},"retries":{"type":"integer","minimum":0,"default":0},"costUsd":{"type":["number","null"],"minimum":0,"default":null}},"default":{"searches":0,"pages":0,"candidates":0,"modelCalls":0,"inputTokens":0,"outputTokens":0,"retries":0,"costUsd":null}},"errors":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"stage":{"type":"string"},"code":{"type":"string"},"message":{"type":"string","maxLength":2000},"retryable":{"type":"boolean","default":false}},"required":["at","stage","code","message"]},"default":[]},"artifacts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"id":{"type":["string","null"]},"objectKey":{"type":["string","null"]}},"required":["kind","id","objectKey"]},"default":[]},"outboundQueries":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"provider":{"type":"string"},"query":{"type":"string"}},"required":["at","provider","query"]},"default":[]},"fetchedUrls":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","format":"date-time"},"url":{"type":"string","format":"uri"},"status":{"type":"string","enum":["ok","blocked_by_guard","http_error","timeout","too_large","unverified"]},"httpStatus":{"type":["integer","null"],"default":null},"note":{"type":["string","null"],"maxLength":500,"default":null}},"required":["at","url","status"]},"default":[]},"startedAt":{"type":["string","null"],"format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","type","state","ownerId","subjectId","startedAt","finishedAt","createdAt","updatedAt"]},"progress":{"type":"object","properties":{"phase":{"type":"string"},"message":{"type":["string","null"]}},"required":["phase","message"]},"candidates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"runId":{"type":"string"},"url":{"type":"string","format":"uri"},"title":{"type":["string","null"],"maxLength":300},"contribution":{"type":"string","maxLength":2000},"verified":{"type":"boolean"},"assetIds":{"type":"array","items":{"type":"string"},"default":[]},"concepts":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["component","style","material","interaction","mechanism"]},"term":{"type":"string","minLength":1,"maxLength":120},"confidence":{"type":"number","minimum":0,"maximum":1}},"required":["kind","term","confidence"]},"default":[]},"origin":{"type":"string","enum":["source_shown","model_inferred","user_stated"],"default":"model_inferred"},"selectedIntoCollectionId":{"type":["string","null"],"default":null},"createdAt":{"type":"string","format":"date-time"}},"required":["id","runId","url","title","contribution","verified","createdAt"]},"default":[]}},"required":["run","progress"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/connectors":{"get":{"operationId":"get__api_connectors","description":"Requires read token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["read"],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"kind":{"type":"string","enum":["x_bookmarks","pinterest","dribbble"]},"externalAccountId":{"type":["string","null"]},"displayName":{"type":["string","null"]},"state":{"type":"string","enum":["not_configured","authorization_required","connected","syncing","rate_limited","permission_blocked","error","unsupported_capability","fixture_mode"]},"stateDetail":{"type":["string","null"],"maxLength":1000},"scopes":{"type":"array","items":{"type":"string"},"default":[]},"pollIntervalMinutes":{"type":"integer","exclusiveMinimum":0,"default":30},"backfillLimit":{"type":"integer","exclusiveMinimum":0,"default":800},"coverage":{"type":"object","properties":{"oldestObservedAt":{"type":["string","null"],"format":"date-time"},"newestObservedAt":{"type":["string","null"],"format":"date-time"},"count":{"type":"integer","minimum":0}},"default":{"oldestObservedAt":null,"newestObservedAt":null,"count":0},"required":["oldestObservedAt","newestObservedAt","count"]},"lastSyncAt":{"type":["string","null"],"format":"date-time"},"lastError":{"type":["string","null"],"maxLength":2000},"rateLimitResetAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","kind","externalAccountId","displayName","state","stateDetail","lastSyncAt","lastError","rateLimitResetAt","createdAt","updatedAt"]}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/connectors/{kind}/authorize":{"post":{"operationId":"post__api_connectors_kind_authorize","description":"Owner session required; machine tokens are rejected.","security":[{"ownerSession":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"kind","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"redirectUrl":{"type":"string","format":"uri"}},"required":["redirectUrl"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/connectors/{kind}/callback":{"get":{"operationId":"get__api_connectors_kind_callback","description":"Owner session required; machine tokens are rejected.","security":[{"ownerSession":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"kind","in":"path"},{"schema":{"type":"string"},"required":true,"name":"code","in":"query"},{"schema":{"type":"string"},"required":true,"name":"state","in":"query"}],"responses":{"303":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/connectors/{kind}/sync":{"post":{"operationId":"post__api_connectors_kind_sync","description":"Requires collection:write token scope or owner session.","security":[{"ownerSession":[]},{"machineToken":[]}],"x-token-scopes":["collection:write"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"kind","in":"path"}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string"}},"required":["runId"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/tokens":{"get":{"operationId":"get__api_tokens","description":"Owner session required; machine tokens are rejected.","security":[{"ownerSession":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"type":"array","items":{"type":"string","enum":["read","collection:write","capture","research"]},"minItems":1},"tokenPrefix":{"type":"string"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"rateLimitPerMinute":{"type":"integer","exclusiveMinimum":0,"default":120},"createdAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","name","scopes","tokenPrefix","lastUsedAt","revokedAt","createdAt"]}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"post":{"operationId":"post__api_tokens","description":"Owner session required; machine tokens are rejected.","security":[{"ownerSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"type":"array","items":{"type":"string","enum":["read","collection:write","capture","research"]},"minItems":1},"rateLimitPerMinute":{"type":"integer","exclusiveMinimum":0,"maximum":6000,"default":120}},"required":["name","scopes"]}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"object","properties":{"id":{"type":"string"},"ownerId":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":100},"scopes":{"type":"array","items":{"type":"string","enum":["read","collection:write","capture","research"]},"minItems":1},"tokenPrefix":{"type":"string"},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"revokedAt":{"type":["string","null"],"format":"date-time"},"rateLimitPerMinute":{"type":"integer","exclusiveMinimum":0,"default":120},"createdAt":{"type":"string","format":"date-time"}},"required":["id","ownerId","name","scopes","tokenPrefix","lastUsedAt","revokedAt","createdAt"]},"secret":{"type":"string"}},"required":["token","secret"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/tokens/{id}":{"delete":{"operationId":"delete__api_tokens_id_","description":"Owner session required; machine tokens are rejected.","security":[{"ownerSession":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Success"},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/openapi.json":{"get":{"operationId":"get__api_openapi_json","description":"Public endpoint.","security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/mcp":{"post":{"operationId":"post__api_mcp","description":"Machine token required. Tool scope is enforced on each tools/call request.","security":[{"machineToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"405":{"description":"Stateless transport supports POST; there is no session or notification stream."},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"get":{"operationId":"get__api_mcp","description":"Machine token required. Tool scope is enforced on each tools/call request.","security":[{"machineToken":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"405":{"description":"Stateless transport supports POST; there is no session or notification stream."},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"delete":{"operationId":"delete__api_mcp","description":"Machine token required. Tool scope is enforced on each tools/call request.","security":[{"machineToken":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"401":{"description":"Missing, invalid or revoked credentials","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"403":{"description":"Missing scope, session required or origin rejected","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"404":{"description":"Record not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}},"405":{"description":"Stateless transport supports POST; there is no session or notification stream."},"429":{"description":"Machine token rate limit exceeded","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until retry"}},"content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}},"/api/auth/{path}":{"get":{"operationId":"get__api_auth_path_","description":"better-auth endpoint. Public sign-up is disabled; owner bootstrap runs locally.","security":[],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"path","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}},"post":{"operationId":"post__api_auth_path_","description":"better-auth endpoint. Public sign-up is disabled; owner bootstrap runs locally.","security":[],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"path","in":"path"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["error","message"]}}}}}}}},"webhooks":{}}