Units
A unit belongs to a building. This endpoint creates and updates units. The same item shape is also accepted nested inside a prospect to create a unit on the fly.
See the Onboarding overview for the array, result, and upsert conventions this endpoint shares.
Create or update units
POST /partners/{owner_slug}/units
Content-Type: application/json
[
{ "external_system_id": "acme-unit-456",
"property_external_id": "acme-prop-123",
"address": {
"line_one": "1101 Midland Avenue APT 01",
"line_two": null,
"city": "New Brunswick",
"state": "NJ",
"zip": "08901"
},
"pms_unit_id": "0401",
"default_coverage": { "type": "multiplier", "value": 1.5 } }
]
The example omits name, so Greenlight derives it as "01" from the address.
Request fields
| Field | Required | Notes |
|---|---|---|
external_system_id | yes | Your own identifier. The upsert key |
property_external_id | yes | Your identifier for the building this unit belongs to, never a Greenlight one. A unit cannot move to a different building |
name | no | The unit number or name as it appears on the lease, such as "4B". It is printed on the renter's policy. When omitted, it is derived from address. Sending it always takes precedence over derivation, and a name you send is never replaced by a derived one |
address | no | The unit's full address, exactly as stored, including any line 1 and line 2 inconsistency, designators, and extraneous text. Object: line_one, line_two, city, state, zip; country is accepted and ignored. Used to derive the building street and, when name is absent, the unit's label. line_two is not read for identity |
pms_unit_id | no | The unit's code in the building's PMS, when the building has a PMS pair. For Yardi this is the unit code exactly as Yardi shows it, leading zeros included ("0401", not "401"); see Sourcing fields from Yardi. For an owner with an existing Greenlight relationship, send it: it is the primary unit match key |
default_coverage | no | Overrides the building's coverage for this unit, in the same two forms and limits. Inherits from the property when absent |
Response
{
"status_code": 200,
"results": [
{ "external_system_id": "acme-unit-456", "action": "created" }
],
"meta": { "created": 1, "updated": 0, "failed": 0 },
"request_id": "6f1c2b9e-7d4a-4c1e-9a55-0b8f3d2e1a77"
}
This endpoint takes unit items only. Units key on property_external_id, and one that Greenlight does not recognize fails that item, so send the property first, in an earlier POST /partners/{owner_slug}/properties request. Sending a building's units in a single request is recommended, because it resolves the building's derived address and unit names immediately.
Unit name derivation
When name is absent, the label is derived, in order:
- The designator found in the unit's own street line (
"APT 01"yields"01"). - The street line with the building's established street removed, so a bare
"…Blvd. 208"resolves to"208". - A designator in
line_two. - The
pms_unit_id.
A single unit building defaults to "1". Standard designator words are dropped ("APT 01" yields "01"); nonstandard ones are kept verbatim, such as "5th Floor" or "Loft B". Where nothing is derivable in a multi unit building, the item fails with the detail { "field": "name", "code": "not_derivable", "message": "is required and could not be derived from the address" }, because Greenlight never guesses a label that will appear on a policy.
Derivation applies the same way to a unit nested inside a prospect.
Unit matching
Within the parent building, in the same order as properties:
- If
external_system_idis already linked to a unit, that unit is updated. - PMS code, when sent. An existing unit with the same
pms_unit_idis adopted and linked. This match is exact and unaffected by naming style, which is why an owner with an existing Greenlight relationship should always send it: a derived name such as"113"may not match the PMS's stored"0113". - Otherwise, by a
nameyou sent, ignoring case. A derived name is not used for matching. A unit already linked to a different identifier fails the item, as with properties. - Otherwise, create.
One unit buildings. A property of type single_family or garden_community holds exactly one unit; a second unit sent for it fails that item with single_unit_property and a null field.
Item errors
A failed item carries an error whose details name each refused field (see Errors); the other items still apply.
Detail code | field | Cause |
|---|---|---|
required | external_system_id | Missing identifier |
unknown_building | property_external_id | Send the property first, in an earlier properties request |
out_of_grant | property_external_id | An owner with an existing Greenlight relationship, and the building is outside your grant |
wrong_building | property_external_id | The unit already exists under a different building |
not_derivable | name | See Unit name derivation |
ambiguous | name | Several existing units match and nothing separates them; nothing was created |
already_linked | external_system_id | The matched unit is linked to a different identifier of yours |
not_a_unit | external_system_id | The identifier is already in use for a property or bank account |
property_locked | null | The unit's building cannot currently be changed |
single_unit_property | null | A second unit sent for a one unit building |
unknown_coverage_type | default_coverage | type is not multiplier or amount_cents |
not_positive | default_coverage | value is not a positive number |
pms_authority_planned | default_coverage | Coverage cannot be set while the building is moving to PMS-sourced data |
contended | null | Another write to the same records was in progress; retry the item |
There is no unit level removal; a unit cannot be individually deactivated. Remove the whole building with the property's active: false, or resolve it with your Partner Success Manager.
Next steps
- Partner Prospect API: point a prospect at a building and unit