{"info":{"title":"Director API","version":"0.3.0","description":"Single source of truth consumed by the web app, native shells and services."},"servers":[{"url":"https://api.subash.us/api/v1"}],"openapi":"3.1.1","paths":{"/health":{"get":{"operationId":"system.health","summary":"Liveness probe","tags":["system"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"const":"ok"},"version":{"type":"string"},"time":{"type":"string","format":"date-time"}},"required":["status","version","time"]}}}}}}},"/auth-config":{"get":{"operationId":"system.authConfig","summary":"Sign-in methods enabled on this deployment","tags":["system"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"socialProviders":{"type":"array","items":{"enum":["github","google"],"type":"string"}},"requireEmailVerification":{"type":"boolean"}},"required":["socialProviders","requireEmailVerification"]}}}}}}},"/flags":{"get":{"operationId":"system.flags","summary":"Feature flags resolved for an organization (or the global defaults)","tags":["system"],"parameters":[{"name":"organizationId","in":"query","schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9._-]*$"},"additionalProperties":{"type":"boolean"}}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/contact":{"post":{"operationId":"contact.send","summary":"Message from the public contact / waitlist form (rate-limited per IP)","tags":["public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"name":{"type":"string","maxLength":120},"message":{"type":"string","minLength":10,"maxLength":2000},"website":{"type":"string","maxLength":200}},"required":["email","message"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"const":true}},"required":["ok"]}}}},"412":{"description":"412","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PRECONDITION_FAILED"},"status":{"const":412},"message":{"type":"string","default":"The contact form is not configured on this deployment."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/admin/organizations":{"get":{"operationId":"admin.organizations.list","summary":"Organizations with size and billing state (platform admins)","tags":["admin"],"parameters":[{"name":"search","in":"query","schema":{"type":"string","maxLength":80},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"allowEmptyValue":true,"allowReserved":true},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"maximum":9007199254740991,"default":0},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"stripeCustomerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"members":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"workspaces":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"plan":{"anyOf":[{"enum":["free","pro","team"],"type":"string"},{"type":"null"}]},"seats":{"type":"object","properties":{"billed":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"members":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["billed","members"]},"subscription":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"plan":{"type":"string"},"status":{"enum":["active","canceled","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"],"type":"string"},"seats":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"periodEnd":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"cancelAtPeriodEnd":{"type":"boolean"},"stripeSubscriptionId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","plan","status","seats","periodEnd","cancelAtPeriodEnd","stripeSubscriptionId"]},{"type":"null"}]}},"required":["id","name","slug","createdAt","stripeCustomerId","members","workspaces","plan","seats","subscription"]}},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["items","total"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/admin/organizations/{organizationId}/cancel-subscription":{"post":{"operationId":"admin.organizations.cancelSubscription","summary":"Force-cancel an organization’s Stripe subscription (platform admins)","tags":["admin"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"immediately":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"enum":["active","canceled","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"],"type":"string"},"cancelAtPeriodEnd":{"type":"boolean"}},"required":["status","cancelAtPeriodEnd"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"This organization has no live subscription."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"412":{"description":"412","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PRECONDITION_FAILED"},"status":{"const":412},"message":{"type":"string","default":"Billing is not configured on this deployment."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/admin/organizations/{organizationId}":{"delete":{"operationId":"admin.organizations.delete","summary":"Delete an organization and everything in it (platform admins)","tags":["admin"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirmSlug":{"type":"string","minLength":2,"maxLength":48,"pattern":"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"}},"required":["confirmSlug"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"objectsDeleted":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"objectsFailed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["organizationId","objectsDeleted","objectsFailed"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"No such organization."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"412":{"description":"412","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PRECONDITION_FAILED"},"status":{"const":412},"message":{"type":"string","default":"This organization still has a live subscription. Cancel it before deleting the organization."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/admin/flags":{"get":{"operationId":"admin.flags.list","summary":"All feature flags","tags":["admin"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9._-]*$"},"description":{"type":"string"},"enabled":{"type":"boolean"},"overrides":{"type":"array","items":{"type":"object","properties":{"organizationId":{"type":"string"},"enabled":{"type":"boolean"}},"required":["organizationId","enabled"]}},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["key","description","enabled","overrides","createdAt","updatedAt"]}}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/admin/flags/{key}":{"put":{"operationId":"admin.flags.upsert","summary":"Create a feature flag or change its description / global default","tags":["admin"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9._-]*$"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string","maxLength":200},"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9._-]*$"},"description":{"type":"string"},"enabled":{"type":"boolean"},"overrides":{"type":"array","items":{"type":"object","properties":{"organizationId":{"type":"string"},"enabled":{"type":"boolean"}},"required":["organizationId","enabled"]}},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["key","description","enabled","overrides","createdAt","updatedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}},"delete":{"operationId":"admin.flags.delete","summary":"Delete a feature flag and its overrides","tags":["admin"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9._-]*$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9._-]*$"}},"required":["key"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"No such flag."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/admin/flags/{key}/organizations/{organizationId}":{"put":{"operationId":"admin.flags.setOverride","summary":"Force a flag on or off for one organization (`null` removes the override)","tags":["admin"],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9._-]*$"}},{"name":"organizationId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"required":["enabled"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9._-]*$"},"description":{"type":"string"},"enabled":{"type":"boolean"},"overrides":{"type":"array","items":{"type":"object","properties":{"organizationId":{"type":"string"},"enabled":{"type":"boolean"}},"required":["organizationId","enabled"]}},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["key","description","enabled","overrides","createdAt","updatedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"No such flag or organization."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/admin/system":{"get":{"operationId":"admin.system.status","summary":"Version, database and migrations, service health, configuration","tags":["admin"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string"},"environment":{"type":"string"},"runtime":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"uptimeSeconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"counts":{"type":"object","properties":{"users":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"organizations":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"workspaces":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"subscriptions":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["users","organizations","workspaces","subscriptions"]},"database":{"type":"object","properties":{"ok":{"type":"boolean"},"latencyMs":{"anyOf":[{"type":"number"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"migrations":{"anyOf":[{"type":"object","properties":{"shipped":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"applied":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pending":{"type":"array","items":{"type":"string"}},"unknown":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"latestApplied":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["shipped","applied","pending","unknown","latestApplied"]},{"type":"null"}]}},"required":["ok","latencyMs","error","migrations"]},"ai":{"type":"object","properties":{"ok":{"type":"boolean"},"latencyMs":{"anyOf":[{"type":"number"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"type":"string"},"problems":{"type":"array","items":{"type":"string"},"default":[]},"provider":{"anyOf":[{"type":"string"},{"type":"null"}]},"ocr":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["ok","latencyMs","error","url","provider","ocr"]},"queue":{"type":"object","properties":{"configured":{"type":"boolean"},"worker":{"enum":["inline","off"],"type":"string"},"concurrency":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"depth":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"running":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"failed":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"oldestQueuedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["configured","worker","concurrency","depth","running","failed","oldestQueuedAt"]},"storage":{"type":"object","properties":{"driver":{"enum":["local","s3"],"type":"string"},"location":{"type":"string"},"maxUploadBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["driver","location","maxUploadBytes"]},"billing":{"type":"object","properties":{"enabled":{"type":"boolean"},"unpricedPlans":{"type":"array","items":{"type":"string"}}},"required":["enabled","unpricedPlans"]},"email":{"type":"object","properties":{"provider":{"type":"string"},"from":{"type":"string"}},"required":["provider","from"]},"auth":{"type":"object","properties":{"socialProviders":{"type":"array","items":{"enum":["github","google"],"type":"string"}},"requireEmailVerification":{"type":"boolean"}},"required":["socialProviders","requireEmailVerification"]}},"required":["version","environment","runtime","startedAt","uptimeSeconds","counts","database","ai","queue","storage","billing","email","auth"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/me":{"get":{"operationId":"account.me","summary":"Current user","tags":["account"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"image":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","email","name","image","role","createdAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/organizations/{organizationId}/usage":{"get":{"operationId":"organizations.usage","summary":"Plan, limits and current usage of an organization","tags":["organizations"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"anyOf":[{"enum":["free","pro","team"],"type":"string"},{"type":"null"}]},"limits":{"anyOf":[{"type":"object","properties":{"workspaces":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"members":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"aiCredits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"storageBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["workspaces","members","aiCredits","storageBytes"]},{"type":"null"}]},"usage":{"type":"object","properties":{"workspaces":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"members":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pendingInvitations":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"aiCredits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["workspaces","members","pendingInvitations","aiCredits"]},"period":{"type":"object","properties":{"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"}},"required":["start","end"]}},"required":["plan","limits","usage","period"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/organizations/{organizationId}/audit-log":{"get":{"operationId":"organizations.auditLog","summary":"Audit log (owners and admins), newest first","tags":["organizations"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"actorId":{"anyOf":[{"type":"string"},{"type":"null"}]},"actorEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"impersonatedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"action":{"type":"string"},"targetType":{"anyOf":[{"type":"string"},{"type":"null"}]},"targetId":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","actorId","actorEmail","impersonatedBy","action","targetType","targetId","metadata","createdAt"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["entries","nextCursor"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/organizations/{organizationId}/billing":{"get":{"operationId":"billing.status","summary":"Plan, subscription state and payment health of an organization","tags":["billing"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"plan":{"anyOf":[{"enum":["free","pro","team"],"type":"string"},{"type":"null"}]},"limits":{"anyOf":[{"type":"object","properties":{"workspaces":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"members":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"aiCredits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"storageBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["workspaces","members","aiCredits","storageBytes"]},{"type":"null"}]},"subscription":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"plan":{"type":"string"},"status":{"enum":["active","canceled","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"],"type":"string"},"seats":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"periodEnd":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"trialEnd":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"cancelAtPeriodEnd":{"type":"boolean"},"cancelAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"billingInterval":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","plan","status","seats","periodEnd","trialEnd","cancelAtPeriodEnd","cancelAt","billingInterval"]},{"type":"null"}]},"paymentFailed":{"type":"boolean"},"overLimit":{"type":"array","items":{"type":"object","properties":{"kind":{"enum":["workspaces","members","aiCredits"],"type":"string"},"current":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limit":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["kind","current","limit"]}}},"required":["enabled","plan","limits","subscription","paymentFailed","overLimit"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/workspaces":{"get":{"operationId":"workspaces.list","summary":"List workspaces in an organization","tags":["workspaces"],"parameters":[{"name":"organizationId","in":"query","required":true,"schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"teamId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","teamId","name","slug","createdAt"]}}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}},"post":{"operationId":"workspaces.create","summary":"Create a workspace","tags":["workspaces"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"teamId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string","minLength":1,"maxLength":80},"slug":{"type":"string","minLength":2,"maxLength":48,"pattern":"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"}},"required":["organizationId","name","slug"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"teamId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","teamId","name","slug","createdAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LIMIT_REACHED"},"status":{"const":403},"message":{"type":"string","default":"This organization has reached a limit of its plan."},"data":{"type":"object","properties":{"kind":{"enum":["workspaces","members","aiCredits","storageBytes"],"type":"string"},"limit":{"type":"number"},"plan":{"type":"string"}},"required":["kind","limit","plan"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Team not found in this organization."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONFLICT"},"status":{"const":409},"message":{"type":"string","default":"A workspace with this slug already exists."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/workspaces/{slug}":{"get":{"operationId":"workspaces.get","summary":"Get a workspace by slug","tags":["workspaces"],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","minLength":2,"maxLength":48,"pattern":"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"}},{"name":"organizationId","in":"query","required":true,"schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"teamId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"storage":{"type":"object","properties":{"usedBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limitBytes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["usedBytes","limitBytes"]}},"required":["id","organizationId","teamId","name","slug","createdAt","storage"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Workspace not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/workspaces/{id}":{"patch":{"operationId":"workspaces.update","summary":"Rename a workspace, change its slug or team","tags":["workspaces"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"slug":{"type":"string","minLength":2,"maxLength":48,"pattern":"^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$"},"teamId":{"anyOf":[{"type":"string"},{"type":"null"}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"teamId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","teamId","name","slug","createdAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Workspace not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONFLICT"},"status":{"const":409},"message":{"type":"string","default":"A workspace with this slug already exists."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}},"delete":{"operationId":"workspaces.delete","summary":"Delete a workspace","tags":["workspaces"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Workspace not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/workspaces/{workspaceId}/documents":{"get":{"operationId":"documents.list","summary":"Documents of a workspace, newest first","tags":["documents"],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"organizationId","in":"query","required":true,"schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"type":"string"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"enum":["pending","ready"],"type":"string"},"extracted":{"anyOf":[{"type":"object","properties":{"characters":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pages":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"at":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["characters","pages","at"]},{"type":"null"}]},"indexedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"chunkCount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","uploadedBy","name","contentType","size","status","extracted","indexedAt","chunkCount","createdAt","updatedAt"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"storage":{"type":"object","properties":{"usedBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"limitBytes":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["usedBytes","limitBytes"]}},"required":["items","nextCursor","storage"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Workspace not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/workspaces/{workspaceId}/documents/search":{"post":{"operationId":"documents.search","summary":"Semantic search over indexed documents of a workspace (`document.index` jobs)","tags":["documents"],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":1000},"limit":{"type":"integer","minimum":1,"maximum":50,"default":10}},"required":["query"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"chunkId":{"type":"string"},"documentId":{"type":"string"},"documentName":{"type":"string"},"index":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"text":{"type":"string"},"score":{"type":"number"}},"required":["chunkId","documentId","documentName","index","text","score"]}}},"required":["model","results"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LIMIT_REACHED"},"status":{"const":403},"message":{"type":"string","default":"This organization has reached a limit of its plan."},"data":{"type":"object","properties":{"kind":{"enum":["workspaces","members","aiCredits","storageBytes"],"type":"string"},"limit":{"type":"number"},"plan":{"type":"string"}},"required":["kind","limit","plan"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Workspace not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"429":{"description":"429","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TOO_MANY_REQUESTS"},"status":{"const":429},"message":{"type":"string","default":"Too many searches — try again in a minute."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"503":{"description":"503","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"SERVICE_UNAVAILABLE"},"status":{"const":503},"message":{"type":"string","default":"The AI service could not embed the query."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/documents/{id}":{"get":{"operationId":"documents.get","summary":"One document","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"type":"string"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"enum":["pending","ready"],"type":"string"},"extracted":{"anyOf":[{"type":"object","properties":{"characters":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pages":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"at":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["characters","pages","at"]},{"type":"null"}]},"indexedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"chunkCount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","uploadedBy","name","contentType","size","status","extracted","indexedAt","chunkCount","createdAt","updatedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Document not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}},"delete":{"operationId":"documents.delete","summary":"Delete a document and its stored file","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Document not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/documents":{"post":{"operationId":"documents.createUpload","summary":"Register a document and get a presigned upload URL for its bytes","tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":200},"contentType":{"enum":["application/pdf","text/plain","text/markdown","text/csv","text/html","application/json","image/png","image/jpeg","image/webp","image/tiff"],"type":"string"},"size":{"type":"integer","minimum":1,"maximum":1073741824}},"required":["organizationId","workspaceId","name","contentType","size"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"type":"string"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"enum":["pending","ready"],"type":"string"},"extracted":{"anyOf":[{"type":"object","properties":{"characters":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pages":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"at":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["characters","pages","at"]},{"type":"null"}]},"indexedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"chunkCount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","uploadedBy","name","contentType","size","status","extracted","indexedAt","chunkCount","createdAt","updatedAt"]},"upload":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"method":{"const":"PUT"},"headers":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"expiresAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["url","method","headers","expiresAt"]}},"required":["document","upload"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LIMIT_REACHED"},"status":{"const":403},"message":{"type":"string","default":"This organization has reached a limit of its plan."},"data":{"type":"object","properties":{"kind":{"enum":["workspaces","members","aiCredits","storageBytes"],"type":"string"},"limit":{"type":"number"},"plan":{"type":"string"}},"required":["kind","limit","plan"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Workspace not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"413":{"description":"413","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAYLOAD_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"This file is larger than the upload limit."},"data":{"type":"object","properties":{"maxBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["maxBytes"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/documents/{id}/complete":{"post":{"operationId":"documents.complete","summary":"Confirm the upload: verifies the stored object and marks the document ready","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"type":"string"},"uploadedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"status":{"enum":["pending","ready"],"type":"string"},"extracted":{"anyOf":[{"type":"object","properties":{"characters":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"pages":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"at":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["characters","pages","at"]},{"type":"null"}]},"indexedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"chunkCount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","uploadedBy","name","contentType","size","status","extracted","indexedAt","chunkCount","createdAt","updatedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LIMIT_REACHED"},"status":{"const":403},"message":{"type":"string","default":"This organization has reached a limit of its plan."},"data":{"type":"object","properties":{"kind":{"enum":["workspaces","members","aiCredits","storageBytes"],"type":"string"},"limit":{"type":"number"},"plan":{"type":"string"}},"required":["kind","limit","plan"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Document not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"412":{"description":"412","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PRECONDITION_FAILED"},"status":{"const":412},"message":{"type":"string","default":"The upload has not arrived or its size does not match."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"413":{"description":"413","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PAYLOAD_TOO_LARGE"},"status":{"const":413},"message":{"type":"string","default":"The uploaded object is larger than was declared; it has been discarded."},"data":{"type":"object","properties":{"maxBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["maxBytes"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/documents/{id}/download-url":{"get":{"operationId":"documents.downloadUrl","summary":"Short-lived presigned URL to download the original file","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["url","expiresAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Document not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"412":{"description":"412","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PRECONDITION_FAILED"},"status":{"const":412},"message":{"type":"string","default":"The document has not been uploaded yet."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/documents/{id}/text":{"get":{"operationId":"documents.text","summary":"Extracted text of a document (`null` until a `document.extract` job succeeded)","tags":["documents"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"characters":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"pages":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"extractedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]}},"required":["text","characters","pages","extractedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Document not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/organizations/{organizationId}/jobs":{"get":{"operationId":"jobs.list","summary":"Jobs of an organization (optionally one workspace or document), newest first","tags":["jobs"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspaceId","in":"query","schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"documentId","in":"query","schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"status","in":"query","schema":{"enum":["queued","running","succeeded","failed","canceled"],"type":"string"},"allowEmptyValue":true,"allowReserved":true},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"allowEmptyValue":true,"allowReserved":true},{"name":"cursor","in":"query","schema":{"type":"string","minLength":1,"maxLength":200},"allowEmptyValue":true,"allowReserved":true},{"name":"includeResult","in":"query","schema":{"type":"boolean","default":false},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"enum":["document.extract","document.summarize","document.index","text.summarize","text.embed"],"type":"string"},"status":{"enum":["queued","running","succeeded","failed","canceled"],"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"credits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"runAt":{"type":"string","format":"date-time","x-native-type":"date"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","documentId","createdBy","kind","status","attempts","maxAttempts","input","result","error","credits","runAt","createdAt","startedAt","finishedAt","updatedAt"]}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/jobs/{id}":{"get":{"operationId":"jobs.get","summary":"One job","tags":["jobs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"enum":["document.extract","document.summarize","document.index","text.summarize","text.embed"],"type":"string"},"status":{"enum":["queued","running","succeeded","failed","canceled"],"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"credits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"runAt":{"type":"string","format":"date-time","x-native-type":"date"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","documentId","createdBy","kind","status","attempts","maxAttempts","input","result","error","credits","runAt","createdAt","startedAt","finishedAt","updatedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Job not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/jobs":{"post":{"operationId":"jobs.create","summary":"Queue a job; charges its credits against the plan","tags":["jobs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"kind":{"const":"document.extract"},"organizationId":{"type":"string"},"documentId":{"type":"string"}},"required":["kind","organizationId","documentId"]},{"type":"object","properties":{"kind":{"const":"document.summarize"},"organizationId":{"type":"string"},"documentId":{"type":"string"},"maxSentences":{"type":"integer","minimum":1,"maximum":20,"default":3}},"required":["kind","organizationId","documentId"]},{"type":"object","properties":{"kind":{"const":"document.index"},"organizationId":{"type":"string"},"documentId":{"type":"string"}},"required":["kind","organizationId","documentId"]},{"type":"object","properties":{"kind":{"const":"text.summarize"},"organizationId":{"type":"string"},"workspaceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string","minLength":1,"maxLength":200000},"maxSentences":{"type":"integer","minimum":1,"maximum":20,"default":3}},"required":["kind","organizationId","text"]},{"type":"object","properties":{"kind":{"const":"text.embed"},"organizationId":{"type":"string"},"workspaceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"texts":{"type":"array","minItems":1,"maxItems":16,"items":{"type":"string","minLength":1,"maxLength":8000}}},"required":["kind","organizationId","texts"]}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"enum":["document.extract","document.summarize","document.index","text.summarize","text.embed"],"type":"string"},"status":{"enum":["queued","running","succeeded","failed","canceled"],"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"credits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"runAt":{"type":"string","format":"date-time","x-native-type":"date"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","documentId","createdBy","kind","status","attempts","maxAttempts","input","result","error","credits","runAt","createdAt","startedAt","finishedAt","updatedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LIMIT_REACHED"},"status":{"const":403},"message":{"type":"string","default":"This organization has reached a limit of its plan."},"data":{"type":"object","properties":{"kind":{"enum":["workspaces","members","aiCredits","storageBytes"],"type":"string"},"limit":{"type":"number"},"plan":{"type":"string"}},"required":["kind","limit","plan"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Document or workspace not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"412":{"description":"412","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"PRECONDITION_FAILED"},"status":{"const":412},"message":{"type":"string","default":"The document has not finished uploading."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/jobs/{id}/cancel":{"post":{"operationId":"jobs.cancel","summary":"Cancel a queued job and refund its credits","tags":["jobs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"enum":["document.extract","document.summarize","document.index","text.summarize","text.embed"],"type":"string"},"status":{"enum":["queued","running","succeeded","failed","canceled"],"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"credits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"runAt":{"type":"string","format":"date-time","x-native-type":"date"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","documentId","createdBy","kind","status","attempts","maxAttempts","input","result","error","credits","runAt","createdAt","startedAt","finishedAt","updatedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Job not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONFLICT"},"status":{"const":409},"message":{"type":"string","default":"Only queued jobs can be canceled."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/jobs/{id}/retry":{"post":{"operationId":"jobs.retry","summary":"Queue a fresh copy of a failed job (charges its credits again)","tags":["jobs"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"enum":["document.extract","document.summarize","document.index","text.summarize","text.embed"],"type":"string"},"status":{"enum":["queued","running","succeeded","failed","canceled"],"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"credits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"runAt":{"type":"string","format":"date-time","x-native-type":"date"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","documentId","createdBy","kind","status","attempts","maxAttempts","input","result","error","credits","runAt","createdAt","startedAt","finishedAt","updatedAt"]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":true},"code":{"const":"LIMIT_REACHED"},"status":{"const":403},"message":{"type":"string","default":"This organization has reached a limit of its plan."},"data":{"type":"object","properties":{"kind":{"enum":["workspaces","members","aiCredits","storageBytes"],"type":"string"},"limit":{"type":"number"},"plan":{"type":"string"}},"required":["kind","limit","plan"]}},"required":["defined","code","status","message","data"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"404":{"description":"404","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"NOT_FOUND"},"status":{"const":404},"message":{"type":"string","default":"Job not found."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"409":{"description":"409","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"CONFLICT"},"status":{"const":409},"message":{"type":"string","default":"Only failed jobs can be retried."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}},"/organizations/{organizationId}/jobs/stream":{"get":{"operationId":"jobs.stream","summary":"Live job updates (server-sent events) for an organization or one workspace","tags":["jobs"],"parameters":[{"name":"organizationId","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspaceId","in":"query","schema":{"type":"string"},"allowEmptyValue":true,"allowReserved":true}],"responses":{"200":{"description":"OK","content":{"text/event-stream":{"schema":{"oneOf":[{"type":"object","properties":{"event":{"const":"message"},"data":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"workspaceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"documentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"enum":["document.extract","document.summarize","document.index","text.summarize","text.embed"],"type":"string"},"status":{"enum":["queued","running","succeeded","failed","canceled"],"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxAttempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"input":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"credits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"runAt":{"type":"string","format":"date-time","x-native-type":"date"},"createdAt":{"type":"string","format":"date-time","x-native-type":"date"},"startedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"finishedAt":{"anyOf":[{"type":"string","format":"date-time","x-native-type":"date"},{"type":"null"}]},"updatedAt":{"type":"string","format":"date-time","x-native-type":"date"}},"required":["id","organizationId","workspaceId","documentId","createdBy","kind","status","attempts","maxAttempts","input","result","error","credits","runAt","createdAt","startedAt","finishedAt","updatedAt"]},"id":{"type":"string"},"retry":{"type":"number"}},"required":["event","data"]},{"type":"object","properties":{"event":{"const":"done"},"data":{},"id":{"type":"string"},"retry":{"type":"number"}},"required":["event"]},{"type":"object","properties":{"event":{"const":"error"},"data":{},"id":{"type":"string"},"retry":{"type":"number"}},"required":["event"]}]}}}},"401":{"description":"401","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"UNAUTHORIZED"},"status":{"const":401},"message":{"type":"string","default":"You must be signed in."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"403":{"description":"403","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"FORBIDDEN"},"status":{"const":403},"message":{"type":"string","default":"You do not have access to this resource."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}},"429":{"description":"429","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"defined":{"const":true},"code":{"const":"TOO_MANY_REQUESTS"},"status":{"const":429},"message":{"type":"string","default":"Too many open job streams for this account."},"data":{}},"required":["defined","code","status","message"]},{"type":"object","properties":{"defined":{"const":false},"code":{"type":"string"},"status":{"type":"number"},"message":{"type":"string"},"data":{}},"required":["defined","code","status","message"]}]}}}}}}}}}