{"openapi":"3.0.3","info":{"title":"Latch API","version":"1.0.0","description":"Manage scripts, versions and access on Latch from your own site, CI or AI agent. Authenticate with an API key from your workspace's API page: `Authorization: Bearer ltk_…`. Server owners install the scripts in their Library with an account API key from Settings > API keys (`lta_…`), which only works for the Library endpoints."},"servers":[{"url":"https://api.heylatch.app/public/v1"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Workspace API key (ltk_…)"},"accountKey":{"type":"http","scheme":"bearer","description":"Account API key (lta_…), Library endpoints only"}}},"paths":{"/me":{"get":{"operationId":"getAccount","summary":"The account this account API key belongs to","description":"Use an account API key (lta_…) from Settings > API keys. It can only list and download scripts in your Library.","tags":["Library"],"security":[{"accountKey":[]}],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string"},"username":{"type":"string"},"displayName":{"type":"string"},"apiKey":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false}},"required":["accountId","username","displayName","apiKey"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/me/library":{"get":{"operationId":"listLibrary","summary":"Scripts you can install","description":"Scripts you've been granted access to, plus your own workspaces' scripts. `updateAvailable` is true when a newer version is out than the one you last downloaded.","tags":["Library"],"security":[{"accountKey":[]}],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"script":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"ecosystem":{"type":"string"},"latestVersion":{"nullable":true,"type":"string"}},"required":["id","slug","name","ecosystem","latestVersion"],"additionalProperties":false},"workspace":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"}},"required":["slug","name"],"additionalProperties":false},"status":{"type":"string","enum":["active","revoked"]},"own":{"type":"boolean","description":"The script belongs to a workspace you're a member of (no grant needed)"},"lastDownloadedVersion":{"nullable":true,"type":"string"},"updateAvailable":{"type":"boolean"},"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"description":"Bundles you hold that include this script"},"servers":{"type":"object","properties":{"limit":{"nullable":true,"type":"number"},"running":{"type":"number"}},"required":["limit","running"],"additionalProperties":false,"description":"How many of your servers (keys) can run this script at once with your access (limit, null = unlimited, set by the developer) and how many run it now"}},"required":["script","workspace","status","own","lastDownloadedVersion","updateAvailable","bundles","servers"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/me/library/{script}/versions/{version}/download":{"post":{"operationId":"downloadLibraryVersion","summary":"Get a download link for your copy of a version","description":"A short-lived link to the encrypted package, marked for your account, the same file the dashboard gives you. Counts as your downloaded version.","tags":["Library"],"security":[{"accountKey":[]}],"parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"fileName":{"type":"string"},"url":{"type":"string"}},"required":["fileName","url"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/latchadmin/manifest":{"get":{"operationId":"getPanelManifest","summary":"Latest LatchAdmin and game versions","description":"No key needed. Version numbers and urgent flags only; LatchAdmin downloads its own updates from GitHub and checks their signature.","tags":["LatchAdmin"],"security":[],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"object","additionalProperties":{"type":"object","properties":{"latest":{"nullable":true,"type":"string"},"releases":{"type":"array","items":{"type":"object","properties":{"version":{"type":"string"},"publishedAt":{"nullable":true,"type":"string"},"urgent":{"type":"boolean"},"note":{"nullable":true,"type":"string"}},"required":["version","publishedAt","urgent","note"],"additionalProperties":false}}},"required":["latest","releases"],"additionalProperties":false},"description":"Keys: latchadmin, arcane-mp, kingdoms-connected, mafia2-online. Releases are newest first. A release marked urgent is one the Latch team asks everyone to install."}},"required":["products"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/device/start":{"post":{"operationId":"startDeviceLink","summary":"Start linking a LatchAdmin panel to a Latch account","description":"Show `userCode` to the server owner and send them to `verifyUrl`. Then poll `/device/poll` every `interval` seconds. The code expires after `expiresIn` seconds.","tags":["LatchAdmin"],"security":[],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceName":{"type":"string","minLength":1,"maxLength":40}},"required":["deviceName"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deviceCode":{"type":"string"},"userCode":{"type":"string"},"verifyUrl":{"type":"string"},"verifyUrlComplete":{"type":"string"},"interval":{"type":"number"},"expiresIn":{"type":"number"}},"required":["deviceCode","userCode","verifyUrl","verifyUrlComplete","interval","expiresIn"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/device/poll":{"post":{"operationId":"pollDeviceLink","summary":"Check whether the server owner approved the link","description":"`approved` comes with an account API key (lta_…), returned only once. It appears under Settings > API keys and can be revoked there.","tags":["LatchAdmin"],"security":[],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceCode":{"type":"string","minLength":10,"maxLength":100}},"required":["deviceCode"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending","approved","denied","expired"]},"key":{"type":"string"}},"required":["status"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/me/panel":{"post":{"operationId":"reportPanel","summary":"Report a LatchAdmin panel's versions","description":"Sent by a linked LatchAdmin panel every 15 minutes: panel version, OS, and for each game server the game version, its state and the Latch scripts installed. No IPs, players, console output or config. The answer is the same manifest as /latchadmin/manifest.","tags":["LatchAdmin"],"security":[{"accountKey":[]}],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"instanceId":{"type":"string","pattern":"^[A-Za-z0-9-]{16,64}$"},"name":{"type":"string","minLength":1,"maxLength":60},"panelVersion":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+([-+][\\w.]{1,30})?$"},"os":{"type":"string","enum":["windows","linux","other"]},"servers":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"game":{"type":"string","pattern":"^[a-z0-9-]{1,32}$"},"gameVersion":{"nullable":true,"type":"string","maxLength":32},"state":{"type":"string","enum":["running","starting","stopped","crashed","updating"]},"scripts":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"scriptId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"version":{"type":"string","maxLength":32}},"required":["scriptId","version"]}}},"required":["game","gameVersion","state","scripts"]}}},"required":["instanceId","name","panelVersion","os","servers"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"object","additionalProperties":{"type":"object","properties":{"latest":{"nullable":true,"type":"string"},"releases":{"type":"array","items":{"type":"object","properties":{"version":{"type":"string"},"publishedAt":{"nullable":true,"type":"string"},"urgent":{"type":"boolean"},"note":{"nullable":true,"type":"string"}},"required":["version","publishedAt","urgent","note"],"additionalProperties":false}}},"required":["latest","releases"],"additionalProperties":false},"description":"Keys: latchadmin, arcane-mp, kingdoms-connected, mafia2-online. Releases are newest first. A release marked urgent is one the Latch team asks everyone to install."}},"required":["products"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/workspace":{"get":{"operationId":"getWorkspace","summary":"The workspace this API key belongs to","description":"Plan, script usage and the key's effective scopes (its scopes limited by its creator's current role).","tags":["Workspace"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"plan":{"type":"string"},"usage":{"type":"object","properties":{"scripts":{"type":"number"},"limit":{"nullable":true,"type":"number"}},"required":["scripts","limit"],"additionalProperties":false},"apiKey":{"type":"object","properties":{"name":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}},"required":["name","scopes"],"additionalProperties":false}},"required":["id","slug","name","status","plan","usage","apiKey"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts":{"get":{"operationId":"listScripts","summary":"List scripts","tags":["Scripts"],"x-latch-scope":"scripts.view","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"ecosystem":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"dependencies":{"type":"array","items":{"type":"string"}},"offlineDays":{"type":"number","description":"Offline start: days a server can start and run without reaching Latch after its last check (0 = off, 30-minute grace only)"},"serverLimit":{"nullable":true,"description":"Default server limit for new grants: how many of an account's servers can run the script at once (null = unlimited). Existing grants keep theirs","type":"number"},"allowOldDownloads":{"type":"boolean","description":"Server owners can download older ready versions. When false they only get the newest ready version; your team can always download any version"},"status":{"type":"string","enum":["draft","processing","ready","withdrawn","suspended","error"]},"latestVersion":{"nullable":true,"description":"Newest ready version","type":"string"},"grantCount":{"type":"number"},"activationCount":{"type":"number"},"openFlags":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","slug","name","description","ecosystem","category","tags","dependencies","offlineDays","serverLimit","allowOldDownloads","status","latestVersion","grantCount","activationCount","openFlags","createdAt","updatedAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"createScript","summary":"Create a script with its first version","description":"Creates the script and a draft first version, and returns a presigned upload URL. PUT your package (.zip, or .jar for Hytale) to it, then call publishVersion. The version is built and encrypted on our side; poll getVersion until it is ready or error.","tags":["Scripts"],"x-latch-scope":"scripts.create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+$"},"changelog":{"default":"","type":"string","maxLength":5000},"dependencies":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":60}},"minRuntime":{"type":"string","maxLength":20},"keepReadable":{"default":[],"maxItems":500,"type":"array","items":{"type":"string","maxLength":300}},"obfuscateClient":{"type":"boolean"},"name":{"type":"string","minLength":1,"maxLength":60},"slug":{"type":"string","pattern":"^[a-z0-9-]{2,40}$"},"description":{"type":"string","minLength":1,"maxLength":5000},"category":{"type":"string","maxLength":30},"ecosystem":{"description":"Game the script is for. mafiahub covers every MafiaHub game (Arcane MP, Kingdoms Connected, Mafia 2 Online, Fallout MP).","type":"string","enum":["mafiahub","hytale"]},"tags":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","maxLength":30}}},"required":["version","name","slug","description","category","ecosystem"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"script":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"ecosystem":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"dependencies":{"type":"array","items":{"type":"string"}},"offlineDays":{"type":"number","description":"Offline start: days a server can start and run without reaching Latch after its last check (0 = off, 30-minute grace only)"},"serverLimit":{"nullable":true,"description":"Default server limit for new grants: how many of an account's servers can run the script at once (null = unlimited). Existing grants keep theirs","type":"number"},"allowOldDownloads":{"type":"boolean","description":"Server owners can download older ready versions. When false they only get the newest ready version; your team can always download any version"},"status":{"type":"string","enum":["draft","processing","ready","withdrawn","suspended","error"]},"latestVersion":{"nullable":true,"description":"Newest ready version","type":"string"},"grantCount":{"type":"number"},"activationCount":{"type":"number"},"openFlags":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","slug","name","description","ecosystem","category","tags","dependencies","offlineDays","serverLimit","allowOldDownloads","status","latestVersion","grantCount","activationCount","openFlags","createdAt","updatedAt"],"additionalProperties":false},"version":{"type":"object","properties":{"version":{"type":"string"},"status":{"type":"string","enum":["draft","processing","review","ready","withdrawn","error"],"description":"review: held for a check by the Latch team before anyone gets it"},"changelog":{"type":"string"},"size":{"nullable":true,"description":"Built package size in bytes","type":"number"},"sha256":{"nullable":true,"type":"string"},"buildError":{"nullable":true,"description":"Why the build failed (status error)","type":"string"},"scanFlags":{"type":"array","items":{},"description":"Files flagged for team review, e.g. native binaries"},"permissions":{"type":"array","items":{"type":"string"},"description":"Declared in package.json \"latch.permissions\": process (child_process and similar), native (.node addons). The loader refuses anything not declared."},"createdAt":{"type":"string"}},"required":["version","status","changelog","size","sha256","buildError","scanFlags","permissions","createdAt"],"additionalProperties":false},"upload":{"nullable":true,"type":"object","properties":{"url":{"type":"string","description":"Presigned URL. PUT the .zip or .jar here with Content-Type: application/zip. Expires in 10 minutes."}},"required":["url"],"additionalProperties":false}},"required":["script","version","upload"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}":{"get":{"operationId":"getScript","summary":"Get a script and its versions","description":"`script` is the script's id or slug.","tags":["Scripts"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"ecosystem":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"dependencies":{"type":"array","items":{"type":"string"}},"offlineDays":{"type":"number","description":"Offline start: days a server can start and run without reaching Latch after its last check (0 = off, 30-minute grace only)"},"serverLimit":{"nullable":true,"description":"Default server limit for new grants: how many of an account's servers can run the script at once (null = unlimited). Existing grants keep theirs","type":"number"},"allowOldDownloads":{"type":"boolean","description":"Server owners can download older ready versions. When false they only get the newest ready version; your team can always download any version"},"status":{"type":"string","enum":["draft","processing","ready","withdrawn","suspended","error"]},"latestVersion":{"nullable":true,"description":"Newest ready version","type":"string"},"grantCount":{"type":"number"},"activationCount":{"type":"number"},"openFlags":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"versions":{"type":"array","items":{"type":"object","properties":{"version":{"type":"string"},"status":{"type":"string","enum":["draft","processing","review","ready","withdrawn","error"],"description":"review: held for a check by the Latch team before anyone gets it"},"changelog":{"type":"string"},"size":{"nullable":true,"description":"Built package size in bytes","type":"number"},"sha256":{"nullable":true,"type":"string"},"buildError":{"nullable":true,"description":"Why the build failed (status error)","type":"string"},"scanFlags":{"type":"array","items":{},"description":"Files flagged for team review, e.g. native binaries"},"permissions":{"type":"array","items":{"type":"string"},"description":"Declared in package.json \"latch.permissions\": process (child_process and similar), native (.node addons). The loader refuses anything not declared."},"createdAt":{"type":"string"}},"required":["version","status","changelog","size","sha256","buildError","scanFlags","permissions","createdAt"],"additionalProperties":false}}},"required":["id","slug","name","description","ecosystem","category","tags","dependencies","offlineDays","serverLimit","allowOldDownloads","status","latestVersion","grantCount","activationCount","openFlags","createdAt","updatedAt","versions"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"operationId":"updateScript","summary":"Update a script's name, description, category, tags, offline start (offlineDays: 0, 1, 3 or 7), whether server owners can download older versions (allowOldDownloads) or the default server limit for new grants (serverLimit)","tags":["Scripts"],"x-latch-scope":"versions.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"description":{"type":"string","maxLength":5000},"category":{"type":"string","maxLength":30},"tags":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":30}},"offlineDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"allowOldDownloads":{"type":"boolean"},"serverLimit":{"nullable":true,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"ecosystem":{"type":"string"},"category":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"dependencies":{"type":"array","items":{"type":"string"}},"offlineDays":{"type":"number","description":"Offline start: days a server can start and run without reaching Latch after its last check (0 = off, 30-minute grace only)"},"serverLimit":{"nullable":true,"description":"Default server limit for new grants: how many of an account's servers can run the script at once (null = unlimited). Existing grants keep theirs","type":"number"},"allowOldDownloads":{"type":"boolean","description":"Server owners can download older ready versions. When false they only get the newest ready version; your team can always download any version"},"status":{"type":"string","enum":["draft","processing","ready","withdrawn","suspended","error"]},"latestVersion":{"nullable":true,"description":"Newest ready version","type":"string"},"grantCount":{"type":"number"},"activationCount":{"type":"number"},"openFlags":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","slug","name","description","ecosystem","category","tags","dependencies","offlineDays","serverLimit","allowOldDownloads","status","latestVersion","grantCount","activationCount","openFlags","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/listing":{"get":{"operationId":"getListing","summary":"Get a script's Explore listing","tags":["Explore"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean","description":"The workspace's studio page is on (Pro and above; see updateStudio)"},"live":{"type":"boolean","description":"The script's page is visible on Explore right now"},"listed":{"type":"boolean"},"free":{"type":"boolean","description":"Anyone signed in can add it to their Library in one click"},"about":{"type":"string","description":"Listing text (Markdown) shown on the script's Explore page"},"hidden":{"type":"boolean","description":"Hidden by the Latch team"},"views":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Page views in the last 30 days"},"freeAdds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Accounts that added it from Explore"},"buyPlatform":{"type":"string","description":"Where the script is sold, shown on its Explore page as \"Buy on <platform>\" (empty when not set)"},"buyUrl":{"nullable":true,"description":"https page the buy button opens in a new tab","type":"string"},"url":{"nullable":true,"type":"string"}},"required":["enabled","live","listed","free","about","hidden","views","freeAdds","buyPlatform","buyUrl","url"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"operationId":"updateListing","summary":"List a script on Explore, make it free to use, change its listing text or set its buy button","description":"Needs a Pro plan or above and the workspace's studio page turned on (updateStudio, or workspace settings in the dashboard). Only published scripts with a ready version and at least one gallery image (addImage) can be listed.","tags":["Explore"],"x-latch-scope":"versions.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"listed":{"description":"Show the script on your studio page and in the Explore directory","type":"boolean"},"free":{"description":"Let anyone signed in add it to their Library. Turning it off stops new adds; existing access stays.","type":"boolean"},"about":{"description":"Listing text in Markdown (headings, lists, tables, links, code; no HTML or images)","type":"string","maxLength":8000},"buyPlatform":{"description":"Where the script is sold, e.g. BuiltByBit, Tebex or your own site (up to 24 characters). With buyUrl, the Explore page shows a \"Buy on <platform>\" button. Empty or null removes it.","nullable":true,"type":"string","maxLength":200},"buyUrl":{"description":"https link for the buy button, opened in a new tab. Empty or null removes it. A free script can't have a buy link (buyWithFree).","nullable":true,"type":"string","maxLength":400}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean","description":"The workspace's studio page is on (Pro and above; see updateStudio)"},"live":{"type":"boolean","description":"The script's page is visible on Explore right now"},"listed":{"type":"boolean"},"free":{"type":"boolean","description":"Anyone signed in can add it to their Library in one click"},"about":{"type":"string","description":"Listing text (Markdown) shown on the script's Explore page"},"hidden":{"type":"boolean","description":"Hidden by the Latch team"},"views":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Page views in the last 30 days"},"freeAdds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Accounts that added it from Explore"},"buyPlatform":{"type":"string","description":"Where the script is sold, shown on its Explore page as \"Buy on <platform>\" (empty when not set)"},"buyUrl":{"nullable":true,"description":"https page the buy button opens in a new tab","type":"string"},"url":{"nullable":true,"type":"string"}},"required":["enabled","live","listed","free","about","hidden","views","freeAdds","buyPlatform","buyUrl","url"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/images":{"get":{"operationId":"listImages","summary":"List a script's gallery images","description":"In gallery order. The first one is the script's cover on Explore.","tags":["Explore"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Order in the gallery, lowest first. The first image is the cover on Explore."}},"required":["id","url","position"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"addImage","summary":"Add an image to a script's gallery","description":"Up to 6 images per script, added at the end. A script needs at least one image to be listed on Explore.","tags":["Explore"],"x-latch-scope":"versions.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"image":{"type":"string","maxLength":8388608,"description":"The image as a base64 data URL: data:image/png;base64,… (png, jpeg or webp, up to 4 MB)"}},"required":["image"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"position":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Order in the gallery, lowest first. The first image is the cover on Explore."}},"required":["id","url","position"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/images/{image}":{"delete":{"operationId":"removeImage","summary":"Remove an image from a script's gallery","description":"`image` is the image's id. Removing a listed script's last image takes its page off Explore until you add one again.","tags":["Explore"],"x-latch-scope":"versions.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"image","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/studio":{"get":{"operationId":"getStudio","summary":"Get the workspace's Explore studio page","description":"The public studio page that lists your scripts on Explore, and the Explore state of each published script.","tags":["Explore"],"x-latch-scope":"scripts.view","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"allowed":{"type":"boolean","description":"The plan includes Explore (Pro and above)"},"live":{"type":"boolean","description":"The studio page is visible on Explore right now: it's turned on and at least one script is live"},"url":{"nullable":true,"type":"string"},"public":{"type":"boolean","description":"Show on Explore is turned on"},"tagline":{"type":"string"},"about":{"type":"string","description":"Markdown"},"website":{"nullable":true,"type":"string"},"discord":{"nullable":true,"type":"string"},"accent":{"type":"string","enum":["neutral","blue","emerald","amber","rose","violet"]},"banner":{"nullable":true,"description":"Banner image URL","type":"string"},"pinnedScript":{"nullable":true,"description":"Shown first and larger on the studio page","type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"],"additionalProperties":false},"showStats":{"type":"boolean","description":"Show how many accounts use the scripts and how many servers run them"},"hidden":{"type":"boolean","description":"Hidden by the Latch team"},"hiddenReason":{"nullable":true,"type":"string"},"verified":{"type":"boolean"},"views":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Studio page views in the last 30 days"},"scripts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"images":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"listable":{"type":"boolean","description":"Published with a ready version and at least one gallery image"},"listed":{"type":"boolean"},"live":{"type":"boolean"}},"required":["id","slug","name","images","listable","listed","live"],"additionalProperties":false},"description":"Published scripts and their Explore state"}},"required":["allowed","live","url","public","tagline","about","website","discord","accent","banner","pinnedScript","showStats","hidden","hiddenReason","verified","views","scripts"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"operationId":"updateStudio","summary":"Turn the studio page on or off, or change its text, links, banner or pinned script","description":"Needs a Pro plan or above. Scripts appear on the studio page once they're listed (updateListing) and have at least one gallery image. Send only the fields you want to change.","tags":["Explore"],"x-latch-scope":"settings.manage","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"public":{"description":"Show on Explore: turns the studio page on or off. Off hides the page and every listed script; access people have isn't affected.","type":"boolean"},"tagline":{"description":"One line shown on the studio card","type":"string","maxLength":80},"about":{"description":"Studio page text in Markdown (headings, lists, tables, links, code; no HTML or images)","type":"string","maxLength":4000},"website":{"description":"A full https:// address. Empty string removes it.","type":"string","maxLength":300},"discord":{"description":"A discord.gg or discord.com invite (https://). Empty string removes it.","type":"string","maxLength":300},"accent":{"type":"string","enum":["neutral","blue","emerald","amber","rose","violet"]},"banner":{"description":"A base64 data URL (png, jpeg or webp, up to 4 MB), or null to remove the banner","nullable":true,"type":"string","maxLength":8388608},"pinnedScript":{"description":"Slug or id of a script to pin, or null to unpin","nullable":true,"type":"string","minLength":1},"showStats":{"description":"Show usage numbers (accounts and servers) on the studio page","type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"allowed":{"type":"boolean","description":"The plan includes Explore (Pro and above)"},"live":{"type":"boolean","description":"The studio page is visible on Explore right now: it's turned on and at least one script is live"},"url":{"nullable":true,"type":"string"},"public":{"type":"boolean","description":"Show on Explore is turned on"},"tagline":{"type":"string"},"about":{"type":"string","description":"Markdown"},"website":{"nullable":true,"type":"string"},"discord":{"nullable":true,"type":"string"},"accent":{"type":"string","enum":["neutral","blue","emerald","amber","rose","violet"]},"banner":{"nullable":true,"description":"Banner image URL","type":"string"},"pinnedScript":{"nullable":true,"description":"Shown first and larger on the studio page","type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"],"additionalProperties":false},"showStats":{"type":"boolean","description":"Show how many accounts use the scripts and how many servers run them"},"hidden":{"type":"boolean","description":"Hidden by the Latch team"},"hiddenReason":{"nullable":true,"type":"string"},"verified":{"type":"boolean"},"views":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Studio page views in the last 30 days"},"scripts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"images":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"listable":{"type":"boolean","description":"Published with a ready version and at least one gallery image"},"listed":{"type":"boolean"},"live":{"type":"boolean"}},"required":["id","slug","name","images","listable","listed","live"],"additionalProperties":false},"description":"Published scripts and their Explore state"}},"required":["allowed","live","url","public","tagline","about","website","discord","accent","banner","pinnedScript","showStats","hidden","hiddenReason","verified","views","scripts"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/versions":{"get":{"operationId":"listVersions","summary":"List a script's versions, newest first","tags":["Versions"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"version":{"type":"string"},"status":{"type":"string","enum":["draft","processing","review","ready","withdrawn","error"],"description":"review: held for a check by the Latch team before anyone gets it"},"changelog":{"type":"string"},"size":{"nullable":true,"description":"Built package size in bytes","type":"number"},"sha256":{"nullable":true,"type":"string"},"buildError":{"nullable":true,"description":"Why the build failed (status error)","type":"string"},"scanFlags":{"type":"array","items":{},"description":"Files flagged for team review, e.g. native binaries"},"permissions":{"type":"array","items":{"type":"string"},"description":"Declared in package.json \"latch.permissions\": process (child_process and similar), native (.node addons). The loader refuses anything not declared."},"createdAt":{"type":"string"}},"required":["version","status","changelog","size","sha256","buildError","scanFlags","permissions","createdAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"createVersion","summary":"Create a new version","description":"Creates a draft version (higher than every existing one) and returns a presigned upload URL. PUT the package, then call publishVersion.","tags":["Versions"],"x-latch-scope":"versions.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string","pattern":"^\\d+\\.\\d+\\.\\d+$"},"changelog":{"default":"","type":"string","maxLength":5000},"dependencies":{"maxItems":30,"type":"array","items":{"type":"string","maxLength":60}},"keepReadable":{"default":[],"maxItems":500,"type":"array","items":{"type":"string","maxLength":300}},"obfuscateClient":{"type":"boolean"}},"required":["version"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"object","properties":{"version":{"type":"string"},"status":{"type":"string","enum":["draft","processing","review","ready","withdrawn","error"],"description":"review: held for a check by the Latch team before anyone gets it"},"changelog":{"type":"string"},"size":{"nullable":true,"description":"Built package size in bytes","type":"number"},"sha256":{"nullable":true,"type":"string"},"buildError":{"nullable":true,"description":"Why the build failed (status error)","type":"string"},"scanFlags":{"type":"array","items":{},"description":"Files flagged for team review, e.g. native binaries"},"permissions":{"type":"array","items":{"type":"string"},"description":"Declared in package.json \"latch.permissions\": process (child_process and similar), native (.node addons). The loader refuses anything not declared."},"createdAt":{"type":"string"}},"required":["version","status","changelog","size","sha256","buildError","scanFlags","permissions","createdAt"],"additionalProperties":false},"upload":{"nullable":true,"type":"object","properties":{"url":{"type":"string","description":"Presigned URL. PUT the .zip or .jar here with Content-Type: application/zip. Expires in 10 minutes."}},"required":["url"],"additionalProperties":false}},"required":["version","upload"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/versions/{version}":{"get":{"operationId":"getVersion","summary":"Get a version's build status","description":"Poll this after publishing: status goes processing → ready, or error with buildError explaining why.","tags":["Versions"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string"},"status":{"type":"string","enum":["draft","processing","review","ready","withdrawn","error"],"description":"review: held for a check by the Latch team before anyone gets it"},"changelog":{"type":"string"},"size":{"nullable":true,"description":"Built package size in bytes","type":"number"},"sha256":{"nullable":true,"type":"string"},"buildError":{"nullable":true,"description":"Why the build failed (status error)","type":"string"},"scanFlags":{"type":"array","items":{},"description":"Files flagged for team review, e.g. native binaries"},"permissions":{"type":"array","items":{"type":"string"},"description":"Declared in package.json \"latch.permissions\": process (child_process and similar), native (.node addons). The loader refuses anything not declared."},"createdAt":{"type":"string"}},"required":["version","status","changelog","size","sha256","buildError","scanFlags","permissions","createdAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/versions/{version}/publish":{"post":{"operationId":"publishVersion","summary":"Publish an uploaded version","description":"Starts the build of a draft (or failed) version whose package you uploaded. Returns immediately with status processing; everyone with access is notified once it is ready.","tags":["Versions"],"x-latch-scope":"versions.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string"},"status":{"type":"string","enum":["draft","processing","review","ready","withdrawn","error"],"description":"review: held for a check by the Latch team before anyone gets it"},"changelog":{"type":"string"},"size":{"nullable":true,"description":"Built package size in bytes","type":"number"},"sha256":{"nullable":true,"type":"string"},"buildError":{"nullable":true,"description":"Why the build failed (status error)","type":"string"},"scanFlags":{"type":"array","items":{},"description":"Files flagged for team review, e.g. native binaries"},"permissions":{"type":"array","items":{"type":"string"},"description":"Declared in package.json \"latch.permissions\": process (child_process and similar), native (.node addons). The loader refuses anything not declared."},"createdAt":{"type":"string"}},"required":["version","status","changelog","size","sha256","buildError","scanFlags","permissions","createdAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/versions/{version}/withdraw":{"post":{"operationId":"withdrawVersion","summary":"Withdraw a version","description":"Hides the version from downloads. Servers already running it keep running.","tags":["Versions"],"x-latch-scope":"versions.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string"},"status":{"type":"string","enum":["draft","processing","review","ready","withdrawn","error"],"description":"review: held for a check by the Latch team before anyone gets it"},"changelog":{"type":"string"},"size":{"nullable":true,"description":"Built package size in bytes","type":"number"},"sha256":{"nullable":true,"type":"string"},"buildError":{"nullable":true,"description":"Why the build failed (status error)","type":"string"},"scanFlags":{"type":"array","items":{},"description":"Files flagged for team review, e.g. native binaries"},"permissions":{"type":"array","items":{"type":"string"},"description":"Declared in package.json \"latch.permissions\": process (child_process and similar), native (.node addons). The loader refuses anything not declared."},"createdAt":{"type":"string"}},"required":["version","status","changelog","size","sha256","buildError","scanFlags","permissions","createdAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/versions/{version}/download":{"post":{"operationId":"downloadVersion","summary":"Get a download link for a version's protected package","description":"A short-lived link to the encrypted package, marked for the key's creator, so you can install it on your own servers. It runs with the license key of any workspace member. Server owners you grant access to download from their Library instead.","tags":["Versions"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"fileName":{"type":"string"},"url":{"type":"string"}},"required":["fileName","url"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/versions/{version}/rollback":{"post":{"operationId":"rollbackVersion","summary":"Roll back the newest version (Pro and up)","description":"Withdraws the newest ready version and tells everyone who downloaded it to go back to the previous one. Servers keep running what they have until they replace it.","tags":["Versions"],"x-latch-scope":"versions.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string"},"previous":{"type":"string"},"notified":{"type":"number"}},"required":["version","previous","notified"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/grants":{"get":{"operationId":"listGrants","summary":"List accounts with access","tags":["Access"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}},{"name":"offset","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","revoked"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"},"direct":{"type":"boolean","description":"Granted to the account on its own. False when the access comes only from a bundle."},"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"description":"Active bundles the account holds that include this script."},"serverLimit":{"nullable":true,"description":"How many of the account's servers can run the script at once (null = unlimited)","type":"number"}},"required":["id","status","account","grantedAt","revokedAt","direct","bundles","serverLimit"],"additionalProperties":false}},"hasMore":{"type":"boolean"},"nextOffset":{"nullable":true,"type":"number"}},"required":["data","hasMore","nextOffset"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"grantAccess","summary":"Grant an account access","description":"Gives the account access to the script on all of its servers. Safe to retry: if the account already has access, the existing grant is returned with created: false. The account owner gets an email.","tags":["Access"],"x-latch-scope":"access.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","minLength":1,"description":"The account ID the server owner shared, e.g. LA-7K2M-9QXD"},"serverLimit":{"description":"How many of the account's servers can run the script at once (null = unlimited). Defaults to the script's serverLimit. Can only be raised later.","nullable":true,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["accountId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grant":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"},"direct":{"type":"boolean","description":"Granted to the account on its own. False when the access comes only from a bundle."},"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"description":"Active bundles the account holds that include this script."},"serverLimit":{"nullable":true,"description":"How many of the account's servers can run the script at once (null = unlimited)","type":"number"}},"required":["id","status","account","grantedAt","revokedAt","direct","bundles","serverLimit"],"additionalProperties":false},"created":{"type":"boolean"}},"required":["grant","created"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/grants/bulk":{"post":{"operationId":"grantAccessBulk","summary":"Grant up to 100 accounts access (Studio and Enterprise)","description":"Each account is processed on its own; one failure doesn't stop the others.","tags":["Access"],"x-latch-scope":"access.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountIds":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"string","minLength":1}},"serverLimit":{"description":"How many of the account's servers can run the script at once (null = unlimited). Defaults to the script's serverLimit. Can only be raised later.","nullable":true,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["accountIds"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"ok":{"type":"boolean"},"created":{"type":"boolean"},"grant":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"},"direct":{"type":"boolean","description":"Granted to the account on its own. False when the access comes only from a bundle."},"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"description":"Active bundles the account holds that include this script."},"serverLimit":{"nullable":true,"description":"How many of the account's servers can run the script at once (null = unlimited)","type":"number"}},"required":["id","status","account","grantedAt","revokedAt","direct","bundles","serverLimit"],"additionalProperties":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"],"additionalProperties":false}},"required":["accountId","ok"],"additionalProperties":false}}},"required":["results"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/grants/revoke":{"post":{"operationId":"revokeAccess","summary":"Revoke an account's access","description":"The script stops on the account's servers at their next license check; the servers themselves keep running. Safe to retry.","tags":["Access"],"x-latch-scope":"access.manage","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","minLength":1,"description":"The account ID the server owner shared, e.g. LA-7K2M-9QXD"},"serverLimit":{"description":"How many of the account's servers can run the script at once (null = unlimited). Defaults to the script's serverLimit. Can only be raised later.","nullable":true,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["accountId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grant":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"},"direct":{"type":"boolean","description":"Granted to the account on its own. False when the access comes only from a bundle."},"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"description":"Active bundles the account holds that include this script."},"serverLimit":{"nullable":true,"description":"How many of the account's servers can run the script at once (null = unlimited)","type":"number"}},"required":["id","status","account","grantedAt","revokedAt","direct","bundles","serverLimit"],"additionalProperties":false}},"required":["grant"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/grants/{grant}/revoke":{"post":{"operationId":"revokeGrant","summary":"Revoke a grant by id","tags":["Access"],"x-latch-scope":"access.manage","parameters":[{"name":"grant","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grant":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"},"direct":{"type":"boolean","description":"Granted to the account on its own. False when the access comes only from a bundle."},"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"description":"Active bundles the account holds that include this script."},"serverLimit":{"nullable":true,"description":"How many of the account's servers can run the script at once (null = unlimited)","type":"number"}},"required":["id","status","account","grantedAt","revokedAt","direct","bundles","serverLimit"],"additionalProperties":false}},"required":["grant"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/grants/{grant}":{"patch":{"operationId":"updateGrant","summary":"Raise a grant's server limit","description":"serverLimit can only go up (or to null, unlimited): an account never loses servers it already has. Lowering it fails with serverLimitLower.","tags":["Access"],"x-latch-scope":"access.manage","parameters":[{"name":"grant","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"serverLimit":{"nullable":true,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["serverLimit"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grant":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"},"direct":{"type":"boolean","description":"Granted to the account on its own. False when the access comes only from a bundle."},"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"description":"Active bundles the account holds that include this script."},"serverLimit":{"nullable":true,"description":"How many of the account's servers can run the script at once (null = unlimited)","type":"number"}},"required":["id","status","account","grantedAt","revokedAt","direct","bundles","serverLimit"],"additionalProperties":false}},"required":["grant"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/grants/{grant}/restore":{"post":{"operationId":"restoreGrant","summary":"Restore a revoked grant","tags":["Access"],"x-latch-scope":"access.manage","parameters":[{"name":"grant","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grant":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"},"direct":{"type":"boolean","description":"Granted to the account on its own. False when the access comes only from a bundle."},"bundles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"description":"Active bundles the account holds that include this script."},"serverLimit":{"nullable":true,"description":"How many of the account's servers can run the script at once (null = unlimited)","type":"number"}},"required":["id","status","account","grantedAt","revokedAt","direct","bundles","serverLimit"],"additionalProperties":false}},"required":["grant"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/bundles":{"get":{"operationId":"listBundles","summary":"List bundles","description":"Bundles group scripts so an account can be given access to all of them at once.","tags":["Bundles"],"x-latch-scope":"scripts.view","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"scripts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"],"additionalProperties":false}},"holders":{"type":"number","description":"Accounts that currently hold the bundle"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","scripts","holders","createdAt","updatedAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"createBundle","summary":"Create a bundle","description":"Names are unique within the workspace (up to 60 characters). Creating a bundle gives nobody access yet; grant it to accounts afterwards.","tags":["Bundles"],"x-latch-scope":"access.manage","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"scripts":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","minLength":1},"description":"Script ids or slugs from this workspace"}},"required":["name","scripts"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"scripts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"],"additionalProperties":false}},"holders":{"type":"number","description":"Accounts that currently hold the bundle"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","scripts","holders","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/bundles/{bundle}":{"get":{"operationId":"getBundle","summary":"Get a bundle","description":"`bundle` is the bundle id or its exact name.","tags":["Bundles"],"x-latch-scope":"scripts.view","parameters":[{"name":"bundle","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"scripts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"],"additionalProperties":false}},"holders":{"type":"number","description":"Accounts that currently hold the bundle"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","scripts","holders","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"operationId":"updateBundle","summary":"Rename a bundle or change its scripts","description":"`bundle` is the bundle id or its exact name. `scripts` replaces the whole list. Bundles are live: scripts you add are given to every account holding the bundle, and scripts you remove are taken from them unless they also have the script directly or through another bundle. `granted` and `revoked` count the account-script accesses that changed.","tags":["Bundles"],"x-latch-scope":"access.manage","parameters":[{"name":"bundle","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"scripts":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"string","minLength":1},"description":"Script ids or slugs from this workspace"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"bundle":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"scripts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"],"additionalProperties":false}},"holders":{"type":"number","description":"Accounts that currently hold the bundle"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","scripts","holders","createdAt","updatedAt"],"additionalProperties":false},"granted":{"type":"number"},"revoked":{"type":"number"}},"required":["bundle","granted","revoked"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"operationId":"deleteBundle","summary":"Delete a bundle","description":"`bundle` is the bundle id or its exact name. Accounts holding the bundle lose its scripts unless they also have them directly or through another bundle. `revoked` counts the accesses that closed.","tags":["Bundles"],"x-latch-scope":"access.manage","parameters":[{"name":"bundle","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"revoked":{"type":"number"}},"required":["ok","revoked"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/bundles/{bundle}/grants":{"get":{"operationId":"listBundleGrants","summary":"List accounts holding a bundle","description":"`bundle` is the bundle id or its exact name.","tags":["Bundles"],"x-latch-scope":"scripts.view","parameters":[{"name":"bundle","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}},{"name":"offset","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","revoked"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"}},"required":["id","status","account","grantedAt","revokedAt"],"additionalProperties":false}},"hasMore":{"type":"boolean"},"nextOffset":{"nullable":true,"type":"number"}},"required":["data","hasMore","nextOffset"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"grantBundle","summary":"Give an account a bundle","description":"`bundle` is the bundle id or its exact name. Gives the account every script in the bundle, now and as the bundle changes. Safe to retry: if the account already holds the bundle, created is false. The account owner gets one email for the whole bundle. `granted` counts scripts the account did not already have.","tags":["Bundles"],"x-latch-scope":"access.manage","parameters":[{"name":"bundle","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","minLength":1,"description":"The account ID the server owner shared, e.g. LA-7K2M-9QXD"},"serverLimit":{"description":"How many of the account's servers can run the script at once (null = unlimited). Defaults to the script's serverLimit. Can only be raised later.","nullable":true,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["accountId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grant":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"}},"required":["id","status","account","grantedAt","revokedAt"],"additionalProperties":false},"created":{"type":"boolean"},"granted":{"type":"number"}},"required":["grant","created","granted"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/bundles/{bundle}/grants/revoke":{"post":{"operationId":"revokeBundle","summary":"Revoke an account's bundle","description":"`bundle` is the bundle id or its exact name. The account loses the bundle's scripts unless it also has them directly or through another bundle; they stop at the next license check. Safe to retry. `revoked` counts the accesses that closed.","tags":["Bundles"],"x-latch-scope":"access.manage","parameters":[{"name":"bundle","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","minLength":1,"description":"The account ID the server owner shared, e.g. LA-7K2M-9QXD"},"serverLimit":{"description":"How many of the account's servers can run the script at once (null = unlimited). Defaults to the script's serverLimit. Can only be raised later.","nullable":true,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["accountId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grant":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","revoked"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"grantedAt":{"type":"string"},"revokedAt":{"nullable":true,"type":"string"}},"required":["id","status","account","grantedAt","revokedAt"],"additionalProperties":false},"revoked":{"type":"number"}},"required":["grant","revoked"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/activations":{"get":{"operationId":"listActivations","summary":"Servers currently running the script","description":"IP addresses are included only for keys with the scripts.manage scope.","tags":["Servers"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}},{"name":"offset","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"serverName":{"nullable":true,"type":"string"},"ip":{"nullable":true,"type":"string"},"lastSeen":{"type":"string"},"runtimeVersion":{"nullable":true,"type":"string"}},"required":["account","serverName","ip","lastSeen","runtimeVersion"],"additionalProperties":false}},"hasMore":{"type":"boolean"},"nextOffset":{"nullable":true,"type":"number"}},"required":["data","hasMore","nextOffset"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/scripts/{script}/flags":{"get":{"operationId":"listFlags","summary":"Key-sharing flags raised for the script","tags":["Servers"],"x-latch-scope":"scripts.view","parameters":[{"name":"script","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}},{"name":"offset","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","investigating","resolved","dismissed"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["concurrent","fingerprint","many_ips"]},"status":{"type":"string","enum":["open","investigating","resolved","dismissed"]},"account":{"type":"object","properties":{"accountId":{"type":"string","description":"Latch account ID, e.g. LA-7K2M-9QXD"},"username":{"type":"string"},"displayName":{"type":"string"}},"required":["accountId","username","displayName"],"additionalProperties":false},"detail":{},"createdAt":{"type":"string"}},"required":["id","type","status","account","detail","createdAt"],"additionalProperties":false}},"hasMore":{"type":"boolean"},"nextOffset":{"nullable":true,"type":"number"}},"required":["data","hasMore","nextOffset"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/flags/{flag}/resolve":{"post":{"operationId":"resolveFlag","summary":"Mark a flag as resolved","tags":["Servers"],"x-latch-scope":"flags.manage","parameters":[{"name":"flag","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/webhooks":{"get":{"operationId":"listWebhooks","summary":"List webhook endpoints","tags":["Webhooks"],"x-latch-scope":"webhooks.manage","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","description":"The address. The secret part of a Discord webhook address is hidden."},"kind":{"type":"string","enum":["generic","discord"],"description":"discord: a Discord channel webhook, which gets a formatted message instead of signed JSON"},"description":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"language":{"type":"string","description":"Language of Discord messages"},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"nullable":true,"type":"string"},"secretLast4":{"type":"string"},"lastSuccessAt":{"nullable":true,"type":"string"},"lastFailureAt":{"nullable":true,"type":"string"},"createdAt":{"type":"string"}},"required":["id","url","kind","description","events","language","status","disabledReason","secretLast4","lastSuccessAt","lastFailureAt","createdAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"createWebhook","summary":"Create a webhook endpoint (Studio and Enterprise)","description":"Latch POSTs JSON to the URL when a subscribed event happens. Events: version.ready, version.failed, version.withdrawn, version.rolled_back, access.granted, access.revoked, flag.opened. The signing secret is returned only once; verify the Latch-Signature header with it.","tags":["Webhooks"],"x-latch-scope":"webhooks.manage","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"description":"A public https:// address, or a Discord channel webhook address"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string"},"description":"Any of: version.ready, version.failed, version.withdrawn, version.rolled_back, access.granted, access.revoked, flag.opened"},"description":{"type":"string","maxLength":200},"language":{"description":"Discord messages only. Any of: en, tr, pt, fr, de, es, it, ru. Default: en","type":"string","maxLength":5}},"required":["url","events"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","description":"The address. The secret part of a Discord webhook address is hidden."},"kind":{"type":"string","enum":["generic","discord"],"description":"discord: a Discord channel webhook, which gets a formatted message instead of signed JSON"},"description":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"language":{"type":"string","description":"Language of Discord messages"},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"nullable":true,"type":"string"},"secretLast4":{"type":"string"},"lastSuccessAt":{"nullable":true,"type":"string"},"lastFailureAt":{"nullable":true,"type":"string"},"createdAt":{"type":"string"},"secret":{"type":"string"}},"required":["id","url","kind","description","events","language","status","disabledReason","secretLast4","lastSuccessAt","lastFailureAt","createdAt","secret"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/webhooks/{webhook}":{"patch":{"operationId":"updateWebhook","summary":"Change a webhook endpoint, or turn it on or off","tags":["Webhooks"],"x-latch-scope":"webhooks.manage","parameters":[{"name":"webhook","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"description":"A public https:// address, or a Discord channel webhook address"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string"},"description":"Any of: version.ready, version.failed, version.withdrawn, version.rolled_back, access.granted, access.revoked, flag.opened"},"description":{"type":"string","maxLength":200},"language":{"description":"Discord messages only. Any of: en, tr, pt, fr, de, es, it, ru. Default: en","type":"string","maxLength":5},"enabled":{"description":"Turn the endpoint on or off","type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","description":"The address. The secret part of a Discord webhook address is hidden."},"kind":{"type":"string","enum":["generic","discord"],"description":"discord: a Discord channel webhook, which gets a formatted message instead of signed JSON"},"description":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"language":{"type":"string","description":"Language of Discord messages"},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"nullable":true,"type":"string"},"secretLast4":{"type":"string"},"lastSuccessAt":{"nullable":true,"type":"string"},"lastFailureAt":{"nullable":true,"type":"string"},"createdAt":{"type":"string"}},"required":["id","url","kind","description","events","language","status","disabledReason","secretLast4","lastSuccessAt","lastFailureAt","createdAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"operationId":"deleteWebhook","summary":"Delete a webhook endpoint","tags":["Webhooks"],"x-latch-scope":"webhooks.manage","parameters":[{"name":"webhook","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/webhooks/{webhook}/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","summary":"Replace the signing secret","description":"The old secret stops signing right away. The new one is returned only once.","tags":["Webhooks"],"x-latch-scope":"webhooks.manage","parameters":[{"name":"webhook","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","description":"The address. The secret part of a Discord webhook address is hidden."},"kind":{"type":"string","enum":["generic","discord"],"description":"discord: a Discord channel webhook, which gets a formatted message instead of signed JSON"},"description":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"language":{"type":"string","description":"Language of Discord messages"},"status":{"type":"string","enum":["active","disabled"]},"disabledReason":{"nullable":true,"type":"string"},"secretLast4":{"type":"string"},"lastSuccessAt":{"nullable":true,"type":"string"},"lastFailureAt":{"nullable":true,"type":"string"},"createdAt":{"type":"string"},"secret":{"type":"string"}},"required":["id","url","kind","description","events","language","status","disabledReason","secretLast4","lastSuccessAt","lastFailureAt","createdAt","secret"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/webhooks/{webhook}/test":{"post":{"operationId":"testWebhook","summary":"Send a test event now and return the result","tags":["Webhooks"],"x-latch-scope":"webhooks.manage","parameters":[{"name":"webhook","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"endpointId":{"type":"string"},"event":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"number"},"nextAttemptAt":{"nullable":true,"type":"string"},"responseStatus":{"nullable":true,"type":"number"},"responseBody":{"nullable":true,"type":"string"},"error":{"nullable":true,"type":"string"},"durationMs":{"nullable":true,"type":"number"},"deliveredAt":{"nullable":true,"type":"string"},"createdAt":{"type":"string"}},"required":["id","endpointId","event","status","attempts","nextAttemptAt","responseStatus","responseBody","error","durationMs","deliveredAt","createdAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/webhooks/{webhook}/deliveries":{"get":{"operationId":"listWebhookDeliveries","summary":"Recent deliveries of a webhook endpoint, newest first (kept 30 days)","tags":["Webhooks"],"x-latch-scope":"webhooks.manage","parameters":[{"name":"webhook","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"default":100,"type":"integer","minimum":1,"maximum":500}},{"name":"offset","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":0,"maximum":9007199254740991}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"endpointId":{"type":"string"},"event":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"number"},"nextAttemptAt":{"nullable":true,"type":"string"},"responseStatus":{"nullable":true,"type":"number"},"responseBody":{"nullable":true,"type":"string"},"error":{"nullable":true,"type":"string"},"durationMs":{"nullable":true,"type":"number"},"deliveredAt":{"nullable":true,"type":"string"},"createdAt":{"type":"string"}},"required":["id","endpointId","event","status","attempts","nextAttemptAt","responseStatus","responseBody","error","durationMs","deliveredAt","createdAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/webhooks/deliveries/{delivery}/retry":{"post":{"operationId":"retryWebhookDelivery","summary":"Send a failed delivery again now","tags":["Webhooks"],"x-latch-scope":"webhooks.manage","parameters":[{"name":"delivery","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"endpointId":{"type":"string"},"event":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"number"},"nextAttemptAt":{"nullable":true,"type":"string"},"responseStatus":{"nullable":true,"type":"number"},"responseBody":{"nullable":true,"type":"string"},"error":{"nullable":true,"type":"string"},"durationMs":{"nullable":true,"type":"number"},"deliveredAt":{"nullable":true,"type":"string"},"createdAt":{"type":"string"}},"required":["id","endpointId","event","status","attempts","nextAttemptAt","responseStatus","responseBody","error","durationMs","deliveredAt","createdAt"],"additionalProperties":false}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["code","message","params"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}}}}