LayoutLock

API reference

Everything the app does, you can do from the API with a bearer key — the same endpoints, the same behavior.

Authentication

Create a key in Settings → API keys (it's shown once). Send it as a bearer token on every request:

curl https://layoutlock-api.velniq.ai/v1/me \
  -H "Authorization: Bearer llk_your_key_here"

Quickstart

Upload a file, start a job, poll until it's done, and download the translated file:

# 1. Create a key in Settings -> API keys, then:
export KEY="llk_your_key_here"
export API="https://layoutlock-api.velniq.ai"

# 2. Register an upload (returns a fileId + a presigned PUT url)
UP=$(curl -s -X POST "$API/v1/uploads" -H "Authorization: Bearer $KEY" \
  -H "content-type: application/json" \
  -d '{"filename":"report.xlsx","bytes":'$(wc -c < report.xlsx)'}')
FILE_ID=$(echo "$UP" | jq -r .fileId)
PUT_URL=$(echo "$UP" | jq -r .uploadUrl)

# 3. Upload the bytes, then confirm
curl -s -X PUT "$PUT_URL" --data-binary @report.xlsx
curl -s -X POST "$API/v1/uploads/$FILE_ID/confirm" -H "Authorization: Bearer $KEY"

# 4. Start a translation into English
JOB=$(curl -s -X POST "$API/v1/jobs" -H "Authorization: Bearer $KEY" \
  -H "content-type: application/json" -d '{"fileId":"'$FILE_ID'","tgt":"en"}')
JOB_ID=$(echo "$JOB" | jq -r .jobId)

# 5. Poll until done, then download the translated file
while [ "$(curl -s "$API/v1/jobs/$JOB_ID" -H "Authorization: Bearer $KEY" | jq -r .status)" != "done" ]; do
  sleep 2
done
curl -s "$API/v1/jobs/$JOB_ID/download" -H "Authorization: Bearer $KEY" -o report.en.xlsx

Requests are rate-limited per key (120/min). Over the limit returns 429 with a Retry-After header; every response carries X-RateLimit-Limit and X-RateLimit-Remaining.

Endpoints

GET /v1/me

Your account, plan, and remaining pages.

POST /v1/uploads

Register a file upload; returns a fileId and a presigned PUT URL.

POST /v1/uploads/:id/confirm

Confirm the upload after PUTting the bytes.

POST /v1/detect

Detect the source language(s) of an uploaded file.

POST /v1/jobs

Start a translation job (fileId, tgt, optional glossaryId).

GET /v1/jobs/:id

Job status + report; poll until status is done.

GET /v1/jobs/:id/download

Download the translated file once the job is done.

POST /v1/jobs/:id/cancel

Cancel a queued or running job and refund its reserved pages.

POST /v1/translate/segments

Translate a batch of text segments directly (format-agnostic, no upload; the surface a browser extension uses).

POST /v1/glossaries

Create a glossary of src/tgt/dnt terms; reference it by id on a job or segments call.