curl --fail-with-body -X PUT https://maatstays.wtf/v1/units/8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804/house-rules \
-H "Authorization: Bearer $MAAT_PARTNER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"answers": [
{ "slug": "pets_allowed", "allowed": true },
{ "slug": "smoking_allowed", "allowed": false }
],
"check_in_time": "15:00",
"check_out_time": "12:00"
}'// Send the rules you decided; every other active rule is written `false`.
const res = await fetch(
'https://maatstays.wtf/v1/units/8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804/house-rules',
{
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.MAAT_PARTNER_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
answers: [
{ slug: 'pets_allowed', allowed: true },
{ slug: 'smoking_allowed', allowed: false },
],
check_in_time: '15:00',
check_out_time: '12:00',
}),
},
);
const body = await res.json();
if (!res.ok) throw new Error(`${body.code}: ${body.detail}`);
console.log(body.house_rules, body.check_in_time);
import os
import requests
# Send the rules you decided; every other active rule is written False.
res = requests.put(
"https://maatstays.wtf/v1/units/8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804/house-rules",
headers={"Authorization": f"Bearer {os.environ['MAAT_PARTNER_TOKEN']}"},
json={
"answers": [
{"slug": "pets_allowed", "allowed": True},
{"slug": "smoking_allowed", "allowed": False},
],
"check_in_time": "15:00",
"check_out_time": "12:00",
},
timeout=30,
)
body = res.json()
if res.status_code >= 400:
raise RuntimeError(f"{body['code']}: {body.get('detail')}")
print(body["house_rules"], body["check_in_time"])
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
)
type answer struct {
Slug string `json:"slug"`
Allowed bool `json:"allowed"`
}
type unit struct {
HouseRules []answer `json:"house_rules"`
CheckInTime string `json:"check_in_time"`
}
func main() {
// Send the rules you decided; every other active rule is written false.
payload, _ := json.Marshal(map[string]any{
"answers": []answer{
{Slug: "pets_allowed", Allowed: true},
{Slug: "smoking_allowed", Allowed: false},
},
"check_in_time": "15:00",
"check_out_time": "12:00",
})
req, _ := http.NewRequest(http.MethodPut,
"https://maatstays.wtf/v1/units/8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804/house-rules",
bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("MAAT_PARTNER_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode >= 400 {
log.Fatalf("house-rule write failed: %d", res.StatusCode)
}
var body unit
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
log.Fatal(err)
}
fmt.Println(len(body.HouseRules), body.CheckInTime)
}
{
"unit_id": "8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804",
"unit_type": "apartment",
"max_guests": 4,
"bedrooms": 2,
"beds": 3,
"bathrooms": 1,
"check_in_time": "15:00",
"check_out_time": "12:00",
"amenities": [
"wifi",
"air-conditioning",
"washing-machine"
],
"house_rules": [
{
"slug": "pets_allowed",
"allowed": true
},
{
"slug": "smoking_allowed",
"allowed": false
}
],
"listings": [
{
"listing_id": "7c4b1e58-2a90-4f61-b3d2-5e8a1c0f7d24",
"inventory_kind": "unit",
"title": "Courtyard flat with the blue door",
"description": "A two-bedroom flat one street back from the corniche.",
"status": "listed",
"base_rate": {
"value": "1250.00",
"currency": "EGP"
},
"cleaning_fee": {
"value": "200.00",
"currency": "EGP"
},
"instant_booking": true,
"is_exclusive": false,
"is_best_price": true,
"rating": {
"average": 4.8,
"count": 24
},
"publishable": true,
"missing": [],
"console_url": "https://maatstays.wtf/properties/3c9d1f42-7b60-4a18-9e55-0d2a6f8c31b7"
}
]
}Replace a unit's house-rule answers
Replaces a unit’s house-rule answers, and optionally its door times.
You send the rules you decided; we expand the rest. Every active rule in
Maat’s catalogue that you did not name is written allowed: false. That is what
makes this a set replace rather than a merge, and it is what keeps a rule with no
answer meaning “never asked” on the read side rather than quietly meaning
“no”. Absence has to keep meaning what it says.
An empty answers array is legitimate, and it means “nothing is allowed”. It
is not the same as never having answered.
A slug the catalogue does not have — including a retired one — refuses the
whole call with 400, naming the slugs. GET /catalog/house-rules publishes
every rule and flags a retired one: keep a retired entry to explain an answer you
read back, never to write a new one.
check_in_time and check_out_time are not rules. A time is a value, not a
permission, and both are columns on the unit. They ride this request because they
are written in the same transaction as the answers, so a half-applied edit
where the times saved and the answers rolled back cannot happen. Omit them to
leave the stored times alone.
At most a hundred answers, and no repeated slug.
A 403 on this operation carries one of two codes — insufficient_scope or
workspace_scope_mismatch. Branch on code.
The body is strict. An undeclared field is a 400 validation_failed naming it,
never a silent drop, and a stray query string is refused the same way.
A property with more than one unit, or more than one listing, is refused with
409 property_not_simple; a listing that is not a stay with
409 inventory_not_supported. Nothing is written either way.
Live in a sandbox workspace. Returns 501 against a production one.
curl --fail-with-body -X PUT https://maatstays.wtf/v1/units/8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804/house-rules \
-H "Authorization: Bearer $MAAT_PARTNER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"answers": [
{ "slug": "pets_allowed", "allowed": true },
{ "slug": "smoking_allowed", "allowed": false }
],
"check_in_time": "15:00",
"check_out_time": "12:00"
}'// Send the rules you decided; every other active rule is written `false`.
const res = await fetch(
'https://maatstays.wtf/v1/units/8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804/house-rules',
{
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.MAAT_PARTNER_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
answers: [
{ slug: 'pets_allowed', allowed: true },
{ slug: 'smoking_allowed', allowed: false },
],
check_in_time: '15:00',
check_out_time: '12:00',
}),
},
);
const body = await res.json();
if (!res.ok) throw new Error(`${body.code}: ${body.detail}`);
console.log(body.house_rules, body.check_in_time);
import os
import requests
# Send the rules you decided; every other active rule is written False.
res = requests.put(
"https://maatstays.wtf/v1/units/8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804/house-rules",
headers={"Authorization": f"Bearer {os.environ['MAAT_PARTNER_TOKEN']}"},
json={
"answers": [
{"slug": "pets_allowed", "allowed": True},
{"slug": "smoking_allowed", "allowed": False},
],
"check_in_time": "15:00",
"check_out_time": "12:00",
},
timeout=30,
)
body = res.json()
if res.status_code >= 400:
raise RuntimeError(f"{body['code']}: {body.get('detail')}")
print(body["house_rules"], body["check_in_time"])
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
)
type answer struct {
Slug string `json:"slug"`
Allowed bool `json:"allowed"`
}
type unit struct {
HouseRules []answer `json:"house_rules"`
CheckInTime string `json:"check_in_time"`
}
func main() {
// Send the rules you decided; every other active rule is written false.
payload, _ := json.Marshal(map[string]any{
"answers": []answer{
{Slug: "pets_allowed", Allowed: true},
{Slug: "smoking_allowed", Allowed: false},
},
"check_in_time": "15:00",
"check_out_time": "12:00",
})
req, _ := http.NewRequest(http.MethodPut,
"https://maatstays.wtf/v1/units/8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804/house-rules",
bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("MAAT_PARTNER_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode >= 400 {
log.Fatalf("house-rule write failed: %d", res.StatusCode)
}
var body unit
if err := json.NewDecoder(res.Body).Decode(&body); err != nil {
log.Fatal(err)
}
fmt.Println(len(body.HouseRules), body.CheckInTime)
}
{
"unit_id": "8e4b2a17-5c39-4d61-b0f2-7a9c3e51d804",
"unit_type": "apartment",
"max_guests": 4,
"bedrooms": 2,
"beds": 3,
"bathrooms": 1,
"check_in_time": "15:00",
"check_out_time": "12:00",
"amenities": [
"wifi",
"air-conditioning",
"washing-machine"
],
"house_rules": [
{
"slug": "pets_allowed",
"allowed": true
},
{
"slug": "smoking_allowed",
"allowed": false
}
],
"listings": [
{
"listing_id": "7c4b1e58-2a90-4f61-b3d2-5e8a1c0f7d24",
"inventory_kind": "unit",
"title": "Courtyard flat with the blue door",
"description": "A two-bedroom flat one street back from the corniche.",
"status": "listed",
"base_rate": {
"value": "1250.00",
"currency": "EGP"
},
"cleaning_fee": {
"value": "200.00",
"currency": "EGP"
},
"instant_booking": true,
"is_exclusive": false,
"is_best_price": true,
"rating": {
"average": 4.8,
"count": 24
},
"publishable": true,
"missing": [],
"console_url": "https://maatstays.wtf/properties/3c9d1f42-7b60-4a18-9e55-0d2a6f8c31b7"
}
]
}Authorizations
A short-lived partner token, obtained by exchanging your API key at
POST /token. Send it as Authorization: Bearer <access_token>.
Tokens live for fifteen minutes by default and never for more than an hour. Mint one per batch of work, not one per request.
The token carries the workspace and the environment its key was issued for. You cannot change either by asking: the exchange ignores everything in the request body for exactly that reason.
It also carries the key's scopes (scope, a list). Every operation names a
scope as x-maat-scope, and a token whose key lacks it is refused with
403 insufficient_scope, naming the scope. Scopes are fixed when a key is
issued and are re-read from the key on every request, so a key narrowed today is
narrowed on its next call — the token's scope is what the key held at exchange
time, for your own reading, never what authorizes a request.
x-maat-scope is the floor, and on the quick-action operations it is not the
whole requirement. PUT and DELETE /listings/{listing_id}/quick-actions/{template_key}
carry rules:write, and additionally require pricing:write when
template_key begins pricing. — the capability depends on the template in
the path, because a cleaning fee changes what a guest pays and a minimum stay
does not. The refusal is the same 403 insufficient_scope, naming
pricing:write. The two READS apply the same requirement without erroring:
GET /listings/{listing_id}/quick-actions still lists the pricing.* rows but
withholds their applied state, and GET /listings/{listing_id}/rules omits the
pricing rules entirely and reports pricing_withheld in warnings. These four
are the only operations in this document whose requirement is not exactly their
x-maat-scope, and each of them says so machine-readably:
x-maat-scope-additional lists the second scope it can require and
x-maat-scope-additional-when says what happens without it.
Never send it as a cookie or in a query string, and never store it — store the API key, mint tokens from it.
Path Parameters
Maat's identifier for the physical unit.
Body
The house-rule answer set, replaced — and the door times, which ride along.
Send the rules you decided. Every active rule in Maat's catalogue you did not
name is written allowed: false, which is what keeps "a rule with no answer"
meaning never asked on the read side.
At most a hundred, and no repeated slug — a repeat is a 400. An EMPTY
array is legitimate and means "nothing is allowed"; it is not the same as
never having answered.
A slug the catalogue does not have, INCLUDING a retired one, refuses the
whole call with 400 naming the slugs.
100Show child attributes
Show child attributes
Local time, 24-hour. NOT a rule — a value on the unit, written in the same transaction as the answers. Omit it to leave the stored time alone.
^([01]\d|2[0-3]):[0-5]\d$"15:00"
Local check-out time, 24-hour HH:MM. The platform default is 12:00.
^([01]\d|2[0-3]):[0-5]\d$"12:00"
Response
The unit, read back after the change.
One physical unit, and the listings sold on it.
What kind of physical inventory this is, as a slug.
The most people the unit sleeps.
Rooms intended for sleeping.
Beds in total, across every room.
Whole bathrooms. Half-bathrooms are not expressible.
Local HH:MM, 24-hour.
^([01]\d|2[0-3]):[0-5]\d$"15:00"
Local check-out time, 24-hour HH:MM. The platform default is 12:00.
^([01]\d|2[0-3]):[0-5]\d$"12:00"
Amenity slugs. See GET /catalog/amenities.
Every house rule that has been answered for this unit. A rule that was never asked is absent.
Show child attributes
Show child attributes
The sellable views of this unit. One today; the model allows more.
Show child attributes
Show child attributes
The unit's id — the one GET /units/{unit_id} takes.