---
title: "Creates a new lease."
method: POST
path: "/leases"
---

# Creates a new lease.

`POST /leases`

## Request body

- object
  - `principalId` string, required
  - `budgetAmount` number, required
  - `budgetCurrency` string, required
  - `budgetNotificationEmails` string[], required
  - `expiresOn` number

## Response `201`

Created

- Lease — Lease Details
  - `id` string — Lease ID
  - `principalId` string — principalId of the lease to get
  - `accountId` string — accountId of the AWS account
  - `leaseStatus` 'Active' | 'Inactive' — Status of the Lease. "Active": The principal is leased and has access to the account "Inactive": The lease has become inactive, either through expiring, exceeding budget, or by request.
  - `leaseStatusReason` 'LeaseExpired' | 'LeaseOverBudget' | 'LeaseDestroyed' | 'LeaseActive' | 'LeaseRolledBack' — A reason behind the lease status. "LeaseExpired": The lease exceeded its expiration time ("expiresOn") and the associated account was reset and returned to the account pool. "LeaseOverBudget": The lease exceeded its budgeted amount and the associated account was reset and returned to the account pool. "LeaseDestroyed": The lease was adminstratively ended, which can be done via the leases API. "LeaseActive": The lease is active. "LeaseRolledBack": A system error occurred while provisioning the lease. and it was rolled back.
  - `createdOn` number — creation date in epoch seconds
  - `lastModifiedOn` number — date last modified in epoch seconds
  - `budgetAmount` number — budget amount
  - `budgetCurrency` string — budget currency
  - `budgetNotificationEmails` string[] — budget notification emails
  - `leaseStatusModifiedOn` number — date lease status was last modified in epoch seconds
  - `expiresOn` number — date lease should expire in epoch seconds

## Other responses

- `400` — If the "expiresOn" date specified is non-zero but less than the current epoch date, "Requested lease has a desired expiry date less than today: <date>" or "Failed to Parse Request Body" if the request body is blank or incorrectly formatted.
- `403` — Failed to authenticate request
- `409` — Conflict if there is an existing lease already active with the provided principal and account.
- `500` — Server errors if the database cannot be reached.

## Changes

> 12 revisions in range; 1 could not be searched.

- **2019-10-30** `6f6d0f2c93dc` — 3 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `409`
  - added the non-success response with the status `500`
- **2019-10-21** `eed5055f8eb6` — 3 warning, 3 info
  - the optional response header `Access-Control-Allow-Headers` removed for the status `201`
  - the optional response header `Access-Control-Allow-Methods` removed for the status `201`
  - the optional response header `Access-Control-Allow-Origin` removed for the status `201`
  - removed the non-success response with the status `400`
  - …2 more

[Change history](https://skmtc.dev/optum/apis/namespace/changes/leases/post.md)

---

[API](https://skmtc.dev/optum/apis/namespace.md) · [All operations](https://skmtc.dev/optum/apis/namespace/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/optum/namespace/revisions/11d73002ea62/schema)
