Skip to content

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.

Terminal
curl https://api.heylatch.app/public/v1/workspace \
  -H "Authorization: Bearer ltk_your_key"

Permissions

SetWhat it can do
Read onlySee scripts, versions, access and servers.
PublishCreate scripts and upload and publish versions.
AccessGrant and revoke access.
FullEverything 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

  1. 1Open the version with POST /scripts/{script}/versions (version, changelog). The upload.url in the response is valid for 10 minutes.
  2. 2PUT the package (.zip) to that URL with Content-Type: application/zip.
  3. 3Publish it with POST /scripts/{script}/versions/{version}/publish.
  4. 4Poll GET /scripts/{script}/versions/{version}: processing → ready, or error with a buildError explaining why.
Terminal
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

EndpointWhat it does
GET /workspaceWorkspace, plan and the key's permissions.
GET /scripts · GET /scripts/{script}Scripts and their versions.
POST /scriptsA new script and its first version.
POST /scripts/{script}/versions · …/publish · …/withdrawOpen, publish and withdraw versions.
POST /scripts/{script}/versions/{version}/downloadA download link for the protected package, for your own servers.
GET /webhooks · POST /webhooks · …/test · …/deliveriesManage and test webhooks, and see deliveries (Studio and up).
GET /scripts/{script}/grantsAccounts with access.
POST /scripts/{script}/grants · …/grants/revoke · …/grants/bulkGrant, revoke, grant in bulk.
GET /scripts/{script}/activations · …/flagsRunning servers and key-sharing flags.
GET · PATCH /scripts/{script}/listingThe 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 /studioThe 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.

EventWhen
version.readyA version finished building and can be downloaded.
version.failedA build failed (with buildError).
version.withdrawnA version was withdrawn.
version.rolled_backThe newest version was rolled back (with previous).
access.grantedAn account was granted access, or had it restored.
access.revokedAn account's access was removed.
flag.openedA key ran on two servers at once.
Body
{
  "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.

Node.js
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 id in 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.