---
title: "Create Lease"
method: POST
path: "/apps/{app_name}/machines/{machine_id}/lease"
tags: ["Machines"]
---

# Create Lease

`POST /apps/{app_name}/machines/{machine_id}/lease`

Create a lease for a specific Machine within an app using the details provided in the request body. Machine leases can be used to obtain an exclusive lock on modifying a Machine.

## Path parameters

- `app_name` string, required
- `machine_id` string, required

## Headers

- `fly-machine-lease-nonce` string

## Request body

- CreateLeaseRequest
  - `description` string
  - `ttl` integer — seconds lease will be valid

## Response `201`

Created

- Lease
  - `description` string — Description or reason for the Lease.
  - `expires_at` integer — ExpiresAt is the unix timestamp in UTC to denote when the Lease will no longer be valid.
  - `nonce` string — Nonce is the unique ID autogenerated and associated with the Lease.
  - `owner` string — Owner is the user identifier which acquired the Lease.
  - `version` string — Machine version

---

[API](https://skmtc.dev/fly/apis/machines-api.md) · [All operations](https://skmtc.dev/fly/apis/machines-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fly/machines-api/revisions/f5ad396d55d7/schema)
