---
title: "Set, extend, or clear a machine resource-expiry lease"
method: PATCH
path: "/v1/machines/{machine_id}"
tags: ["machines"]
---

# Set, extend, or clear a machine resource-expiry lease

`PATCH /v1/machines/{machine_id}`

Scope: `machines:write`. `ttl_minutes=0` clears expiry; values 5..10080 schedule expiry from now. Expiry destroys managed infrastructure. For an external machine it deletes only the Coasty registration and revokes device access/leases; caller-owned host and storage remain untouched.

## Request body

- UpdateMachineRequest
  - `ttl_minutes` union, required — 0 clears resource expiry; otherwise the value must be between 5 and 10080. Managed expiry destroys infrastructure; external expiry only revokes and deletes the Coasty registration, leaving caller-owned host/storage untouched.
    - 0
    - integer

## Response `200`

Updated lease.

- UpdateMachineResponse
  - `machine_id` string, required
  - `ttl_minutes` integer, nullable, required
  - `auto_destroy_at` string, date-time, nullable, required
  - `request_id` string, required

## Other responses

- `400` — Invalid request body or parameters.
- `401` — Missing, invalid, or revoked API key. Pass `X-API-Key: sk-coasty-live-...` (or test).
- `403` — API key lacks the required scope or tier-feature is unavailable on the caller's plan.
- `404` — Resource not found in this key's namespace.
- `409` — The resource state conflicts with this operation.
- `413` — The request body exceeds the endpoint limit.
- `422` — The JSON shape is valid but one or more values violate the endpoint contract.
- `429` — Rate or concurrency limit exceeded.
- `500` — Unexpected server error. Retry with exponential backoff.
- `502` — An upstream dependency returned an invalid response.
- `503` — A required service is temporarily unavailable.
- `504` — An upstream dependency timed out.

---

[API](https://skmtc.net/coasty/apis/coasty-public-api.md) · [All operations](https://skmtc.net/coasty/apis/coasty-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/coasty/coasty-public-api/versions/f50d93b0d8a1/schema)
