API reference
Beta
Kiln is in beta. Field names and some shapes may still change. The jobs routes are the newest.
Paths are relative to the Kiln API of your project, under /v1/kiln. The toolkit and SDK add the base for you. Authenticate as for any platform route, with a user, an API user, a workflow or an agent. Every caller is checked the same way. The project comes from your session or token.
Permissions: R machines::read, M machines::manage, X machines::exec. They are held on the protokol-kiln integration. Running code inside a machine is a separate permission from turning it on, on purpose.
Request bodies are JSON, at most 1 MiB, and a field the route does not know is refused with 400. Start, stop, signal and delete answer 202 with the machine, and so does a create with start: true. A create with start: false saves the definition and answers 201. Clients poll it or listen for the events. Create, start, extend and start-a-job-run take an Idempotency-Key header (at most 120 characters): replaying the same key returns the first result instead of charging twice, and the same key with a different request is 409 idempotency_conflict. A call that was refused keeps no key, so its replay is asked again: it gets the same refusal while the cause stands.
Routes
Reference data and usage
| Route | Perm | Purpose |
|---|---|---|
GET /images |
R | The images: name, label, default |
GET /sizes |
R | The sizes, and whether your tier allows each (see Sizes and limits) |
GET /usage |
R | GiB-hours of the tier used and left this month, in MiB-minutes, and the limits in force |
GET /leases |
R | Every lease of a month, past and current, for all machines, with the month's totals |
GET /machines/{uuid}/usage |
R | One machine's charges: what came from the GiB-hours (in minutes and in MiB-minutes) and what from credits |
Machines
| Route | Perm | Purpose |
|---|---|---|
GET /machines, GET /machines/{uuid} |
R | List, read. ?deleted=true lists deleted machines too |
POST /machines |
M | Save a machine. Needs start. With start: true it also needs minutes, takes project_env (dev or live, default dev) and starts the machine. With start: false it only saves the definition and answers 201 |
PATCH /machines/{uuid} |
M | Change name, egress, extra_hosts, run_as, env (replaced as a whole; { "keep": true } keeps a held custom value) and intake (the default code; [] clears it). size and disk only upward and only while exited or saved. A saved machine may change any field of its definition |
POST /machines/{uuid}/start |
M | Start. Body optional: minutes (required when the machine is saved, refused while time is left), project_env (dev or live, default dev; a start with time left keeps the lease's and refuses a different one with 400), run (false leases and takes the intake in without running), intake (the code of this start), disk (a saved start only), and a sequence, env or cwd for this start only |
POST /machines/{uuid}/stop |
M | Stop. ?force=true kills at once |
POST /machines/{uuid}/signal |
M | Signal the main process: { "signal": "TERM" } |
POST /machines/{uuid}/extend |
M | Buy more minutes. Needs a lease. Answers 200 |
POST /machines/{uuid}/end-lease |
M | End the lease now. Needs a lease, in any state. Answers 202 with the machine. Unused minutes come back. A machine with no lease answers 409 not_leased |
DELETE /machines/{uuid} |
M | Delete the machine, whatever its state. Body holds the machine's name, or its uuid when it has none |
Commands, files and logs
These routes need an active lease. On a saved machine they answer 409 not_leased, except the logs of past leases, which stay readable.
| Route | Perm | Purpose |
|---|---|---|
POST /machines/{uuid}/exec |
X | Run a command |
GET /machines/{uuid}/exec/stream (websocket) |
X | Stream a command. See websocket frames |
GET /machines/{uuid}/terminal (websocket) |
X | Terminal. ?rows=&cols= set its size |
PUT /machines/{uuid}/files?path=&mode= |
X | Write one file. The body is the file's bytes, and Content-Length is required. mode is octal, 0644 if left out |
GET /machines/{uuid}/files?path=&offset=&length= |
X | Read a file, whole or a byte range |
POST /machines/{uuid}/files/edit |
X | Replace text in a file |
POST /machines/{uuid}/files/list |
X | List a directory: { "path": "/srv/app", "depth": 2 } |
PUT, GET /machines/{uuid}/archive?path= |
X | .tar.gz in and out |
POST /machines/{uuid}/intake |
X | Take files in from Media, as the caller. The project needs Media installed from the marketplace, or it answers 409 media_not_installed |
POST /machines/{uuid}/export |
X | Put a file or directory into Media, as the caller. media is a folder (existing, or ending in /) to put it in, or the full Media path to save it as. Same need and answer |
GET /machines/{uuid}/logs |
R | The main process's log. ?since= (RFC 3339), ?follow=true |
GET /machines/{uuid}/wait |
R | Wait for exit or for a text |
GET /machines/{uuid}/status |
R | State, memory, swap, CPU, disk, out-of-memory kills, uptime |
GET /machines/{uuid}/processes?limit= |
X | What is running now, busiest first. limit is 50 by default, 1 to 200 |
Jobs
Jobs
These routes are for jobs. Every route takes the job's id or its name as {job}.
| Route | Perm | Purpose |
|---|---|---|
GET /jobs |
R | List. Each job carries its last_run |
GET /jobs/{job} |
R | Read |
POST /jobs |
M | Create a job. Answers 201. Needs overlap; minutes is optional |
PATCH /jobs/{job} |
M | Change any field of a create, or set enabled. Fields you leave out stay |
DELETE /jobs/{job} |
M | Delete a job. Answers 204 |
POST /jobs/{job}/runs |
M | Start a run now. Answers 202 with the run |
GET /jobs/{job}/runs |
R | Run history, as { "runs": [...] } |
GET /jobs/{job}/runs/{run} |
R | One run |
The machine
A machine, as the API returns it:
| Field | Meaning |
|---|---|
uuid, name |
Identity and display name |
state, desired_state |
The state (saved for an idle definition), and what Kiln is moving it toward: running, stopped or deleted |
image, size, disk |
As created. size is memory in MiB and disk is in GiB |
egress, extra_hosts |
The network mode and the extra hosts |
sequence, cwd |
The start sequence, { "steps": [...] } or { "command": [...] }, and the working directory |
intake |
The machine's default code: a list of { "media", "to" }, [] when it has none. A start that leaves intake out takes it |
env_names |
The names of the environment variables. Values are never returned |
env |
Where each variable's value comes from: { "kind": "global_env", "global_env": "KEY" }, { "kind": "value" } (a custom value the machine keeps encrypted) or { "kind": "start" } (none kept). Never the value |
project_env |
dev or live: the env of the current lease, which the machine's token and PROJECT_ENV follow. null while the machine is saved |
minutes, leased_at, expires_at |
The current lease. expires_at is when it ends and the machine goes back to saved. All three are empty while the machine is saved |
waiting_for_capacity |
true while a pending machine waits for Kiln to make room (reason says so; this usually takes about 2 minutes). Its lease clock has not started yet, so minutes, leased_at and expires_at are empty until it gets a place. If no place is found in time, the start fails and everything is returned. Left out otherwise |
started_at, exit_code, oom, thrashed, reason |
After the main process runs, exits or when a machine fails. started_at is empty while saved. A saved machine whose last start failed keeps its reason (for example intake: /apps/shop/src was not found in Media or no capacity) until the next start clears it |
end_on_exit, ended_early, returned_minutes |
end_on_exit is whether the lease ends by itself when the main process exits. ended_early is true after an End lease, and returned_minutes is how many unused minutes came back |
charged |
{ "micro_cents": n }: what the current lease and its extensions cost in credits |
created_by |
{ "id", "type", "for" }: who created it, for display and audit only. for is set only on an agent: the user id of the person who asked the agent, when a person started its run (a scheduled run has none). type is user, api_user, agent (id is the agent), machine (id is the machine whose own token made the call), run (a run with no known agent, machine or person; no id), workflow or system |
run_as |
The run identity. Every machine has one |
created_at, updated_at |
Times |
Create a machine
| Field | Required | Meaning |
|---|---|---|
start |
yes | true starts the machine at once and runs the start sequence. false saves the definition only: the machine is saved, nothing is placed or charged |
minutes |
with start: true |
Whole minutes, 5 to the tier's longest lease (never over 24 hours). With start: false it is refused with 400 and field: "minutes": minutes are given when the machine starts |
project_env |
dev (default) or live. Used with start: true; with start: false it is refused with 400 and field: "project_env". Anything else is refused the same way |
|
sequence |
yes | The start sequence: { "steps": ["npm ci", "npm test"] } (shell lines, at most 200) or { "command": ["node", "app.js"] }. Not both. Even a saved machine has one, so a later start knows what to run |
name |
Display name, at most 80 characters. Used when you delete | |
size, disk, image |
size is MiB from GET /sizes, disk is GiB, image is a name from GET /images. Defaults: 128 MiB, 2 GiB, ubuntu-24.04 |
|
egress, extra_hosts |
allowlist (default) or closed, and up to 9 extra host names. See Network |
|
env |
Environment variables: a string (a custom value, kept encrypted, never shown again; needs secrets::write protokol-kiln), or { "global_env": "KEY" }. See Machines; a worked global env example. PROJECT_API_TOKEN, API_HOST, PROJECT_UUID and PROJECT_ENV are set for you and refused with 400 and field: "env" |
|
cwd |
Absolute start directory of the sequence. Any path: Kiln creates it when it is missing. There is no default code folder | |
intake |
The machine's default code: a list of { media, to }, at most 20, absolute paths. Kept on the definition for the starts that give none; with start: true the first start takes it in too. PATCH changes it ([] clears it) |
|
run_as |
The run identity. Left out, the platform picks the default for you, and the create is refused if you have none |
Start
POST /machines/{uuid}/start. The body is optional.
| Field | Meaning |
|---|---|
project_env |
dev or live, for the new lease (default dev). With time left, the lease's env stays: a different value is refused with 400 and field: "project_env" |
minutes |
Whole minutes of the new lease. Required when the machine is saved, because it has no time left. Paid in full at the start. A machine that is leased and not running refuses it with 409 lease_active: it runs on the same files within the time left, and extend adds time |
run |
true by default. false takes the lease and the Media intake and stops there, leaving the machine created, so you can PUT a .tar.gz to /archive before a later start runs the sequence. It is refused with 400 when the machine already has a lease |
intake |
A list of { media, to }: the code of this start. Left out, a saved machine's start takes the machine's default code; [] brings no code; a list is for this start only and leaves the default as it was. A start with time left that leaves it out runs on the files it has. Kiln copies each path in after the machine is placed and before the sequence runs, as the machine's run identity. Also allowed with time left. With run: false the machine stops at created after the intake. A failed intake fails the lease |
sequence, env, cwd |
Change them for this lease only. The definition changes only through PATCH. A start again within the lease keeps what the lease last ran. This needs the machine's run_as (run identity) |
disk |
Disk in GiB for this lease. Saved start only: with time left it is refused with 400 and field: "disk" |
A saved start runs the definition's env with its kept values. A name the definition keeps no value for needs one in the start, or the start is refused with 400 and field: "env" naming the variables. A value the start gives overrides the kept one for that start only.
If there is no room, the answer is 503 no_capacity, and nothing stays charged. It says what would fit (see Errors); Retry-After is there only when the size could fit once other machines end (fits_when_free is true or unknown).
Extend
POST /machines/{uuid}/extend with { "minutes": 30 }. It needs an active lease: on a saved machine it answers 409 not_leased. Answers the machine with the new expires_at and charged.
End lease
POST /machines/{uuid}/end-lease ends the lease now, as if its end time had come. It has the same permission and checks as stop, and works in any state while the machine holds a lease, including one still waiting for a place. A machine with no lease (saved) answers 409 not_leased. The answer is 202 with the machine, which shows ended_early: true and returned_minutes.
- The main process gets
SIGTERMand is killed after the usual 30 seconds, the room is released, and the token stops working. A machine that was saved goes back tosaved. - The minutes not used come back, credits first and then GiB-hours. The shortest lease counts as 5 minutes, so a lease ended sooner still pays 5. See How a lease is paid.
end_on_exitis a boolean,falseby default, taken byPOST /machineswithstart: trueand byPOST /machines/{uuid}/startwhen it begins a new lease. When the main process exits, the lease ends at once, as with End lease. A job run always ends its lease when its main process exits. Stop alone never ends a lease.- Deleting a machine that is leased returns the unused minutes in the same way.
Stop and signal
POST /machines/{uuid}/stop sends SIGTERM and waits up to 30 seconds before it kills the process. ?force=true kills at once. signal takes TERM, INT, HUP, QUIT, KILL, USR1 or USR2, with or without the SIG prefix.
Exec
POST /machines/{uuid}/exec
| Field | Meaning |
|---|---|
command |
The program and its arguments, a list |
env, cwd, user |
Environment for this command only (never stored), working directory, user to run as |
stdin or stdin_base64 |
Input as text, or as base64 for bytes |
timeout_sec |
At most 900 |
detach |
true answers at once, and the output goes to the log |
The answer holds exit_code, stdout, stderr, truncated, stdout_truncated, stderr_truncated (each stream is cut at 1 MiB), timed_out, detached, and exec_id for a detached command. Output that is not valid UTF-8 shows the replacement character. Use a stream for binary output.
Files
- Edit:
POST /files/editwith{ "path", "old_text", "new_text", "expect_sha256" }. It is refused with409ifold_textis not found exactly once, or if the file's hash is notexpect_sha256. The answer holds the newsha256. - Read: the answer is the file's bytes. The headers
X-Kiln-File-Size,X-Kiln-File-Mode(octal) andX-Kiln-File-Modifieddescribe it. - List: answers
entries(each withpath,size,mode,mod_time,is_dir,symlink_target) andtruncated. - Archive:
PUTunpacks a.tar.gzbody atpath, andGETdownloads a path as one. - Intake takes
{ "media", "to" }, and export takes{ "path", "media" }, wheremediais a Media folder to put it in (existing, or ending in/:"/builds/") or the full Media path to save it as ("/builds/shop.tgz"). Both answer{ "kind", "name", "bytes" }.
Logs
Without follow, GET /logs answers { "lines": [ { "time", "stream", "exec_id", "text" } ] }. With follow=true it answers a stream of newline-delimited JSON (application/x-ndjson).
Wait
GET /machines/{uuid}/wait?until=exit|text&text=&timeout_sec=&since=. until is exit (default) or text. timeout_sec is 60 by default and at most 300 per call. The answer holds state, exit_code, oom, thrashed, reason, started_at, exited_at, matched, the matching line, and timed_out.
Status
GET /machines/{uuid}/status answers the same state fields as wait, and memory_bytes, memory_max_bytes, swap_bytes, swap_max_bytes, cpu_usage_usec, disk_used_bytes, disk_limit_bytes, oom_kills and uptime_sec.
memory_max_bytes is the hard limit, a little above the machine's size; memory_bytes counts everything the machine uses.
Processes
GET /machines/{uuid}/processes?limit=50 lists what runs in a machine, like top. It needs machines::exec, because command lines can hold secrets, and the machine must be running. limit is 1 to 200; anything else is a 400 on limit.
{ "processes": [ { "pid": 1, "ppid": 0, "user": "root", "state": "S", "cpu_percent": 12.5, "memory_bytes": 104857600, "elapsed_sec": 300, "command": "node server.js --port 3000" } ],
"count": 12, "cpu_percent": 37.5, "memory_bytes": 230686720, "sample_ms": 1000, "expires_at": "...", "time_left_sec": 1234 }
cpu_percentis measured over about a second (sample_ms), so the call takes that long. 100 is one CPU fully busy, as intop; the total can go above 100.memory_bytesis the resident memory of the process; the total is the sum.commandis the full command line, cut to 512 characters, or the program name when there is none.- The list is sorted by CPU, then memory.
countis the number of processes beforelimitcut the list.
Reading the list is not written to the audit trail or the machine's log, so a dashboard can poll it.
Time left on every reply
Every reply of the exec, files, archive, intake, export, logs, wait, status and processes routes says how long the lease has left. JSON answers carry expires_at and time_left_sec. Answers that are bytes (a file or an archive download) and the log stream carry them as headers:
| Header | Meaning |
|---|---|
X-Kiln-Expires-At |
When the lease ends, RFC 3339 in UTC |
X-Kiln-Time-Left-Sec |
Whole seconds left |
Websocket frames
exec/stream and terminal are websockets. Bytes travel in binary frames, the first byte saying what they are, so nothing is changed and nothing is base64. Everything else is a JSON text frame with a type.
| Direction | Frame | Meaning |
|---|---|---|
| client to server | binary, 0x00 + bytes |
stdin |
| client to server | { "type": "start", "command": [...], "env": {}, "cwd": "", "user": "", "timeout_sec": 60 } |
The first frame of exec/stream, and required. A terminal needs no start frame |
| client to server | { "type": "resize", "rows": 40, "cols": 120 } |
Resize the terminal |
| client to server | { "type": "close_stdin" } |
No more input |
| server to client | { "type": "ready", "exec_id", "expires_at", "time_left_sec" } |
The stream is open |
| server to client | binary, 0x01 + bytes |
stdout. A terminal's only output |
| server to client | binary, 0x02 + bytes |
stderr |
| server to client | { "type": "exit", "exit_code", "timed_out", "stdout_truncated", "stderr_truncated" } |
The command ended |
| server to client | { "type": "error", "code", "message", "status" } |
The stream ended. code is lease_expired, idle_timeout, session_limit, refused or failed, and status is the HTTP status the same refusal would have had. A close frame follows |
A refusal that comes before the stream opens, such as a machine that is not running, arrives as an error frame and a close, because the browser's websocket cannot read an HTTP status.
Limits
| Item | Limit |
|---|---|
| Request body (JSON) | 1 MiB |
| Exec timeout | 900 seconds. Streams: 24 hours |
| Exec output | 1 MiB per stream |
| File or archive upload or download | 100 MiB |
| Intake from Media | The machine's disk |
| Export to Media | 500 MiB |
| Wait | 300 seconds per call |
| Terminal | Closes after 30 minutes idle, and after 24 hours at most |
| Log | Last 10 MiB per machine, kept 7 days after the lease ended or the machine was deleted |
| Saved machines | 100 per project |
Jobs: fields
A job's body is a machine's body, flat, plus its schedule, overlap and identity. Create it with POST /jobs:
| Field | Meaning |
|---|---|
name |
Required. Unique in the project, at most 80 characters, no /, ? or #, and never a uuid, so a name and an id are told apart |
size, disk, image |
As for a machine |
minutes |
Optional, 5 to the tier's longest lease (never over 24 hours): what each run pays when it starts. Left out (or 0 on an update), a run lasts until its main command finishes, at most 24 hours, and pays an hour at a time; see Runs pay for the time they use. The job answers without minutes then |
sequence, cwd, egress, extra_hosts, intake |
As for a machine |
env |
Global env keys, { "TOKEN": { "global_env": "GITHUB_TOKEN" } }, and custom values, { "REGION": "eu" }, kept encrypted and never shown again; a custom value needs secrets::write protokol-kiln. See Jobs |
run_as |
The run identity every run uses |
project_env |
dev (default) or live. Every run's token acts in it and PROJECT_ENV is set to it. The job shows it too |
schedule |
A 5-field cron expression, for example 0 2 * * *. Left out or "", the job runs on request only. At least 5 minutes between runs |
time_zone |
An IANA zone such as Europe/Belgrade. UTC if left out |
overlap |
skip, parallel or queue. Required |
enabled |
Whether the schedule runs. true if left out |
A job is read back with the same fields, env showing the global env key of each variable, and also uuid, next_run_at, last_run, created_by, created_at and updated_at. A change with PATCH replaces sequence, env, extra_hosts and intake whole when you send them.
A run has uuid, job_uuid, machine_uuid (null until it has a machine), state (queued, started, finished, failed or skipped), reason for a run that did not run or did not end well (out of memory, Stopped: not enough GiB-hours or credits left for the next hour when a run with no minutes was terminated because its next hour could not be paid (also Stopped: the plan allows no longer run, Stopped: the Kiln subscription is no longer active, Stopped: the next hour could not be paid and Stopped: reached the 24 hour limit), or needed more memory than its size when Kiln stopped its machine for running short of memory and the job needs a bigger size; runs recorded earlier say kept swapping heavily), exit_code, trigger (schedule or manual), started_by, started_for (the person an agent that started it acted for), due_at, started_at, finished_at and created_at.
Usage
GET /usage answers the month's GiB-hours in MiB-minutes, whole numbers. 1 GiB-hour is 61,440 MiB-minutes, so divide by 61,440 to show GiB-hours.
{ "month": "2026-11", "tier": "standard",
"included_mib_minutes": 6144000, "used_mib_minutes": 1280, "left_mib_minutes": 6142720,
"machines": 0, "max_machines": 2, "max_memory_mib": 1024, "max_lease_minutes": 240 }
A machine's usage (GET /machines/{uuid}/usage) and a lease's charge show the minutes taken from the GiB-hours and the same as MiB-minutes (hours_minutes and hours_mib_minutes), next to the minutes paid from credits. After a lease ends early, or fails on Kiln's side, a charge also shows what came back: refunded_hours_minutes and refunded_hours_mib_minutes for the GiB-hours, and the credit minutes and credit amount returned.
Leases
GET /leases?month=YYYY-MM&limit=50&cursor=... lists every lease of the project, past and current, newest first. month defaults to this month (UTC); a lease belongs to the month its allowance was taken from. Page with next_cursor (null on the last page).
{ "month": "2026-11",
"items": [{ "lease_id": "...", "machine_uuid": "...", "machine_name": "build", "machine_deleted": false,
"size": 1024, "disk": 10, "job_uuid": null, "job_name": null, "job_run_uuid": null,
"leased_by": { "type": "user", "id": "..." },
"leased_at": "2026-11-21T14:21:16Z", "ended_at": "2026-11-21T15:21:16Z", "expires_at": null,
"state": "ended", "end_reason": "expired",
"minutes_bought": 60, "minutes_used": 60, "returned_minutes": 0,
"hours_mib_minutes": 61440, "credit_micro_cents": 0,
"returned_hours_mib_minutes": 0, "returned_micro_cents": 0 }],
"totals": { "leases": 12, "minutes_used": 340, "hours_mib_minutes": 200000, "credit_micro_cents": 41000 },
"next_cursor": null }
stateiswaiting(no place yet),running(holds its lease;expires_atis set) orended.end_reasonisexpired(end time reached),ended(End lease),exited(the main process or a job run exited),deleted,failed(Kiln could not run it, everything returned) orno_capacity(no place was found in time, everything returned). It is null while the lease runs, and for older leases whose end was not recorded.machine_nameis kept when the machine is deleted (machine_deleted: true). A lease that never got a place hasleased_atnull andminutes_used0.hours_mib_minutesis what the lease took from the month's GiB-hours, in MiB-minutes, after what came back;credit_micro_centsis the credits taken, after refunds. Thereturned_*fields are what came back.totalscover the whole month, not the page.
A start or extend that a limit refuses names the lowest higher tier that allows it in upgrade:
{ "status": false, "code": 403, "error": "limit_exceeded",
"message": "kiln: limit max_memory_mib is 1024, asked for 4096 (business: 4096)",
"limit": "max_memory_mib", "value": 1024, "requested": 4096,
"upgrade": { "tier": "business", "value": 4096 } }
Errors
A refusal of the machines and jobs routes is { "status": false, "code": <http status>, "error": "<stable code>", "message": "...", "field": "..." }. field names the wrong field of a 400. The relay routes (exec, files, logs and the like) answer { "status": false, "code": 1001, "message": "..." }.
| Status | error |
Meaning |
|---|---|---|
400 |
invalid_request |
Bad request. field says which. For example a missing start, a missing minutes with start: true, minutes given with start: false or sent to a start that has time left, egress: "open", a project_env that is not dev or live, a project_env that differs from the lease's, an env value that is not a string, a job whose schedule runs more often than every 5 minutes |
401, 403 |
Not authenticated, or you lack the permission | |
402 |
not_enough_credits, kiln_not_subscribed, kiln_subscription_inactive |
Not enough credits for the part of the lease the GiB-hours do not cover, or the project has no active Kiln plan |
403 |
limit_exceeded |
A limit of your tier refuses it, checked at each start, or the project already keeps 100 machines. limit names it, with value (the limit), requested, and upgrade ({ "tier", "value" }: the lowest higher tier that allows the request and its value; left out when none does) |
403 |
run_identity_refused |
About run_as. reason, identity and missing say why (run identity) |
403 |
env_secrets_forbidden |
Setting, replacing or removing a kept env value needs secrets::write protokol-kiln, on a machine or a job. Global env keys need no extra permission |
403 |
project_not_allowed |
The project may not use Kiln yet |
404 |
not_found |
No such machine, job or run |
409 |
wrong_state |
The machine is in the wrong state for this call, for example start while it runs |
409 |
lease_active |
A start with minutes on a machine that still has time. Its message says when the lease ends. Extend it to add time |
409 |
not_leased |
The call needs an active lease and the machine is saved: extend, end lease, stop, signal, exec, files, archive, intake, export, terminal |
409 |
starting |
End lease and delete, while a lease is being set up: right after a create or a start, before the machine reports creating, usually a second or two. The message is "The lease is being set up; try again in a moment." Retry: a client should try again after about a second, a few times, before giving up |
409 |
media_not_installed |
The call reads from Media and Media is not installed on the project. Install it from the marketplace |
409 |
job_name_taken |
Another job of the project has that name |
409 |
job_busy |
A manual run was refused because the job's overlap does not let another run begin. The run is recorded as skipped |
409 |
idempotency_conflict |
That Idempotency-Key was used with a different request |
410 |
The lease ended while the call was open | |
413 |
A file or archive is over the limit | |
422 |
A relay limit refuses it | |
503 |
no_capacity |
Kiln has no room for the size now. message says so in a sentence. size_mib is the size asked, largest_size_mib the largest size available now (0 when none), and fits_when_free is false when the asked size could not be placed even with nothing else running. Lease largest_size_mib or smaller instead. Retry-After: 60 is sent only when fits_when_free is true or unknown |
503 |
provisioner_unavailable |
Kiln can't reach its machines. This is not a capacity problem. Retry-After: 30 |
503 |
billing_unavailable |
Kiln can't check the project's plan and credits. Retry-After: 30 |
503 |
identity_unavailable |
Kiln can't check the run identity. Retry-After: 10 |
503 |
env_unavailable |
Kiln can't keep or read env values right now. Nothing was stored or started. Try again in a minute |
Every 503 has one of these five codes and nothing is charged. Example:
{"status": false, "code": 503, "error": "no_capacity", "message": "Kiln is out of capacity for 1024 MiB machines right now. The largest size available now is 512 MiB.", "size_mib": 1024, "largest_size_mib": 512, "fits_when_free": true}
Running out of memory is not an HTTP error. It shows as exit_code: 137 and oom: true. Kiln stops a machine that keeps running short of memory for about 3 minutes (heavy swapping, or stalled waiting for memory) the same way and shows exit_code: 137 and thrashed: true, with reason saying so; lease a bigger size.
Events
Kiln sends kiln.machine.<state> for every state change. In workflows they are available as integration.kiln.machine.<state>.
| Event | Payload |
|---|---|
integration.kiln.machine.pending, .creating, .created, .starting, .running, .stopping |
machine_uuid, project_uuid, created_by, created_for (when an agent acted for a person), size, expires_at |
integration.kiln.machine.exited |
the above plus exit_code, oom, thrashed, reason (exit, stopped or restarted; for a thrashed machine, a sentence saying it kept running out of memory) |
integration.kiln.machine.failed, .unknown, .expired, .deleted |
the above plus reason. .expired means the lease ended (also when it was ended early with End lease, with the reason ended), and the machine is saved again unless it belonged to a job run |
integration.kiln.job.run.started, .finished, .failed, .skipped |
job_uuid, run_uuid, project_uuid, trigger, started_by, state, and machine_uuid once there is one. finished carries exit_code. failed and skipped carry reason |
Audit
Changes are recorded in the project's audit trail: kiln.machine.create, .start, .stop, .signal, .resize, .extend, .lease_ended, .exec, .terminal, .intake, .export and .delete, and kiln.job.create, .update, .delete, .run. Entries say who and when, never the content.