> For the complete documentation index, see [llms.txt](https://docs.channex.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.channex.io/api-v.1-documentation/room-types-collection/create-room-type-api.md).

# Create Room Type API

## Create a room type

> Create a room type for a property. The created room type is returned with \`201 Created\`.

```json
{"openapi":"3.1.0","info":{"title":"Channex.io — Public API","version":"0.0.0"},"tags":[{"name":"Room Types","description":"Manage Room Types — the accommodation inventory (rooms, villas, dormitory beds) of a Property."}],"servers":[{"url":"https://app.channex.io/api/v1","description":"Production server","variables":{}},{"url":"https://staging.channex.io/api/v1","description":"Staging server","variables":{}}],"security":[{"UserApiKeyAuth":[]}],"components":{"securitySchemes":{"UserApiKeyAuth":{"type":"apiKey","in":"header","name":"user-api-key","description":"API key for programmatic access, sent in the `user-api-key` header."}},"schemas":{"RoomTypes.RoomTypeResource":{"type":"object","required":["type","id","attributes","relationships"],"properties":{"type":{"type":"string","enum":["room_type"]},"id":{"$ref":"#/components/schemas/Common.Scalars.id"},"attributes":{"$ref":"#/components/schemas/RoomTypes.RoomType"},"relationships":{"$ref":"#/components/schemas/RoomTypes.RoomTypeRelationships"}},"description":"A room type as returned in responses."},"Common.Scalars.id":{"type":"string","format":"uuid"},"RoomTypes.RoomType":{"type":"object","required":["id","position","title","count_of_rooms","occ_adults","occ_children","occ_infants","default_occupancy","room_kind","capacity","codes","meta","content"],"properties":{"id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"Unique room type identifier."},"position":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.nonNegativeInt"}],"description":"Zero-based display position of the room type. Set with the `update_positions` endpoint."},"title":{"type":"string","maxLength":255,"description":"Room type title, as shown in the system. Unique within the property."},"count_of_rooms":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.positiveInt"}],"description":"Number of rooms (units) of this type available to sell. Affects billing for vacation rentals."},"occ_adults":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.positiveInt"}],"description":"Number of adult bed spaces in the room type."},"occ_children":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.nonNegativeInt"}],"description":"Number of child-only bed spaces. Children may also sleep in adult beds; set to 0 if there are no child-only beds."},"occ_infants":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.nonNegativeInt"}],"description":"Number of infant cots available in the room type."},"default_occupancy":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.positiveInt"}],"description":"Guests accommodated by default without extra spaces. Defaults to `occ_adults` and is silently lowered to it when a larger value is sent. Lowering `occ_adults` lowers this too.","deprecated":true},"room_kind":{"allOf":[{"$ref":"#/components/schemas/RoomTypes.RoomKind"}],"description":"Kind of room type. Defaults to `room`."},"capacity":{"anyOf":[{"type":"integer","format":"int32"},{"type":"null"}],"description":"Number of beds in a single physical room, used for `dorm` room types. Stored and returned whatever the `room_kind`; `null` until set."},"codes":{"anyOf":[{"type":"object","unevaluatedProperties":{}},{"type":"null"}],"description":"Free-form object stored for the client's own use, or null. The platform neither reads nor writes it: an object sent here comes back unchanged."},"meta":{"anyOf":[{"type":"object","unevaluatedProperties":{}},{"type":"null"}],"description":"Free-form object stored for the client's own use, or null. The platform neither reads nor writes it: an object sent here comes back unchanged."},"content":{"$ref":"#/components/schemas/RoomTypes.RoomTypeContent"}},"description":"A room type (an accommodation inventory unit — a room, villa, or dormitory bed) as returned in responses: every attribute is present."},"Common.Scalars.nonNegativeInt":{"type":"integer","format":"int32","minimum":0},"Common.Scalars.positiveInt":{"type":"integer","format":"int32","minimum":1},"RoomTypes.RoomKind":{"type":"string","enum":["room","dorm"],"description":"Kind of room type. A `dorm` sells beds within a shared physical room; a `room` sells the whole unit."},"RoomTypes.RoomTypeContent":{"type":"object","required":["description","photos"],"properties":{"description":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Room type description. Null by default."},"photos":{"type":"array","items":{"$ref":"#/components/schemas/Photos.Photo"},"description":"Photos attached to the room type. A room type holds at most 10 of them, counted separately from the property's own photos and from every other room type's. See the Photos resource for the full model and management endpoints."}},"description":"Room type content as returned in responses."},"Photos.Photo":{"type":"object","required":["id","property_id","room_type_id","kind","position","author","description","url"],"properties":{"id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"Unique photo identifier."},"property_id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"UUID of the Property the photo belongs to. Cannot be changed after the photo is created."},"room_type_id":{"anyOf":[{"$ref":"#/components/schemas/Common.Scalars.id"},{"type":"null"}],"description":"UUID of the Room Type the photo belongs to, or null when the photo is attached at property level. Cannot be changed after the photo is created."},"kind":{"allOf":[{"$ref":"#/components/schemas/Photos.PhotoKind"}],"description":"Kind of photo: `photo` for the property or room type itself, `ad` for an advertising image, `menu` for a restaurant menu. Defaults to `photo`."},"position":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.nonNegativeInt"}],"description":"Position in the photo list of the property or, for a room type photo, of that room type. Positions run from `0` without gaps and `0` designates the cover photo. On create the photo is inserted at this position, or appended when omitted; on update it is moved there. The other photos shift to keep the positions contiguous, and a value past the end places the photo last."},"author":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Photo author, or null. An empty string is stored as `null`."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Photo description, or null. An empty string is stored as `null`."},"url":{"type":"string","format":"uri","description":"URL of the image as served by Channex. The create response carries a placeholder image URL; once the source image has been fetched and stored, typically within a few seconds, the photo carries the URL of the stored copy — read the photo back to obtain it. A source image that cannot be fetched leaves the placeholder in place."}},"description":"A photo as returned in responses: every attribute is present."},"Photos.PhotoKind":{"type":"string","enum":["photo","ad","menu"],"description":"Kind of photo: `photo` for the property or room type itself, `ad` for an advertising image, `menu` for a restaurant menu. Defaults to `photo`."},"RoomTypes.RoomTypeRelationships":{"type":"object","required":["property","facilities"],"properties":{"property":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/Common.Scalars.id"},"type":{"type":"string","enum":["property"]}},"required":["id","type"]}},"required":["data"],"description":"Property the room type belongs to."},"facilities":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Facilities.FacilityResource"}}},"required":["data"],"description":"Facilities associated with the room type. Each item is a facility resource carrying its `title` and `category`."}},"description":"Relationships of a room type resource."},"Facilities.FacilityResource":{"type":"object","required":["type","id","attributes"],"properties":{"type":{"type":"string","enum":["facility"]},"id":{"$ref":"#/components/schemas/Common.Scalars.id"},"attributes":{"$ref":"#/components/schemas/Facilities.Facility"}},"description":"A facility resource object (JSON:API), returned by both list and options endpoints."},"Facilities.Facility":{"type":"object","required":["id","category","title"],"properties":{"id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"Unique facility identifier. Mirrors the resource `id`."},"category":{"type":"string","description":"Grouping code the facility belongs to, in lower snake case. The property and\nroom type dictionaries have separate vocabularies: a code valid for one is\nrejected by the other. `filter[category]` takes this value."},"title":{"type":"string","description":"Human-readable facility name."}},"description":"Attributes of a facility (amenity) available at a property or room type."},"Common.Errors.UnparsableRequest":{"type":"object","required":["errors"],"properties":{"errors":{"$ref":"#/components/schemas/Common.Errors.UnparsableRequestObject"}},"description":"The request body could not be parsed as JSON."},"Common.Errors.UnparsableRequestObject":{"type":"object","required":["code","title","details"],"properties":{"code":{"type":"string","enum":["bad_request"]},"title":{"type":"string","enum":["Bad Request"]},"details":{"type":"object","unevaluatedProperties":{"type":"string"},"description":"Maps the part of the request that could not be parsed to the reason."}},"description":"Error object for an unparsable request body, naming the malformed part."},"Common.Errors.Unauthorized":{"type":"object","required":["errors"],"properties":{"errors":{"type":"object","required":["code","title"],"properties":{"code":{"type":"string","enum":["unauthorized"]},"title":{"type":"string","enum":["Unauthorized"]}},"description":"Shape of a single JSON:API error object: a stable machine code plus a human-readable title."}},"description":"Authentication credentials are missing or invalid."},"Common.Errors.UnprocessableEntity":{"type":"object","required":["errors"],"properties":{"errors":{"$ref":"#/components/schemas/Common.Errors.UnprocessableEntityObject"}},"description":"The request was understood but could not be carried out; `details`, where present, names the reason per argument."},"Common.Errors.UnprocessableEntityObject":{"type":"object","required":["code","title"],"properties":{"code":{"type":"string","enum":["unprocessable_entity"]},"title":{"type":"string","enum":["Unprocessable Entity"]},"details":{"type":"object","unevaluatedProperties":{"type":"string"},"description":"Maps each rejected argument to the reason it was rejected."}},"description":"Error object for a rejected request, adding the reason per argument."},"Common.Errors.ValidationError":{"type":"object","required":["errors"],"properties":{"errors":{"$ref":"#/components/schemas/Common.Errors.ValidationErrorObject"}},"description":"The request body failed validation."},"Common.Errors.ValidationErrorObject":{"type":"object","required":["code","title","details"],"properties":{"code":{"type":"string","enum":["validation_error"]},"title":{"type":"string","enum":["Validation Error"]},"details":{"type":"object","unevaluatedProperties":{"type":"array","items":{"type":"string"}},"description":"Maps each invalid field to the list of validation messages for that field."}},"description":"Error object for a failed validation, adding per-field messages."},"RoomTypes.RoomTypeCreateRequest":{"type":"object","required":["room_type"],"properties":{"room_type":{"$ref":"#/components/schemas/RoomTypes.RoomTypeCreate"}},"description":"Request body accepted when creating a room type."},"RoomTypes.RoomTypeCreate":{"type":"object","required":["title","count_of_rooms","occ_adults","occ_children","occ_infants","property_id"],"properties":{"title":{"type":"string","maxLength":255,"description":"Room type title, as shown in the system. Unique within the property."},"count_of_rooms":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.positiveInt"}],"description":"Number of rooms (units) of this type available to sell. Affects billing for vacation rentals."},"occ_adults":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.positiveInt"}],"description":"Number of adult bed spaces in the room type."},"occ_children":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.nonNegativeInt"}],"description":"Number of child-only bed spaces. Children may also sleep in adult beds; set to 0 if there are no child-only beds."},"occ_infants":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.nonNegativeInt"}],"description":"Number of infant cots available in the room type."},"default_occupancy":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.positiveInt"}],"description":"Guests accommodated by default without extra spaces. Defaults to `occ_adults` and is silently lowered to it when a larger value is sent. Lowering `occ_adults` lowers this too.","deprecated":true},"room_kind":{"allOf":[{"$ref":"#/components/schemas/RoomTypes.RoomKind"}],"description":"Kind of room type. Defaults to `room`."},"capacity":{"anyOf":[{"type":"integer","format":"int32"},{"type":"null"}],"description":"Number of beds in a single physical room, used for `dorm` room types. Stored and returned whatever the `room_kind`; `null` until set."},"codes":{"anyOf":[{"type":"object","unevaluatedProperties":{}},{"type":"null"}],"description":"Free-form object stored for the client's own use, or null. The platform neither reads nor writes it: an object sent here comes back unchanged."},"meta":{"anyOf":[{"type":"object","unevaluatedProperties":{}},{"type":"null"}],"description":"Free-form object stored for the client's own use, or null. The platform neither reads nor writes it: an object sent here comes back unchanged."},"property_id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"UUID of the property this room type belongs to. Cannot be changed after the room type is created: a different value is refused, the same value is accepted."},"facilities":{"type":"array","items":{"$ref":"#/components/schemas/Common.Scalars.id"},"description":"Room type facility identifiers. See the Room Type Facilities endpoint for the available identifiers. The list replaces the room type's current facilities: facilities it does not name are detached, `[]` detaches all, identifiers naming no facility are dropped, and a duplicate counts once."},"content":{"$ref":"#/components/schemas/RoomTypes.RoomTypeContentWrite"}},"description":"Room type attributes accepted when creating a room type."},"RoomTypes.RoomTypeContentWrite":{"type":"object","properties":{"description":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Room type description. Null by default."},"photos":{"type":"array","items":{"$ref":"#/components/schemas/Photos.EmbeddedPhotoWrite"},"description":"Photos to attach to the room type. The list is merged into the room type's photos rather than replacing them: an entry with a new `url` attaches a photo, an entry carrying `id` updates that photo, photos the list does not name are kept, and an entry with `is_removed: true` removes the photo it names. A room type holds at most 10 photos, counted separately from the property's own photos and from every other room type's: a request that would take the count past 10 is refused, while one that does not raise it is accepted even for a room type already holding more, and removing a photo frees its place. See the Photos resource for the full model."}},"description":"Room type content accepted on create and update."},"Photos.EmbeddedPhotoWrite":{"type":"object","required":["url","kind"],"properties":{"id":{"allOf":[{"$ref":"#/components/schemas/Common.Scalars.id"}],"description":"UUID of an existing photo of this parent to update in place or, with `is_removed`, to remove. Omit to attach a new photo. An identifier naming no photo of this parent leaves the list unchanged."},"url":{"type":"string","format":"uri","description":"URL to fetch the image from: the temporary URL returned by the upload endpoint, passed unchanged, or any reachable image URL. The image is copied into Channex storage, and responses carry that copy's URL rather than this one. Required in every entry; an entry without `id` whose URL matches a photo already attached updates that photo."},"kind":{"allOf":[{"$ref":"#/components/schemas/Photos.PhotoKind"}],"description":"Kind of photo. Required when attaching or updating a photo; an entry that only removes one may omit it."},"author":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Photo author, or null."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Photo description, or null."},"is_removed":{"type":"boolean","description":"Set to `true` to remove the photo named by `id` or `url` from the parent. The photo is deleted and is no longer readable through the Photos resource. Defaults to `false`."}},"description":"A photo in a parent resource's `content.photos` list."}}},"paths":{"/room_types":{"post":{"operationId":"RoomTypes_create","summary":"Create a room type","description":"Create a room type for a property. The created room type is returned with `201 Created`.","parameters":[],"responses":{"201":{"description":"201 Created response wrapping a resource body.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/RoomTypes.RoomTypeResource"}},"description":"JSON:API document wrapping a single resource."}}}},"400":{"description":"The request body could not be parsed as JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Common.Errors.UnparsableRequest"}}}},"401":{"description":"Authentication credentials are missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Common.Errors.Unauthorized"}}}},"422":{"description":"The request was understood but could not be carried out; `details`, where present, names the reason per argument.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Common.Errors.UnprocessableEntity"},{"$ref":"#/components/schemas/Common.Errors.ValidationError"}]}}}}},"tags":["Room Types"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoomTypes.RoomTypeCreateRequest"}}}}}}}}
```
