Units

Update a unit

Rewrites a unit's stored fields. Every field is written as sent, so anything you leave out is cleared.

PUT
https://api.portal.magicdoor.com/company-app/units/{unitId}

Authorization

Authorizationstringrequired
Bearer token — Send your API token in the Authorization header as Bearer <token>. Requests without a valid token are rejected with 401 Unauthorized.

Path parameters

unitIdstringrequired

Snowflake id of the unit, as a decimal string.

example: 1830472847398404098

Body

application/json

The unit is written from this body in full. A field you leave out is cleared, not left alone.

namestringrequired

What to call the unit, 1 to 200 characters. Note the longer limit here than on create, which allows 150.

addressobject

An address of the unit's own. Leave it out to clear the override and fall back to the property's address.

bedsnumber

Bedrooms. Zero or more, in steps of 0.5.

bathsnumber

Bathrooms. Zero or more, in steps of 0.5.

unitSizeSqftinteger

Floor area in square feet. Zero or more.

marketRentnumber

The rent the unit is expected to fetch, as a decimal with at most two places.

floorinteger

Which floor the unit is on, 1 to 200.

imageSessionIdstring

Id of a completed upload session for a new main photo.

imageIdstringdeprecated

Id of an already-uploaded but unclaimed file. Use imageSessionId instead.

iconsstring[]

Replaces the icon list. Leave it out and the list is emptied.

magicTagsobject

Replaces the labels, as a map of string keys to string values. Leave it out and they are cleared.

Response

200 · The updated unit, hydrated.

idstring

Snowflake id of the unit.

namestring

The unit's name — typically its number or letter, for example "2B". For a single-unit property this is often "Home".

addressobject

An address that overrides the property's, for a unit with its own street address. Absent when the unit uses the property address, which is the usual case.

bedsnumber

Bedrooms. Whole or half numbers only. Absent when it was never set.

bathsnumber

Bathrooms. Whole or half numbers only. Absent when it was never set.

unitSizeSqftinteger

Floor area in square feet. Absent when it was never set.

marketRentnumber

The rent this unit is expected to fetch, as a decimal amount such as 1850.00. This is an asking figure on the unit, not the rent on any lease. Absent when it was never set.

floorinteger

Which floor the unit is on, 1 to 200. Absent when it was never set.

propertyIdstring

The property this unit belongs to.

portfolioIdstring

The portfolio the unit's property belongs to. Kept in step with the property.

activeboolean

false once the unit has been deactivated.

imageIdstring

The file behind the unit's main photo. Absent when no photo has been set.

iconsstring[]

Icon keys pinned to the unit. Free-form strings.

magicTagsobject

Free-form labels on the unit, as a map of string keys to string values. Absent when none are set.

imageobject

The unit's main photo, resolved from imageId. Absent when no photo has been set.

propertyobject

The property this unit belongs to, expanded.

activeLeasesLease[]

The leases currently running on this unit, in the same shape the leases endpoints return. Usually zero or one; more than one appears when leases overlap. Empty for a vacant unit.

postedBalancenumber

Computed: what the unit's leases owe, counting only charges that have already been posted.

singleLineAddressstring

Computed one-line address for the unit: the unit's own address if it has one, otherwise the property's address with the unit name appended. The unit name is left off for a single-unit property. Absent when neither the unit nor the property has an address.

recentRentalApplicationsinteger

Computed: how many distinct rental applications that have not been retracted named this unit in the recent window.

latestRentalApplicationIdstring

The most recent rental application, not retracted, that named this unit. Absent when nobody has applied.

400 · A required field is missing or fails validation. The response carries an `errors` member mapping each rejected field name to its message.

401 · The access token is missing, expired, or not for this company.

404 · No unit with that id, or it belongs to another company.

422 · The unit has been deactivated, so it cannot be edited.

Which fields you can write

The unit record stores name, address, beds, baths, unitSizeSqft, marketRent, floor, imageId, icons and magicTags. propertyId and portfolioId are set when the unit is created and changed only by the move endpoint. Everything else on the response is computed on read: address.isValid, singleLineAddress, activeLeases, postedBalance, recentRentalApplications and latestRentalApplicationId.

The property is not settable here

There is no propertyId in this body. To move a unit to a different property use Move a unit, which checks the target and refuses a no-op move.