---
title: "Create a new doorlock key."
method: POST
path: "/doorlock/v1/keys"
tags: ["Door Locks"]
---

# Create a new doorlock key.

`POST /doorlock/v1/keys`

## Request

- Base URL: `https://api.cloudbeds.com`
- URL: `https://api.cloudbeds.com/doorlock/v1/keys`
- Auth: OAuth 2
  - Authorization code: `https://api.cloudbeds.com/auth/oauth/authorize`
  - Token URL: `https://api.cloudbeds.com/auth/oauth/token` scopes: `write:doorLockKey`

## Request body

- DoorLockKeyCreateRequestSchema
  - `propertyId` string, required
  - `reservationId` string, required: Reservation identifier.
  - `subReservationId` string, required: Sub-reservation identifier.
  - `issuerId` string, required
  - `startDateTime` string, Y-m-d\TH:i:sP, required: Start date and time of key.
  - `endDateTime` string, Y-m-d\TH:i:sP, required: End date and time of key.
  - `keyType` 'key_card' | 'access_code' | 'mobile_key', required: Key type.
  - `rooms` string[]: List of common room IDs.
  - `commonRooms` string[]: List of common room ids.
  - `externalId` string, nullable
  - `keyCode` string, nullable: Custom key code.
  - `status` 'processing' | 'completed': Key status.
  - `encoder` string, nullable
  - `mobileId` string, nullable
  - `guestId` string, nullable

## Response `201`

A key that was just created.

- DoorLockKeyResponseSchema
  - `keyId` string, required
  - `propertyId` string, required
  - `reservationId` string, required
  - `subReservationId` string, required
  - `issuerId` string, required
  - `guestId` string, nullable
  - `rooms` string[], required
  - `commonRooms` string[], required
  - `startDateTime` string, Y-m-d\TH:i:sP, required
  - `endDateTime` string, Y-m-d\TH:i:sP, required
  - `encoder` string, nullable
  - `keyCode` string, nullable
  - `keyType` string, required
  - `mobileId` string, nullable
  - `externalId` string, nullable
  - `status` string, required
  - `errorMessage` string, nullable
  - `createdAt` string, required
  - `updatedAt` string, nullable

## Other responses

- `400`: Bad Request response
- `404`: Not found response
- `500`: Internal server error

---

[API](https://skmtc.dev/cloudbeds/apis/cloudbeds-api-v2.md) - [All operations](https://skmtc.dev/cloudbeds/apis/cloudbeds-api-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/cloudbeds/apis/cloudbeds-api-v2/revisions/69bffac143cc?raw)
