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

# Read your blocks back

> Lists the blocks **you** pushed into the workspace your key addresses, newest
window last. It is a reconciliation surface: after a timeout or a `500` you can
see whether a push actually landed, rather than guessing.

Two things bound the result and neither is a parameter you send: the blocks are
yours, and the workspace is the one your key was issued for. Another partner
syncing the same property sees their own blocks and never yours.

Nothing about a guest is here, because nothing about a guest was ever accepted.

Paged with `page` and `page_size`; `has_more` tells you whether to ask for the
next one. There is no total — we do not count the whole set to answer a page.

**Live in a sandbox workspace. Returns `501` against a production one**, where
nothing has been blocked and so there is nothing to read back.




## OpenAPI

````yaml /docs/openapi/openapi.yaml get /blocks
openapi: 3.1.0
info:
  title: Maat Stays Partner API
  version: '2026-08-26'
  summary: Two-way property and calendar sync for commercial channel partners.
  contact:
    name: Maat Stays partner integrations
    url: https://developer.maatstays.wtf
  description: >
    The Partner API is a two-way sync between a channel partner's platform and
    Maat Stays.


    ```

    Your system  ──  properties, calendar blocks  ──▶  Maat Stays

    Your system  ◀──  booking notifications, deletion requests  ──  Maat Stays

    ```


    Inbound, you push **what you have**: the properties you manage and the
    nights that are

    already taken on your own platform. Outbound, we push **what happened
    here**: a guest

    booked one of those properties on Maat, a booking was cancelled, or a guest
    exercised

    their right to erasure and you have records to delete.


    Nothing about a guest travels inbound. Maat has no relationship with
    somebody who booked

    on your platform, so a calendar block says "these nights are gone" and
    nothing else.


    # Contract status — read this before you build


    **The calendar-blocks contract is live in a sandbox workspace.** Push a
    block, read your

    blocks back, release one, and the nights really are held and released on a
    real calendar.

    Everything else in this document — and calendar blocks against a
    **production** workspace

    — is **published and not yet enabled**: a request that authenticates and
    validates

    receives `501 Not Implemented` with a problem document whose `code` is
    `not_enabled`.

    Nothing is written, and nothing is delivered.


    The split is decided by the workspace your key was issued for, not by a flag
    you can send.


    That is deliberate, and it is the honest version of a pre-release API. A
    fabricated `200`

    would tell you a calendar block was applied — so you would stop holding
    those nights on

    your side, and the next guest would book a room that is already occupied. It
    would tell

    you a deletion request was acknowledged, so you would record a compliance
    step that never

    happened. Neither is a mistake you could detect from our response.


    What IS live everywhere: authentication, authorization, the sandbox
    boundary, rate

    limiting and **every schema in this document**. Send us a malformed payload
    today and you

    get the same `validation_failed` you will get the day the contracts are
    enabled. Build

    against it now; nothing will change shape underneath you.


    One thing you can only exercise in the sandbox is a **conflict**. If nights
    you push are

    already booked or held on Maat, we refuse the whole range with `409` and
    name the

    colliding dates — we never apply part of a block, because a partial apply
    you were told

    succeeded is the one failure you could not detect.


    # Authentication


    You hold a long-lived API key (`maat_partner_…`) and exchange it for a
    short-lived bearer

    token. The key never reaches a contract endpoint; the token never lives
    longer than an

    hour.


    ```bash

    # 1. Exchange the key for a token. The body is empty on purpose:

    #    the workspace, the environment and your identity all come from

    #    the key itself, never from the request.

    curl -X POST https://maatstays.wtf/v1/token \
      -H "Authorization: Bearer maat_partner_a1b2c3d4e5f60718_REPLACE_WITH_YOUR_SECRET"

    # → 200

    # {

    #   "access_token": "eyJhbGciOiJIUzI1NiIs…",

    #   "token_type": "Bearer",

    #   "expires_in": 900,

    #   "workspace_id": "3f6b0f2e-1c3a-4d5e-9a70-8b2c4d6e0f11",

    #   "sandbox": true

    # }


    # 2. Call a contract with the token.

    curl -X PUT https://maatstays.wtf/v1/blocks/ota-res-55123 \
      -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs…" \
      -H "Content-Type: application/json" \
      -d '{"provider_id":"ota-prop-9001","check_in":"2026-09-01","check_out":"2026-09-05"}'
    ```


    The token endpoint is the one place in this API that does not answer with a
    problem

    document: it returns `{ "message": … }` when a key is refused or the service
    is not

    configured, with one indistinguishable `401` for an unknown key, a revoked
    key and a wrong

    secret. An unexpected fault there is a problem document like everywhere
    else, and every

    other response in this API is one.


    Revoking a key kills its outstanding tokens on their **next request**. We
    re-check the key

    on every call rather than waiting for a token to expire.


    # Sandbox


    Every key is issued for exactly one Maat workspace and is either a sandbox
    key or a

    production key. A sandbox workspace is a real tenancy with real endpoints
    and real

    create-then-read loops, and everything in it is kept off every public
    surface: it does not

    appear in search, on the map, in the guest feed, on a public listing page,
    or in any

    notification.


    The environment is not a parameter and there is no header that changes it.
    Your token

    carries the environment it was issued for, we compare it against the
    workspace on every

    request, and a disagreement in either direction is a
    `workspace_scope_mismatch`.


    A sandbox booking that ends in a real charge is not available: sandbox
    workspaces do not

    reach a payment provider at all, and a hold on one is refused rather than
    faked.


    # Idempotency


    The two inbound contracts are `PUT` to a URL that contains **your**
    identifier — your

    `provider_id` for a property, your `external_uid` for a block. Retrying is
    safe by

    construction; there is no idempotency header to remember and no request-body
    field that

    can be forgotten.


    Your identifiers are unique to you. Two partners can use the same
    `provider_id` for

    different properties and neither will ever see the other's.


    # Errors


    Every response outside the token endpoint uses `application/problem+json`

    ([RFC 7807](https://www.rfc-editor.org/rfc/rfc7807)):


    ```json

    {
      "type": "https://developer.maatstays.wtf/errors/not-enabled",
      "title": "Not implemented",
      "status": 501,
      "detail": "The calendar-blocks contract is published but not yet enabled…",
      "instance": "urn:maat:request:3b1f7a90-0d4c-4d4e-9b2a-6c1f0a2e5d33",
      "code": "not_enabled"
    }

    ```


    **Branch on `code`, never on `type` or on the wording of `detail`.** `code`
    is the

    contract; the rest is documentation.


    | `code`                     | Status | What it
    means                                                        |

    | -------------------------- | ------ |
    -------------------------------------------------------------------- |

    | `validation_failed`        | 400    | The payload does not match this
    document. `errors[]` names the fields. |

    | `unauthorized`             | 401    | No usable token: missing, malformed,
    expired, or its key was revoked.  |

    | `workspace_scope_mismatch` | 403    | The token's environment does not
    match the workspace it addresses.     |

    | `property_not_found`       | 404    | No such property in the workspace
    your key addresses.                  |

    | `deletion_request_not_found` | 404  | No deletion request with that
    `event_id` — for you. Never says which. |

    | `conflict`                 | 409    | The nights collide with a Maat
    booking or hold. `conflicts[]` names them.|

    | `rate_limited`             | 429    | Too many requests for this key. See
    `Retry-After`.                     |

    | `internal_error`           | 500    | Our fault. Retry an idempotent
    request; quote `instance` if it persists.|

    | `not_enabled`              | 501    | The contract is published and not
    yet enabled. Nothing was written.    |

    | `service_unavailable`      | 503    | A capability we need is not
    configured. Nothing was written; retry.     |


    `instance` is an occurrence identifier, not a URL. Quote it when you contact
    us.


    We do not tell you which of several refusals you hit — an unknown key, a
    revoked key and a

    wrong secret all answer identically, and so do the three ways a workspace
    scope can fail.

    Distinguishing them would let anyone enumerate our customers.


    # Rate limits


    600 requests an hour per API key across all contract endpoints. Every
    response carries:


    | Header                | Meaning                                     |

    | --------------------- | ------------------------------------------- |

    | `RateLimit-Policy`    | The quota and its window, e.g. `600;w=3600` |

    | `RateLimit-Limit`     | The quota                                   |

    | `RateLimit-Remaining` | What is left in the current window          |

    | `RateLimit-Reset`     | Seconds until the window resets             |


    A `429` adds `Retry-After`, in seconds. The token endpoint has its own,
    separate ceiling.


    # Webhooks


    Booking notifications and deletion requests are delivered to one endpoint
    you register

    with `PUT /webhooks/endpoint`. Deliveries are signed:


    ```

    X-Signature:           hex(HMAC-SHA256(secret, "v1:" + timestamp + ":" +
    raw_body))

    X-Signature-Timestamp: 1788000000

    ```


    Verify against the **raw request body, before parsing it**. Re-serialised
    JSON does not

    round-trip byte-identically and your signature will not match. Reject a
    timestamp more

    than five minutes old.


    Every delivery carries an `event_id` that is stable across our retries, so
    you can be

    idempotent. We never follow redirects, and we only ever deliver over HTTPS
    to a public

    address.
servers:
  - url: https://maatstays.wtf/v1
    description: Staging. The only environment this contract is published against today.
security:
  - partnerAuth: []
tags:
  - name: properties
    description: |
      Push the properties you manage into Maat, keyed by your own `provider_id`.
  - name: blocks
    description: >
      Push the nights that are already taken on your platform. Carries no guest
      data of any

      kind — no name, no booking reference, no amount, no free text.
  - name: booking-notifications
    description: >
      Where Maat delivers a booking on one of your properties, and the payloads
      it sends.
  - name: gdpr
    description: >
      Erasure requests Maat sends you when a guest exercises their right to be
      forgotten, and

      how you confirm you acted on one.
paths:
  /blocks:
    get:
      tags:
        - blocks
      summary: Read your blocks back
      description: >
        Lists the blocks **you** pushed into the workspace your key addresses,
        newest

        window last. It is a reconciliation surface: after a timeout or a `500`
        you can

        see whether a push actually landed, rather than guessing.


        Two things bound the result and neither is a parameter you send: the
        blocks are

        yours, and the workspace is the one your key was issued for. Another
        partner

        syncing the same property sees their own blocks and never yours.


        Nothing about a guest is here, because nothing about a guest was ever
        accepted.


        Paged with `page` and `page_size`; `has_more` tells you whether to ask
        for the

        next one. There is no total — we do not count the whole set to answer a
        page.


        **Live in a sandbox workspace. Returns `501` against a production one**,
        where

        nothing has been blocked and so there is nothing to read back.
      operationId: listCalendarBlocks
      parameters:
        - $ref: '#/components/parameters/BlockWindowFrom'
        - $ref: '#/components/parameters/BlockWindowTo'
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/PageSize'
      responses:
        '200':
          description: One page of your blocks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockListResponse'
              example:
                items:
                  - external_uid: ota-res-55123
                    listing_id: 7c4b1e58-2a90-4f61-b3d2-5e8a1c0f7d24
                    check_in: '2026-09-01'
                    check_out: '2026-09-05'
                    nights: 4
                    reason: reserved
                    created_at: '2026-08-20T10:00:00.000Z'
                    updated_at: '2026-08-20T10:00:00.000Z'
                has_more: false
        '400':
          $ref: '#/components/responses/ValidationFailed'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/WorkspaceScopeMismatch'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '501':
          $ref: '#/components/responses/NotEnabled'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >
            curl
            "https://maatstays.wtf/v1/blocks?from=2026-09-01&to=2026-09-30&page_size=200"
            \
              -H "Authorization: Bearer $MAAT_PARTNER_TOKEN"
        - lang: javascript
          label: Node.js
          source: >
            const headers = { Authorization: `Bearer
            ${process.env.MAAT_PARTNER_TOKEN}` };


            for (let page = 1; ; page += 1) {
                const url = new URL('https://maatstays.wtf/v1/blocks');
                url.searchParams.set('from', '2026-09-01');
                url.searchParams.set('to', '2026-09-30');
                url.searchParams.set('page', String(page));
                url.searchParams.set('page_size', '200');

                const res = await fetch(url, { headers });
                const body = await res.json();
                if (!res.ok) throw new Error(`${body.code}: ${body.detail}`);

                for (const block of body.items) {
                    console.log(block.external_uid, block.check_in, block.check_out);
                }
                if (!body.has_more) break;
            }
        - lang: python
          label: Python
          source: >
            import os


            import requests


            headers = {"Authorization": f"Bearer
            {os.environ['MAAT_PARTNER_TOKEN']}"}


            page = 1

            while True:
                res = requests.get(
                    "https://maatstays.wtf/v1/blocks",
                    headers=headers,
                    params={
                        "from": "2026-09-01",
                        "to": "2026-09-30",
                        "page": page,
                        "page_size": 200,
                    },
                    timeout=30,
                )
                body = res.json()
                if res.status_code >= 400:
                    raise RuntimeError(f"{body['code']}: {body.get('detail')}")

                for block in body["items"]:
                    print(block["external_uid"], block["check_in"], block["check_out"])
                if not body["has_more"]:
                    break
                page += 1
        - lang: go
          label: Go
          source: |
            package main

            import (
                "encoding/json"
                "fmt"
                "log"
                "net/http"
                "net/url"
                "os"
                "strconv"
            )

            type block struct {
                ExternalUID string `json:"external_uid"`
                CheckIn     string `json:"check_in"`
                CheckOut    string `json:"check_out"`
            }

            type page struct {
                Items   []block `json:"items"`
                HasMore bool    `json:"has_more"`
            }

            func main() {
                token := os.Getenv("MAAT_PARTNER_TOKEN")

                for pageNum := 1; ; pageNum++ {
                    query := url.Values{}
                    query.Set("from", "2026-09-01")
                    query.Set("to", "2026-09-30")
                    query.Set("page", strconv.Itoa(pageNum))
                    query.Set("page_size", "200")

                    req, _ := http.NewRequest(http.MethodGet,
                        "https://maatstays.wtf/v1/blocks?"+query.Encode(), nil)
                    req.Header.Set("Authorization", "Bearer "+token)

                    res, err := http.DefaultClient.Do(req)
                    if err != nil {
                        log.Fatal(err)
                    }

                    var body page
                    err = json.NewDecoder(res.Body).Decode(&body)
                    res.Body.Close()
                    if err != nil {
                        log.Fatal(err)
                    }
                    if res.StatusCode >= 400 {
                        log.Fatalf("list failed: %d", res.StatusCode)
                    }

                    for _, b := range body.Items {
                        fmt.Println(b.ExternalUID, b.CheckIn, b.CheckOut)
                    }
                    if !body.HasMore {
                        break
                    }
                }
            }
components:
  parameters:
    BlockWindowFrom:
      name: from
      in: query
      required: false
      description: >
        Only blocks holding a night on or after this date. A block whose
        `check_out` is

        this date holds no night in the window, so it is not returned.
      schema:
        type: string
        format: date
      example: '2026-09-01'
    BlockWindowTo:
      name: to
      in: query
      required: false
      description: Only blocks holding a night on or before this date.
      schema:
        type: string
        format: date
      example: '2026-09-30'
    Page:
      name: page
      in: query
      required: false
      description: 1-based page number. Defaults to the first page.
      schema:
        type: integer
        minimum: 1
        default: 1
      example: 1
    PageSize:
      name: page_size
      in: query
      required: false
      description: Rows per page.
      schema:
        type: integer
        minimum: 1
        maximum: 200
        default: 50
      example: 50
  schemas:
    BlockListResponse:
      type: object
      title: BlockListResponse
      required:
        - items
        - has_more
      additionalProperties: false
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Block'
        has_more:
          type: boolean
          description: >
            Whether another page exists. There is no total: counting the whole
            set to

            answer one page is work neither of us needs.
    Block:
      type: object
      title: Block
      description: >
        One of your blocks, as we hold it.


        What is not here is deliberate: our internal identifier for the block,
        our

        internal identifier for the physical property, and your own workspace
        and account

        identifiers. You address a block by the id you gave it, and a property
        by the

        listing id — there is no second handle for either.
      required:
        - external_uid
        - listing_id
        - check_in
        - check_out
        - nights
        - created_at
        - updated_at
      additionalProperties: false
      properties:
        external_uid:
          type: string
          description: Your own identifier for this block.
        listing_id:
          type: string
          format: uuid
        check_in:
          type: string
          format: date
        check_out:
          type: string
          format: date
          description: Departure day, **exclusive**.
        nights:
          type: integer
          minimum: 1
          description: Nights held, so you do not have to do date arithmetic.
        reason:
          type: string
          enum:
            - reserved
            - maintenance
            - owner_stay
            - other
          description: |
            Absent when you did not send one. We never fill it in for you.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
          description: Equal to `created_at` if the block has never been replaced.
    Problem:
      type: object
      title: Problem
      description: >
        An RFC 7807 problem document. Every error outside the token endpoint is
        one of

        these, served as `application/problem+json`.


        Branch on `code`. `type` is a stable identifier for the same thing,
        `title` and

        `detail` are for people, and `instance` identifies this one occurrence.
      required:
        - type
        - title
        - status
        - code
      properties:
        type:
          type: string
          format: uri
          example: https://developer.maatstays.wtf/errors/not-enabled
        title:
          type: string
          example: Not implemented
        status:
          type: integer
          example: 501
        detail:
          type: string
        instance:
          type: string
          description: |
            An occurrence identifier, not a URL. Quote it when you contact us.
          example: urn:maat:request:3b1f7a90-0d4c-4d4e-9b2a-6c1f0a2e5d33
        code:
          type: string
          enum:
            - validation_failed
            - unauthorized
            - workspace_scope_mismatch
            - property_not_found
            - deletion_request_not_found
            - conflict
            - rate_limited
            - internal_error
            - not_enabled
            - service_unavailable
        conflicts:
          type: array
          description: >
            Present on `conflict`. The complete list of colliding dates — never

            truncated, unlike the sentence in `detail`. Act on this, not on the
            prose.
          items:
            type: string
            format: date
          example:
            - '2026-09-02'
            - '2026-09-03'
        errors:
          type: array
          description: >
            Present on `validation_failed`. Names the rejected fields and the
            rule

            each one broke — never the value you sent.
          items:
            type: object
            required:
              - field
              - code
            additionalProperties: false
            properties:
              field:
                type: string
                example: body.check_out
              code:
                type: string
                example: too_big
  responses:
    ValidationFailed:
      description: The payload does not match this document. Nothing was written.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://developer.maatstays.wtf/errors/validation-failed
            title: Validation failed
            status: 400
            instance: urn:maat:request:3b1f7a90-0d4c-4d4e-9b2a-6c1f0a2e5d33
            code: validation_failed
            errors:
              - field: body.check_out
                code: custom
    Unauthorized:
      description: >
        No usable partner token. One answer covers a missing token, an expired
        one, a

        revoked key and a human credential — telling them apart would report
        which

        credentials exist.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://developer.maatstays.wtf/errors/unauthorized
            title: Unauthorized
            status: 401
            detail: A valid partner token is required.
            instance: urn:maat:request:3b1f7a90-0d4c-4d4e-9b2a-6c1f0a2e5d33
            code: unauthorized
    WorkspaceScopeMismatch:
      description: >
        The token's environment does not match the workspace it addresses — a
        sandbox

        token against a production workspace, or the reverse. One answer covers
        both, and

        also a workspace that does not resolve.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://developer.maatstays.wtf/errors/workspace-scope-mismatch
            title: Workspace scope mismatch
            status: 403
            detail: This token is not valid for the requested workspace.
            instance: urn:maat:request:3b1f7a90-0d4c-4d4e-9b2a-6c1f0a2e5d33
            code: workspace_scope_mismatch
    RateLimited:
      description: >
        Too many requests for this API key. `Retry-After` gives the wait in
        seconds.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
        RateLimit-Limit:
          description: The quota for the current window.
          schema:
            type: integer
        RateLimit-Remaining:
          description: Requests left in the current window.
          schema:
            type: integer
        RateLimit-Reset:
          description: Seconds until the window resets.
          schema:
            type: integer
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://developer.maatstays.wtf/errors/rate-limited
            title: Too many requests
            status: 429
            detail: Too many requests for this API key.
            instance: urn:maat:request:3b1f7a90-0d4c-4d4e-9b2a-6c1f0a2e5d33
            code: rate_limited
    InternalError:
      description: Our fault. Retry an idempotent request.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://developer.maatstays.wtf/errors/internal-error
            title: Internal error
            status: 500
            detail: The request could not be completed.
            instance: urn:maat:request:3b1f7a90-0d4c-4d4e-9b2a-6c1f0a2e5d33
            code: internal_error
    NotEnabled:
      description: >
        **What every contract endpoint returns against a production workspace**,
        and what

        the not-yet-enabled contracts return everywhere. The request was
        authenticated and

        validated in full; nothing was written and nothing will be delivered.


        The calendar-blocks and properties contracts do real work in a sandbox

        workspace — see their operations for what changes. Webhook registration
        and

        deletion acknowledgment return this in both tenancies.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          example:
            type: https://developer.maatstays.wtf/errors/not-enabled
            title: Not implemented
            status: 501
            detail: >-
              The calendar-blocks contract is published but not yet enabled.
              This request was authenticated and validated; no dates were
              blocked. Keep holding these dates on your own platform.
            instance: urn:maat:request:3b1f7a90-0d4c-4d4e-9b2a-6c1f0a2e5d33
            code: not_enabled
  securitySchemes:
    partnerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        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.


        Never send it as a cookie or in a query string, and never store it —
        store the

        API key, mint tokens from it.

````