> ## Documentation Index
> Fetch the complete documentation index at: https://developer.maatstays.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Push a property

> Push the properties you manage, keyed by your own identifier. Replace, not merge.

`PUT /v1/properties/{provider_id}` pushes one property into Maat. The `provider_id` in
the path is **your** identifier — unique within your integration, never across the
platform — which makes the operation idempotent by construction: retrying a timed-out
push is always safe, and there is no idempotency header to remember.

**What `provider_id` may contain:** any non-empty string of at most 128 characters, url
-encoded in the path. It is opaque to us — we never parse it, never derive anything from it,
and never show it to anyone else. Use whatever your own system already calls the property;
two integrations may use the same string for different properties and neither will ever see
the other's.

A `provider_id` belongs to the environment (sandbox or live) whose key first pushed it. One
your other environment already holds is refused with `409 conflict`, and nothing is written,
until that copy is gone — the nightly [sandbox](https://developer.maatstays.com/guides/sandbox.md) reset removes the sandbox's.
Use a different `provider_id` in each environment.

```bash cURL theme={null}
curl --fail-with-body -X PUT https://maatstays.com/v1/properties/my-prop-9001 \
  -H "Authorization: Bearer $MAAT_PARTNER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Courtyard flat with the blue door",
    "property_type": "apartment",
    "address": {
      "line1": "14 Example Street",
      "city": "Alexandria",
      "country": "EG",
      "latitude": 31.2001,
      "longitude": 29.9187
    },
    "occupancy": { "max_guests": 4, "bedrooms": 2, "beds": 3, "bathrooms": 1 },
    "base_rate": { "value": "1250.00", "currency": "EGP" },
    "amenities": ["wifi", "air-conditioning"],
    "photos": [
      { "url": "https://images.example-partner.invalid/p/9001/1.jpg", "position": 0 }
    ],
    "status": "listed"
  }'
```

```python Python theme={null}
import os

import requests

property_payload = {
    "name": "Courtyard flat with the blue door",
    "property_type": "apartment",
    "address": {
        "line1": "14 Example Street",
        "city": "Alexandria",
        "country": "EG",
        "latitude": 31.2001,
        "longitude": 29.9187,
    },
    "occupancy": {"max_guests": 4, "bedrooms": 2, "beds": 3, "bathrooms": 1},
    "base_rate": {"value": "1250.00", "currency": "EGP"},
    "amenities": ["wifi", "air-conditioning"],
    "photos": [
        {"url": "https://images.example-partner.invalid/p/9001/1.jpg", "position": 0}
    ],
    "status": "listed",
}

res = requests.put(
    "https://maatstays.com/v1/properties/my-prop-9001",
    headers={"Authorization": f"Bearer {os.environ['MAAT_PARTNER_TOKEN']}"},
    json=property_payload,
    timeout=30,
)

body = res.json()
if res.status_code >= 400:
    raise RuntimeError(f"{body['code']}: {body.get('detail')}")

# photos_processing clears on its own — wait, do not re-send.
print(body["publishable"], body["missing"])
```

```json The response theme={null}
{
    "provider_id": "my-prop-9001",
    "result": "updated",
    "property_id": "3c9d1f42-7b60-4a18-9e55-0d2a6f8c31b7",
    "unit_id": "8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804",
    "listing_id": "7c4b1e58-2a90-4f61-b3d2-5e8a1c0f7d24",
    "status": "listed",
    "publishable": true,
    "missing": [],
    "unknown_amenities": [],
    "photos_rejected": []
}
```

`result` is `created` or `updated`. `property_id` and `unit_id` are always present —
they are the handles the
[targeted edits](https://developer.maatstays.com/guides/property-lifecycle.md#edits-not-upserts) take. `listing_id` is
`null` until the property is complete enough to have one. The reference carries the same
sample in Node and Go.

## Replace, not merge

The payload you send is the whole property. An amenity you omit is removed; a photo you
omit is dropped. This mirrors how listings are edited everywhere on Maat, and it is the
only version of "update" in which *remove this amenity* is expressible at all. The
practical consequence: build your push from your own catalogue every time, never from a
diff.

## A property can be accepted and not yet sellable

A property with no price, no photos or no amenities is accepted and held in an
incomplete state rather than published at a placeholder price. The response tells you
exactly where it stands:

| Field | What it tells you |
| :- | :- |
| `publishable` | Whether the property can be shown to guests as it stands. |
| `missing[]` | Machine-readable reasons it cannot — `price`, `amenities`, `cover_photo`, `photos`, `photos_processing`, `unlisted`. |
| `listing_id` | Maat's identifier, once the property is complete enough to have one. `null` until then — never a placeholder. |
| `unknown_amenities` | Amenity slugs we did not recognise, echoed back rather than silently dropped. One unmapped slug never blocks the whole push. |
| `photos_rejected` | Photo URLs that did not become photos, each with a reason. |

Branch on `missing`, and treat its two photo values differently — they ask for opposite
things:

* **`photos_processing` means wait.** Photos are fetched asynchronously, so the *first*
  push of a complete property legitimately comes back `publishable: false`. There is
  nothing to do; we fetch, process and publish on our own.
* **`photos` means send more.** The property does not have enough usable images.

## Photos are URLs, and unchanged URLs are free

You send photo URLs; Maat fetches each one and runs it through the same processing
pipeline a host upload goes through. Three rules follow:

1. **URLs must be `https`, on a public DNS name, with no redirects.** Anything else
   comes back in `photos_rejected` as `url_refused` — and the reason never says more
   than that, by design.
2. **An unchanged URL is never re-fetched**, so a nightly catalogue sync costs nothing
   for the photos that did not change.
3. **Changed image bytes need a new URL.** We treat the URL as the identity of the
   photo; publish edited images at a fresh path.

`position: 0` is the cover photo. Per-photo failures are named individually in
`photos_rejected` (`url_refused`, `fetch_failed`, `unsupported_type`, `too_large`,
`processing_failed`), so one dead CDN path in a thirty-photo push is findable.

## The address is where the property is — not how to get in

Send only the address fields in the schema. Delivery detail — building, floor,
apartment number, directions to the key box — is not part of this contract
in either direction, because it is private to the host and the confirmed guest. A
payload carrying such a field is refused with `validation_failed`, not silently
trimmed.

## Locations

Maat files every property under a city from its location catalogue, so properties in the same
city read the same and can be found together. `GET /v1/locations/{country_code}` lists a
country's subdivisions (governorates, in Egypt) and its cities, each city under Maat's own
`city_id`. Map your addresses onto it once, then send the placement inside `address`:

```json theme={null}
"address": {
  "line1": "14 Example Street",
  "city": "Alexandria",
  "country": "EG",
  "subdivision_code": "EG-ALX",
  "city_id": "27fb3146-4374-45a8-bcf2-dba41099bcd3",
  "latitude": 31.2001,
  "longitude": 29.9187
}
```

* **With a `city_id`**, Maat stores the catalogue's English `city` and `region` for that city,
  whatever the body says.
* **Without one**, Maat matches the `city` and `region` you sent against the catalogue and
  keeps your text. The property read returns what it found as `country_code`,
  `subdivision_code` and `city_id`, or `null` when nothing matched.
* **A placement that does not hold together is refused** with `400 validation_failed`, naming
  the field in `errors[]`: a `city_id` outside the `subdivision_code` or `country` you sent, a
  `subdivision_code` outside `country`, a country Maat has no catalogue for, a city that has
  been retired (`unavailable`), or a `postal_code` that is not in the country's format
  (`invalid_format`). Nothing is written.

Map on `code` and `city_id`, never on a name — names are corrected from time to time, ids never
change. A retired city stays in the list, flagged `retired: true`, because properties saved with
it still read it back. The same fields are accepted by the
[address replacement](https://developer.maatstays.com/guides/property-lifecycle.md#edits-not-upserts).

Egypt (`EG`) is the only country with a catalogue today.

Location data © [Countries States Cities Database](https://github.com/dr5hn/countries-states-cities-database),
available under the [Open Database License (ODbL) 1.0](https://opendatacommons.org/licenses/odbl/1-0/),
with corrections and additions by Maat.

## Taking a property off sale

`status: "unlisted"` makes the property unsellable on Maat without deleting anything.
The response reports `unlisted` in `missing[]` *alongside* any real deficiency, so you
always know whether the property is otherwise complete before you re-list it. There is
no property deletion in the current contract.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.