For developers
API
Manage scripts, versions and access from your own site, CI or tools.
Authentication
Create a key on your workspace's API page (owners and admins). Send it in the Authorization header. A key is shown only once; we store just its hash.
curl https://api.heylatch.app/public/v1/workspace \
-H "Authorization: Bearer ltk_your_key"Permissions
| Set | What it can do |
|---|---|
| Read only | See scripts, versions, access and servers. |
| Publish | Create scripts and upload and publish versions. |
| Access | Grant and revoke access. |
| Full | Everything your role allows, including taking scripts down, resolving flags and the Explore studio page. |
A key never does more than its creator's current role allows. If the creator leaves the workspace or loses a permission, the key loses it too. Revoke a key any time on the API page; actions taken with a key show its name in the audit log.
Publishing a version
- 1Open the version with
POST /scripts/{script}/versions(version,changelog). Theupload.urlin the response is valid for 10 minutes. - 2
PUTthe package (.zip) to that URL withContent-Type: application/zip. - 3Publish it with
POST /scripts/{script}/versions/{version}/publish. - 4Poll
GET /scripts/{script}/versions/{version}:processing→ready, orerrorwith abuildErrorexplaining why.
curl -X POST https://api.heylatch.app/public/v1/scripts/my-script/versions \
-H "Authorization: Bearer ltk_your_key" -H "Content-Type: application/json" \
-d '{"version":"1.2.0","changelog":"Fixed spawn bug"}'Granting access from your store
When someone buys, ask for their account ID and call POST /scripts/{script}/grants with { "accountId": "LA-7K2M-9QXD" }. It's safe to retry: if they already have access you get the existing grant with created: false. To refund, call POST /scripts/{script}/grants/revoke with the same body. Studio and Enterprise can grant up to 100 accounts per call with /grants/bulk.
Endpoints
| Endpoint | What it does |
|---|---|
GET /workspace | Workspace, plan and the key's permissions. |
GET /scripts · GET /scripts/{script} | Scripts and their versions. |
POST /scripts | A new script and its first version. |
POST /scripts/{script}/versions · …/publish · …/withdraw | Open, publish and withdraw versions. |
POST /scripts/{script}/versions/{version}/download | A download link for the protected package, for your own servers. |
GET /webhooks · POST /webhooks · …/test · …/deliveries | Manage and test webhooks, and see deliveries (Studio and up). |
GET /scripts/{script}/grants | Accounts with access. |
POST /scripts/{script}/grants · …/grants/revoke · …/grants/bulk | Grant, revoke, grant in bulk. |
GET /scripts/{script}/activations · …/flags | Running servers and key-sharing flags. |
GET · PATCH /scripts/{script}/listing | The script's Explore page: listing, free to use, listing text. |
GET · POST /scripts/{script}/images · DELETE …/images/{image} | Gallery images (base64 data URL, up to 6). Listing on Explore needs at least one. |
GET · PATCH /studio | The workspace's Explore studio page: on or off, text, links, banner, pinned script. |
Scripts can be addressed by id or slug. Every field and response is in the OpenAPI spec.
Webhooks
On Studio and Enterprise, Latch sends a signed POST request to your address when something happens. Add one on your workspace's API page or with POST /webhooks. The address must be a public https:// URL.
| Event | When |
|---|---|
version.ready | A version finished building and can be downloaded. |
version.failed | A build failed (with buildError). |
version.withdrawn | A version was withdrawn. |
version.rolled_back | The newest version was rolled back (with previous). |
access.granted | An account was granted access, or had it restored. |
access.revoked | An account's access was removed. |
flag.opened | A key ran on two servers at once. |
{
"id": "6f1c9a52-…",
"type": "access.granted",
"createdAt": "2026-11-04T12:00:00.000Z",
"workspace": { "id": "…", "slug": "crestlabs", "name": "Crest Labs" },
"data": {
"script": { "id": "…", "slug": "my-script", "name": "My Script" },
"account": { "accountId": "LA-7K2M-9QXD", "displayName": "Mira" }
}
}Verify the signature
Every request has Latch-Event, Latch-Delivery and Latch-Signature headers. The signature looks like t=<time>,v1=<hex>: the HMAC-SHA256 of <time>.<body>, using the secret shown once when you added the webhook.
import { createHmac, timingSafeEqual } from "node:crypto"
// rawBody: the unparsed request body (before JSON.parse)
function isFromLatch(rawBody, header, secret) {
const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")))
if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest()
const given = Buffer.from(v1 ?? "", "hex")
return given.length === expected.length && timingSafeEqual(given, expected)
}Delivery and retries
- Any 2xx response counts as delivered. If you don't answer within 10 seconds or return another code, it's retried: 8 attempts over about 2 days.
- Redirects aren't followed. The same event can arrive more than once; use the
idin the body to skip repeats. - A webhook that keeps failing for days is turned off, and the workspace owner gets an email.
- If the address is a Discord channel webhook, Latch posts a formatted message to the channel instead of signed JSON. You pick the message language when you add it.
- Delivery history is kept for 30 days. You can send a test event or retry a failed delivery from the panel or the API.
Errors and limits
Errors come back as { "error": { "code", "message", "params" } } with an HTTP status: 401 invalid key, 403 missing permission or plan, 404 not found, 429 rate limited. Requests per minute per key: Free 60, Pro 120, Studio 300, Enterprise 600.