{
  "info": {
    "title": "Shace Partner API",
    "version": "1.0.0",
    "description": "Publish your vacant premises to Shace from your own property system, and receive the leads they bring in.\n\nThere are two setups, agreed with Shace. **Listings sync**: you push your listings and your team answers leads in Shace. **Full integration**: listings sync, plus leads in your own system through webhooks and the Deals endpoints. `GET /me` shows which one your organization has.\n\n**Listings.** Push each unit by your own reference with `PUT /listings/{id}` whenever it is saved on your side, and take it off the market with `POST /listings/{id}/unpublish`. The same reference updates instead of duplicating, an unchanged push is a no-op, and listings you do not push are never touched. Anywhere a listing's Shace id is accepted, `ext:<your reference>` works too.\n\n**Leads.** With full integration, set up with Shace, you receive `deal.created` when a tenant is interested in one of your listings. Answer with `POST /deals/{id}/accept` or `/decline`, or by mail to the deal's `replyAddress`.\n\n**Basics.** Authenticate every request with `Authorization: Bearer shace_sk_…`, an organization-scoped key your developers create under Developer > API keys in the Shace dashboard. Every error has the shape `{ code, status, message, data? }`, with validation issues under `data.issues`.\n\nThe guides walk through both flows: [Quickstart](https://docs.shace.se), [Publishing from your system](https://docs.shace.se/publishing-from-your-system) and [Receiving leads](https://docs.shace.se/receiving-leads)."
  },
  "externalDocs": {
    "description": "Guides: quickstart, publishing from your system, receiving leads",
    "url": "https://docs.shace.se"
  },
  "security": [
    {
      "apiKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Every request carries an organization-scoped API key as a bearer token: `Authorization: Bearer shace_sk_…`. A key is `shace_sk_` followed by 48 hex characters, and it has full inventory access for its organization and nothing else. There are no scopes yet; if a narrower key is ever needed, say so.\n\n**Getting a key.** Your organization's developers create keys under Developer > API keys in the Shace dashboard (Shace support makes someone a developer). A key is shown once, so store the plaintext in your secret manager right away. Shace keeps only a hash and can never show a key again; if one is lost, create a new one and revoke the old one. Keys issued for a pilot may carry an expiry: `GET /me` shows `expiresAt`, or `null` for none.\n\n**Rotation.** Several keys can be live at once, so rotation is: create a new key, switch your job over, revoke the old one. A revoked or expired key answers `401` from the next request.\n\n**Server to server only.** Keyed routes send CORS headers to this docs site alone, for the Test Request button; every other origin gets none, so a key cannot be used from your own browser pages even by accident. Call the API from your backend or a scheduled job.\n\n**Environments.** Build and test against the sandbox, `api-sandbox.shace.se`: the same code as production, with its own organization, keys and data. Going live means switching the host to `api.shace.se` and the key to a production one; webhook endpoints are registered per environment, each with its own signing secret. Sandbox keys only work on the sandbox and production keys only on production. The docs list both servers, sandbox first; the Test Request button and the code snippets use the one picked in the reference."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Every error, on every route, has this shape. The Errors guide (docs.shace.se/errors) lists each status, what causes it and when to retry.",
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable machine-readable code, for example BAD_REQUEST."
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status, repeated."
          },
          "message": {
            "type": "string",
            "description": "Human-readable; may change."
          },
          "data": {
            "type": "object",
            "description": "Present when there is something structured to say: `issues` on a validation error, `reason` on a conflict.",
            "properties": {
              "issues": {
                "type": "array",
                "description": "What failed validation, one entry per problem.",
                "items": {
                  "type": "object",
                  "required": [
                    "path",
                    "message"
                  ],
                  "properties": {
                    "path": {
                      "type": "array",
                      "description": "Where the problem is: keys and array indexes into the request body, like `[\"images\", 1]` or `[\"metadata\", \"responsibleId\"]`, or the parameter's name, like `[\"id\"]`. Empty for the body as a whole.",
                      "items": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "integer"
                          }
                        ]
                      }
                    },
                    "message": {
                      "type": "string",
                      "description": "Human-readable; may change."
                    }
                  }
                }
              },
              "reason": {
                "type": "string",
                "enum": [
                  "create_race",
                  "no_owner",
                  "not_pending",
                  "tenant_not_ready",
                  "listing_unpublished",
                  "listing_not_yours",
                  "not_accepted",
                  "not_withdrawn",
                  "contract_exists",
                  "invalid_state"
                ],
                "description": "Why a `409` happened, stable and safe to branch on. Only `create_race` is worth retrying (once)."
              }
            }
          }
        },
        "required": [
          "code",
          "status",
          "message"
        ],
        "x-guide": "Every error, on every route, has this one shape. `code` and `status` are stable and safe to branch on. `message` is for humans and may change. `data` is present when there is something structured to say. Validation errors carry `issues` there, each `{ path, message }`: `path` leads into the request body (`[\"images\", 1]`, `[\"metadata\", \"responsibleId\"]`), or is the parameter's name (`[\"id\"]`) for a path or query parameter. Conflicts carry `reason`. Upload and geocoding errors have `message` only.\n\nThe one exception is a request the hosting edge refuses before it reaches Shace, for example a URL with control characters (CR, LF, NUL) or a Unicode line separator (U+2028, U+2029) in it: that answer may not be JSON.\n\n- `400 BAD_REQUEST`: field validation failed, an id is neither a UUID nor `ext:<reference>`, `cursor` is not a well-formed cursor (pass `nextCursor` back exactly as received), an image URL cannot be fetched (including a host name that does not resolve) or is not a supported image, a floor plan URL is not from your uploads, an image upload has more than 8 files, a floor-plan upload has more than one `file`, an uploaded file is over 15 MB or its content is not a supported format, an uploaded floor plan's content is a different format than its type or file name says (a PDF sent as `plan.png`) or is an image that does not decode, an address could not be geocoded, `contact` is missing (issue on `contact`) or cannot be assigned (issue on `contact.email` saying why), both `assignedTo` and `contact` were sent (issue on `assignedTo`), or a deal answer's `from` is not a member (issue on `from`).\n- `401 UNAUTHORIZED`: missing, malformed, revoked or expired key.\n- `403 FORBIDDEN`: the key's organization is not a landlord organization, or it called a Deals endpoint without full integration.\n- `404 NOT_FOUND`: no listing, deal or webhook endpoint with that id (or listing reference) in your organization. Also returned for another organization's ids, so ids leak nothing.\n- `405 METHOD_NOT_SUPPORTED`: the path exists but not with this method. The `Allow` header lists the methods it takes.\n- `409 CONFLICT`: the resource is not in a state that allows this. `data.reason` says which, and only `create_race` is worth retrying:\n  - `create_race`: two requests raced to create the same reference. Retry once.\n  - `no_owner`: the organization has no owner yet to attribute listings to, or (on accepting a deal) to answer for it when the member the lead is routed to has left. Retrying does not help: the owner invite has to be accepted first, or send `from`.\n  - `not_pending`: the deal was already answered, expired or withdrawn. A retried accept or decline whose first attempt timed out but went through gets this too, so after any `409` on accept or decline, `GET /deals/{id}` to see where the deal stands.\n  - `tenant_not_ready`: the deal's tenant has not finished signing up. Try again later.\n  - `listing_unpublished`: accepting a deal (or, in the sandbox, creating one) needs a published listing. Push it again first. Declining works either way.\n  - `listing_not_yours`: the deal's listing no longer belongs to your organization.\n  - Sandbox only: `not_accepted` (the step needs an accepted deal), `not_withdrawn` (only a withdrawn deal can come back), `contract_exists`, and `invalid_state` for any other step the deal is not ready for.\n- `408 REQUEST_TIMEOUT`: an upload's body arrived too slowly. Shace allows 60 seconds plus the body's size at 256 KB per second from when it starts reading (about 9 minutes for a full image batch, 3 minutes for a floor plan). Retry, on a faster connection or with a smaller batch.\n- `413 PAYLOAD_TOO_LARGE`: the whole request body is over the endpoint's cap, checked before any of it is read: 121 MB for image uploads (8 files of 15 MB), 31 MB for a floor-plan upload, 2 MB for any JSON body. A single file over 15 MB in a body under the cap is a `400`. Split the batch.\n- `412 PRECONDITION_FAILED`: sandbox only, the sandbox's test tenant is not set up on this environment. Tell us; retrying does not help.\n- `429 TOO_MANY_REQUESTS`: your organization went over a rate limit reported by `GET /me` (`requestsPerMinute` for every request, `uploadsPerMinute` for upload requests, however many files each carries), the organization already has an image upload (or two floor-plan uploads) in progress, or the organization sent more than 10 webhook test events in 10 minutes. Wait the number of seconds in the `Retry-After` header, then retry. The limits are fixed one-minute windows per organization, shared across its keys, so adding keys does not add capacity; responses to a valid key carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds) for the window closest to its limit.\n- `503 IMAGE_HOST_UNAVAILABLE`: your image host did not answer, timed out, rate-limited Shace or answered a server error while Shace fetched an image URL on a listing. `data.issues` names the index. Retry with backoff. A host name that does not resolve at all is a `400`, and so is a push where any other image URL or file is invalid: retrying cannot succeed, so the `400` lists every failing index, the unavailable ones included.\n- `500 INTERNAL_SERVER_ERROR`: something on our side, including a geocoding outage. Retry with backoff; if it persists, tell us the `X-Request-Id` response header.\n\nThe API itself never answers `502` or `504`. One of those, with an HTML body instead of this shape, comes from the network in front of Shace: treat it like a `500`. The same goes for a `524`: the edge gives up on a very slow request, for example a push with many image URLs on slow hosts. Treat it like a `500`, and send fewer or smaller images per push.\n\n**Publish rules are not errors.** Missing images, a zero price or a missing notice period never produce an error. The listing is stored and the response lists them under `publishBlockers`.\n\n**Retrying.** `PUT` requests are idempotent by design: repeating one is safe and, when nothing changed, a no-op. Retry `429` after `Retry-After`, `408`, `503` and `500` (and an edge `502`, `504` or `524`) with a short backoff, and a `409` whose `data.reason` is `create_race` once. Do not retry `400`; fix the body."
      }
    }
  },
  "openapi": "3.1.1",
  "paths": {
    "/listings": {
      "get": {
        "operationId": "listListings",
        "summary": "List all listings",
        "description": "Newest first, cursor paginated. Use `updatedSince` to verify what Shace holds without re-pushing.",
        "tags": [
          "Listings"
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "description": "nextCursor from the previous page.",
              "type": "string"
            },
            "allowEmptyValue": true,
            "allowReserved": true
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "default": 50,
              "description": "Page size, 1 to 200.",
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "example": 50
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "description": "Only listings in this status.",
              "type": "string",
              "enum": [
                "published",
                "unpublished"
              ]
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "example": "published"
          },
          {
            "name": "updatedSince",
            "in": "query",
            "schema": {
              "description": "ISO 8601 instant. Only listings whose returned updatedAt is after it, compared at millisecond precision.",
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            },
            "allowEmptyValue": true,
            "allowReserved": true,
            "example": "2026-09-01T00:00:00Z"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id."
                          },
                          "externalRef": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Your reference, or null when none was sent."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "published",
                              "unpublished"
                            ],
                            "description": "published (live) or unpublished (not live). publishBlockers says what keeps a listing from going live."
                          },
                          "publishBlockers": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "images",
                                "price",
                                "noticePeriod"
                              ]
                            },
                            "description": "Empty when the listing can go live; otherwise what is missing: images, price, noticePeriod."
                          },
                          "address": {
                            "type": "object",
                            "properties": {
                              "streetAddress": {
                                "type": "string",
                                "description": "Street and number."
                              },
                              "streetAddress2": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Floor, entrance or suite, or null."
                              },
                              "postalCode": {
                                "type": "string",
                                "description": "Postal code."
                              },
                              "city": {
                                "type": "string",
                                "description": "City."
                              },
                              "region": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "County or region, or null."
                              },
                              "countryCode": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2."
                              }
                            },
                            "required": [
                              "streetAddress",
                              "streetAddress2",
                              "postalCode",
                              "city",
                              "region",
                              "countryCode"
                            ],
                            "additionalProperties": false,
                            "description": "The address, as stored."
                          },
                          "location": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "lng": {
                                    "type": "number"
                                  },
                                  "lat": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "lng",
                                  "lat"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Geocoded point for the address, WGS84."
                          },
                          "buildingRef": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Your reference for the building or property the unit belongs to, or null when none was sent."
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "office",
                              "coworking",
                              "part_of_office"
                            ],
                            "description": "office for a whole office, coworking for desks or rooms in a shared workspace, part_of_office for part of a larger office."
                          },
                          "locale": {
                            "type": "string",
                            "enum": [
                              "sv",
                              "en"
                            ],
                            "description": "Locale the description and amenities were submitted in."
                          },
                          "description": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Free text about the premises, in locale."
                          },
                          "areaM2": {
                            "anyOf": [
                              {
                                "type": "number"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Floor area in square metres."
                          },
                          "capacity": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Number of workplaces."
                          },
                          "furnished": {
                            "anyOf": [
                              {
                                "type": "boolean"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Furnished or not."
                          },
                          "price": {
                            "type": "object",
                            "properties": {
                              "amount": {
                                "type": "number",
                                "description": "Rent excluding VAT, per period."
                              },
                              "currency": {
                                "type": "string",
                                "const": "sek",
                                "description": "Only SEK today."
                              },
                              "period": {
                                "type": "string",
                                "enum": [
                                  "month",
                                  "day"
                                ],
                                "description": "month for open-ended leases, day for day rates."
                              }
                            },
                            "required": [
                              "amount",
                              "currency",
                              "period"
                            ],
                            "additionalProperties": false,
                            "description": "Base rent, as sent."
                          },
                          "priceBasis": {
                            "type": "string",
                            "enum": [
                              "total",
                              "per_person"
                            ],
                            "description": "Whether price.amount is for the whole space or per person. Per-person pricing is only allowed for coworking and part_of_office."
                          },
                          "noticePeriod": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Notice period in months, month-priced listings only."
                          },
                          "minimumDuration": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Binding period in months, or null for no minimum."
                          },
                          "amenities": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Amenities as stored in the listing's locale, in display order."
                          },
                          "images": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Public image URLs in display order."
                          },
                          "floorPlanUrl": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Public floor plan URL, or null."
                          },
                          "openHours": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "monday": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "open": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Opening time, HH:MM (00:00 to 23:59)."
                                          },
                                          "close": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Closing time, HH:MM (00:00 to 23:59)."
                                          },
                                          "allDay": {
                                            "description": "Open around the clock.",
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "open",
                                          "close"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "tuesday": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "open": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Opening time, HH:MM (00:00 to 23:59)."
                                          },
                                          "close": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Closing time, HH:MM (00:00 to 23:59)."
                                          },
                                          "allDay": {
                                            "description": "Open around the clock.",
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "open",
                                          "close"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "wednesday": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "open": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Opening time, HH:MM (00:00 to 23:59)."
                                          },
                                          "close": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Closing time, HH:MM (00:00 to 23:59)."
                                          },
                                          "allDay": {
                                            "description": "Open around the clock.",
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "open",
                                          "close"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "thursday": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "open": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Opening time, HH:MM (00:00 to 23:59)."
                                          },
                                          "close": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Closing time, HH:MM (00:00 to 23:59)."
                                          },
                                          "allDay": {
                                            "description": "Open around the clock.",
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "open",
                                          "close"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "friday": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "open": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Opening time, HH:MM (00:00 to 23:59)."
                                          },
                                          "close": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Closing time, HH:MM (00:00 to 23:59)."
                                          },
                                          "allDay": {
                                            "description": "Open around the clock.",
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "open",
                                          "close"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "saturday": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "open": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Opening time, HH:MM (00:00 to 23:59)."
                                          },
                                          "close": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Closing time, HH:MM (00:00 to 23:59)."
                                          },
                                          "allDay": {
                                            "description": "Open around the clock.",
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "open",
                                          "close"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "sunday": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "open": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Opening time, HH:MM (00:00 to 23:59)."
                                          },
                                          "close": {
                                            "type": "string",
                                            "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                            "description": "Closing time, HH:MM (00:00 to 23:59)."
                                          },
                                          "allDay": {
                                            "description": "Open around the clock.",
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "open",
                                          "close"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "monday",
                                  "tuesday",
                                  "wednesday",
                                  "thursday",
                                  "friday",
                                  "saturday",
                                  "sunday"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Opening hours per weekday for coworking listings, or null."
                          },
                          "contact": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "email": {
                                    "type": "string"
                                  },
                                  "firstName": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "lastName": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "email",
                                  "firstName",
                                  "lastName"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The contact from your last push, with missing parts as null. Null only for a listing that has not been pushed with a contact."
                          },
                          "metadata": {
                            "type": "object",
                            "maxProperties": 50,
                            "propertyNames": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            },
                            "additionalProperties": {
                              "type": "string",
                              "maxLength": 500
                            },
                            "description": "Your metadata as sent, or {} when none. Omitted on update keeps it; null or {} clears it. Sending a map replaces the whole map."
                          },
                          "assignedTo": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Email of the Shace user the listing is assigned to: `contact.email`, or null while a contact who was invited to your organization has not joined yet."
                          },
                          "createdVia": {
                            "type": "string",
                            "enum": [
                              "app",
                              "api",
                              "admin"
                            ],
                            "description": "Whether the listing was created in the app, API, or by an admin."
                          },
                          "lastSyncedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Last time a PUT through this API wrote content fields."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "ISO 8601 UTC."
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "Latest change to the listing: your pushes, edits in Shace, and Shace's re-indexing shortly after a content change. ISO 8601 UTC, millisecond precision."
                          }
                        },
                        "required": [
                          "id",
                          "externalRef",
                          "status",
                          "publishBlockers",
                          "address",
                          "location",
                          "buildingRef",
                          "type",
                          "locale",
                          "description",
                          "areaM2",
                          "capacity",
                          "furnished",
                          "price",
                          "priceBasis",
                          "noticePeriod",
                          "minimumDuration",
                          "amenities",
                          "images",
                          "floorPlanUrl",
                          "openHours",
                          "contact",
                          "metadata",
                          "assignedTo",
                          "createdVia",
                          "lastSyncedAt",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      },
                      "description": "The page, newest first."
                    },
                    "nextCursor": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Pass as ?cursor= to fetch the next page; null on the last page."
                    }
                  },
                  "required": [
                    "data",
                    "nextCursor"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "status": "published",
                      "publishBlockers": [],
                      "address": {
                        "streetAddress": "Sveavägen 44",
                        "streetAddress2": null,
                        "postalCode": "111 34",
                        "city": "Stockholm",
                        "region": null,
                        "countryCode": "SE"
                      },
                      "location": {
                        "lng": 18.062649,
                        "lat": 59.3368083
                      },
                      "buildingRef": "bldg-12",
                      "type": "office",
                      "locale": "sv",
                      "description": "Ljust hörnkontor på plan 4 med sex arbetsplatser, eget mötesrum och pentry.",
                      "areaM2": 120,
                      "capacity": 6,
                      "furnished": true,
                      "price": {
                        "amount": 38000,
                        "currency": "sek",
                        "period": "month"
                      },
                      "priceBasis": "total",
                      "noticePeriod": 3,
                      "minimumDuration": 12,
                      "amenities": [
                        "WiFi",
                        "Takterrass",
                        "Laddstolpar i garaget"
                      ],
                      "images": [
                        "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/df8f8bd6-34ae-4b0b-b7b1-f3b01f53c433.webp",
                        "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/86937c08-cc69-4118-8816-9dddc4ab166d.webp",
                        "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/4c695935-0bff-4865-8121-b46dbb44b4e2.webp"
                      ],
                      "floorPlanUrl": null,
                      "openHours": null,
                      "assignedTo": "erik.holm@nordicfastigheter.se",
                      "contact": {
                        "email": "erik.holm@nordicfastigheter.se",
                        "firstName": "Erik",
                        "lastName": "Holm"
                      },
                      "metadata": {
                        "responsibleId": "E-4411"
                      },
                      "createdVia": "api",
                      "lastSyncedAt": "2026-09-02T13:19:00.445Z",
                      "createdAt": "2026-09-02T13:19:00.445Z",
                      "updatedAt": "2026-09-02T13:19:00.445Z"
                    }
                  ],
                  "nextCursor": "eyJjIjoiMjAyNi0wOS0wMlQxMzoxOTowMS4wODFaIiwiaSI6Ijk4NzJhYjE1LWRhM2EtNDc1Ni04ODU2LTllM2UyYmQ1OTZlZCJ9"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidCursor": {
                    "summary": "Not a well-formed cursor; pass nextCursor back as received",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Invalid cursor"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/listings/{id}": {
      "put": {
        "operationId": "upsertListing",
        "summary": "Create or update a listing",
        "description": "The call to make whenever a unit is saved in your system. The path is your own reference for the unit: the first push of a reference creates the listing, every later push of the same reference updates it, and an unchanged body is a no-op. The listing carries its own `address`; a changed address is geocoded again. Publishes on success unless the body says `status: \"unpublished\"`, which holds the listing back, including on its first push. A listing that is valid but not publishable is stored as unpublished and the response lists the `publishBlockers`. A reference whose listing was unpublished is republished.\n\n### Outcomes\n\nThe same request in other situations, as `outcome`, `status` and any `publishBlockers`:\n\n- First push of a new reference: `created`, `published`\n- The same body again: nothing is written, nothing is re-indexed, updatedAt does not move: `unchanged`, `published`\n- A field changed, for example the price: `updated`, `published`\n- The address changed: geocoded again, the listing moves with it: `updated`, `published`\n- Two images instead of three on a listing that was live: stored, taken off the market until a third is pushed: `updated`, `unpublished`, blockers `images`\n- The body says status: \"unpublished\" for a listing that was live: `updated`, `unpublished`\n- The first push of a reference says status: \"unpublished\": stored, never live: `created`, `unpublished`\n- The reference of a listing that was unpublished, pushed again: `updated`, `published`",
        "tags": [
          "Listings"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "description": "Your external reference for the listing, URL-encoded. Send it directly, without adding ext:."
            },
            "example": "unit-4711"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "object",
                    "properties": {
                      "streetAddress": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200,
                        "description": "Street and number, as the landlord writes it."
                      },
                      "streetAddress2": {
                        "description": "Floor, entrance or suite. Optional.",
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 200
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "postalCode": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 20,
                        "description": "Postal code, compared as sent apart from whitespace: `111 34` and `11134` count as different addresses, so send it the same way every time."
                      },
                      "city": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 100,
                        "description": "City."
                      },
                      "region": {
                        "description": "County or region. Optional.",
                        "anyOf": [
                          {
                            "type": "string",
                            "maxLength": 100
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "countryCode": {
                        "description": "ISO 3166-1 alpha-2, stored uppercased. Only SE is enabled today.",
                        "default": "SE",
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 2
                      }
                    },
                    "required": [
                      "streetAddress",
                      "postalCode",
                      "city"
                    ],
                    "description": "Where the premises are. Text fields are trimmed and runs of whitespace collapsed to one space; case is kept as sent. Geocoded the first time an address is seen for your organization; an address that only changes case or whitespace is stored as sent but not geocoded again."
                  },
                  "buildingRef": {
                    "description": "Your own reference for the building or property the unit belongs to, for systems that model property and unit separately. Optional; stored and read back as sent, and cleared when an update omits it. Shace matches on the address, not on this reference.",
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "office",
                      "coworking",
                      "part_of_office"
                    ],
                    "description": "Shace lists offices only: office for a whole office, coworking for desks or rooms in a shared workspace, part_of_office for part of a larger office."
                  },
                  "locale": {
                    "default": "sv",
                    "description": "Language of description and amenities. Shown as sent, not translated.",
                    "type": "string",
                    "enum": [
                      "sv",
                      "en"
                    ]
                  },
                  "description": {
                    "description": "Free text about the premises, in locale. Trimmed; an empty string is stored as null.",
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 10000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "areaM2": {
                    "description": "Floor area in square metres, with at most two decimal places.",
                    "anyOf": [
                      {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 1000000,
                        "multipleOf": 0.01
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "capacity": {
                    "description": "Number of workplaces.",
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 100000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "furnished": {
                    "description": "Furnished or not.",
                    "anyOf": [
                      {
                        "type": "boolean"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "price": {
                    "type": "object",
                    "properties": {
                      "amount": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": 9999999999.99,
                        "multipleOf": 0.01,
                        "description": "Rent excluding VAT, per period, with at most two decimal places. 0 is accepted but blocks publishing (publishBlockers: price)."
                      },
                      "currency": {
                        "default": "sek",
                        "description": "Only SEK today.",
                        "type": "string",
                        "const": "sek"
                      },
                      "period": {
                        "default": "month",
                        "description": "month for open-ended leases (tillsvidare), day for day rates.",
                        "type": "string",
                        "enum": [
                          "month",
                          "day"
                        ]
                      }
                    },
                    "required": [
                      "amount"
                    ],
                    "description": "Base rent. Transparent pricing is part of Shace, so there is no price on request."
                  },
                  "priceBasis": {
                    "description": "total prices the whole space; per_person prices each person and is only allowed for coworking and part_of_office. Omitted on create defaults to total. Omitted on update keeps the current basis, except changing type to office resets it to total.",
                    "type": "string",
                    "enum": [
                      "total",
                      "per_person"
                    ]
                  },
                  "noticePeriod": {
                    "description": "Notice period in months. Required to publish month-priced listings; must be omitted for day pricing.",
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 120
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "minimumDuration": {
                    "description": "Binding period in months, month-priced listings only. Omit for no minimum.",
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 600
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "amenities": {
                    "maxItems": 30,
                    "description": "Amenities as free text in the listing's `locale`, for example \"Takterrass\" or \"Laddstolpar i garaget\". Up to 30, 40 characters each, shown as written. Order is display order; reordering counts as a change.",
                    "default": [],
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    }
                  },
                  "images": {
                    "default": [],
                    "description": "Image URLs in display order; the first is the cover. Either https URLs your own system serves on the default port (Shace fetches each once and hosts a copy) or URLs returned by POST /uploads/images for your organization. Photos are recognized by URL, so links that change on every export (a time-limited token) should be uploaded once instead. At least 3 to publish, at most 20, no URL twice. Reordering counts as a change.",
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "blurPlaceholders": {
                    "description": "Blur placeholders keyed by upload URL, as returned by the upload endpoint. Every key must be one of this request's `images`. Optional. Only read for upload URLs: images fetched from your own URLs get theirs generated, and an entry keyed by one of your own URLs is ignored.",
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "format": "uri"
                    },
                    "additionalProperties": {
                      "type": "string",
                      "maxLength": 2000
                    }
                  },
                  "floorPlanUrl": {
                    "description": "URL returned by POST /uploads/floor-plan. Optional; does not count towards the three-image minimum.",
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uri"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "openHours": {
                    "description": "Opening hours per weekday for coworking listings. All seven days (monday to sunday) are required and no other keys are accepted, on the week or on a day. Each day is { open, close } as HH:MM, { open, close, allDay: true } for around the clock, or null for closed. close must be later than open on the same day: hours past midnight (22:00 to 06:00) are not supported, so use allDay for a day that is open 24 hours.",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "monday": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "open": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Opening time, HH:MM (00:00 to 23:59)."
                                  },
                                  "close": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Closing time, HH:MM (00:00 to 23:59)."
                                  },
                                  "allDay": {
                                    "description": "Open around the clock.",
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "open",
                                  "close"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "tuesday": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "open": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Opening time, HH:MM (00:00 to 23:59)."
                                  },
                                  "close": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Closing time, HH:MM (00:00 to 23:59)."
                                  },
                                  "allDay": {
                                    "description": "Open around the clock.",
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "open",
                                  "close"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "wednesday": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "open": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Opening time, HH:MM (00:00 to 23:59)."
                                  },
                                  "close": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Closing time, HH:MM (00:00 to 23:59)."
                                  },
                                  "allDay": {
                                    "description": "Open around the clock.",
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "open",
                                  "close"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "thursday": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "open": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Opening time, HH:MM (00:00 to 23:59)."
                                  },
                                  "close": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Closing time, HH:MM (00:00 to 23:59)."
                                  },
                                  "allDay": {
                                    "description": "Open around the clock.",
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "open",
                                  "close"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "friday": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "open": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Opening time, HH:MM (00:00 to 23:59)."
                                  },
                                  "close": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Closing time, HH:MM (00:00 to 23:59)."
                                  },
                                  "allDay": {
                                    "description": "Open around the clock.",
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "open",
                                  "close"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "saturday": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "open": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Opening time, HH:MM (00:00 to 23:59)."
                                  },
                                  "close": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Closing time, HH:MM (00:00 to 23:59)."
                                  },
                                  "allDay": {
                                    "description": "Open around the clock.",
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "open",
                                  "close"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sunday": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "open": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Opening time, HH:MM (00:00 to 23:59)."
                                  },
                                  "close": {
                                    "type": "string",
                                    "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                    "description": "Closing time, HH:MM (00:00 to 23:59)."
                                  },
                                  "allDay": {
                                    "description": "Open around the clock.",
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "open",
                                  "close"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "monday",
                          "tuesday",
                          "wednesday",
                          "thursday",
                          "friday",
                          "saturday",
                          "sunday"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "default": "published",
                    "description": "published (default) goes live when there are no publish blockers; unpublished holds the listing back, including on its first push, so it is never live for a moment.",
                    "type": "string",
                    "enum": [
                      "published",
                      "unpublished"
                    ]
                  },
                  "contact": {
                    "description": "Required unless the deprecated assignedTo is sent. The person responsible for the unit; Shace assigns the listing to them. A member of your organization is assigned directly. Anyone else must be on one of your organization's email domains: with listings sync (leads in Shace) they are invited and get the listing when they accept; with full integration (leads in your own system) they get a Shace account without a password. Anything Shace cannot accept is a BAD_REQUEST whose message says why.",
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "email": {
                            "format": "email",
                            "maxLength": 254,
                            "type": "string"
                          },
                          "firstName": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 100
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lastName": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 100
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "email"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "metadata": {
                    "description": "Your own data, for example the responsible person's id in your system. Shace never reads it and returns it on every read. Up to 50 keys of 1-40 characters, string values up to 500 characters. Omitted on an update, the current map is kept; a sent map replaces it; null or {} clears it.",
                    "anyOf": [
                      {
                        "type": "object",
                        "maxProperties": 50,
                        "propertyNames": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "additionalProperties": {
                          "type": "string",
                          "maxLength": 500
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "assignedTo": {
                    "deprecated": true,
                    "description": "Deprecated. Same as `contact: { email }`; send one or the other, not both.",
                    "format": "email",
                    "maxLength": 254,
                    "type": "string"
                  }
                },
                "required": [
                  "address",
                  "type",
                  "price"
                ]
              },
              "example": {
                "contact": {
                  "email": "erik.holm@nordicfastigheter.se",
                  "firstName": "Erik",
                  "lastName": "Holm"
                },
                "metadata": {
                  "responsibleId": "E-4411"
                },
                "address": {
                  "streetAddress": "Sveavägen 44",
                  "postalCode": "111 34",
                  "city": "Stockholm"
                },
                "buildingRef": "bldg-12",
                "type": "office",
                "locale": "sv",
                "description": "Ljust hörnkontor på plan 4 med sex arbetsplatser, eget mötesrum och pentry.",
                "areaM2": 120,
                "capacity": 6,
                "furnished": true,
                "price": {
                  "amount": 38000,
                  "currency": "sek",
                  "period": "month"
                },
                "priceBasis": "total",
                "noticePeriod": 3,
                "minimumDuration": 12,
                "amenities": [
                  "WiFi",
                  "Takterrass",
                  "Laddstolpar i garaget"
                ],
                "images": [
                  "https://media.nordicfastigheter.se/units/4711/entrance.jpg",
                  "https://media.nordicfastigheter.se/units/4711/open-plan.jpg",
                  "https://media.nordicfastigheter.se/units/4711/meeting-room.jpg"
                ],
                "status": "published"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id."
                    },
                    "externalRef": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference, or null when none was sent."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "published",
                        "unpublished"
                      ],
                      "description": "published (live) or unpublished (not live). publishBlockers says what keeps a listing from going live."
                    },
                    "publishBlockers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "images",
                          "price",
                          "noticePeriod"
                        ]
                      },
                      "description": "Empty when the listing can go live; otherwise what is missing: images, price, noticePeriod."
                    },
                    "address": {
                      "type": "object",
                      "properties": {
                        "streetAddress": {
                          "type": "string",
                          "description": "Street and number."
                        },
                        "streetAddress2": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Floor, entrance or suite, or null."
                        },
                        "postalCode": {
                          "type": "string",
                          "description": "Postal code."
                        },
                        "city": {
                          "type": "string",
                          "description": "City."
                        },
                        "region": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "County or region, or null."
                        },
                        "countryCode": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2."
                        }
                      },
                      "required": [
                        "streetAddress",
                        "streetAddress2",
                        "postalCode",
                        "city",
                        "region",
                        "countryCode"
                      ],
                      "additionalProperties": false,
                      "description": "The address, as stored."
                    },
                    "location": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "lng": {
                              "type": "number"
                            },
                            "lat": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "lng",
                            "lat"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Geocoded point for the address, WGS84."
                    },
                    "buildingRef": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference for the building or property the unit belongs to, or null when none was sent."
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "office",
                        "coworking",
                        "part_of_office"
                      ],
                      "description": "office for a whole office, coworking for desks or rooms in a shared workspace, part_of_office for part of a larger office."
                    },
                    "locale": {
                      "type": "string",
                      "enum": [
                        "sv",
                        "en"
                      ],
                      "description": "Locale the description and amenities were submitted in."
                    },
                    "description": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Free text about the premises, in locale."
                    },
                    "areaM2": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Floor area in square metres."
                    },
                    "capacity": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Number of workplaces."
                    },
                    "furnished": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Furnished or not."
                    },
                    "price": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "number",
                          "description": "Rent excluding VAT, per period."
                        },
                        "currency": {
                          "type": "string",
                          "const": "sek",
                          "description": "Only SEK today."
                        },
                        "period": {
                          "type": "string",
                          "enum": [
                            "month",
                            "day"
                          ],
                          "description": "month for open-ended leases, day for day rates."
                        }
                      },
                      "required": [
                        "amount",
                        "currency",
                        "period"
                      ],
                      "additionalProperties": false,
                      "description": "Base rent, as sent."
                    },
                    "priceBasis": {
                      "type": "string",
                      "enum": [
                        "total",
                        "per_person"
                      ],
                      "description": "Whether price.amount is for the whole space or per person. Per-person pricing is only allowed for coworking and part_of_office."
                    },
                    "noticePeriod": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Notice period in months, month-priced listings only."
                    },
                    "minimumDuration": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Binding period in months, or null for no minimum."
                    },
                    "amenities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Amenities as stored in the listing's locale, in display order."
                    },
                    "images": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Public image URLs in display order."
                    },
                    "floorPlanUrl": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Public floor plan URL, or null."
                    },
                    "openHours": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "monday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "tuesday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "wednesday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "thursday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "friday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "saturday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "sunday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "monday",
                            "tuesday",
                            "wednesday",
                            "thursday",
                            "friday",
                            "saturday",
                            "sunday"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Opening hours per weekday for coworking listings, or null."
                    },
                    "contact": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "firstName": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lastName": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "email",
                            "firstName",
                            "lastName"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The contact from your last push, with missing parts as null. Null only for a listing that has not been pushed with a contact."
                    },
                    "metadata": {
                      "type": "object",
                      "maxProperties": 50,
                      "propertyNames": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "additionalProperties": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "description": "Your metadata as sent, or {} when none. Omitted on update keeps it; null or {} clears it. Sending a map replaces the whole map."
                    },
                    "assignedTo": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Email of the Shace user the listing is assigned to: `contact.email`, or null while a contact who was invited to your organization has not joined yet."
                    },
                    "createdVia": {
                      "type": "string",
                      "enum": [
                        "app",
                        "api",
                        "admin"
                      ],
                      "description": "Whether the listing was created in the app, API, or by an admin."
                    },
                    "lastSyncedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Last time a PUT through this API wrote content fields."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "ISO 8601 UTC."
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "Latest change to the listing: your pushes, edits in Shace, and Shace's re-indexing shortly after a content change. ISO 8601 UTC, millisecond precision."
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "created",
                        "updated",
                        "unchanged"
                      ],
                      "description": "What the request did. unchanged means the body matched what Shace already holds."
                    }
                  },
                  "required": [
                    "id",
                    "externalRef",
                    "status",
                    "publishBlockers",
                    "address",
                    "location",
                    "buildingRef",
                    "type",
                    "locale",
                    "description",
                    "areaM2",
                    "capacity",
                    "furnished",
                    "price",
                    "priceBasis",
                    "noticePeriod",
                    "minimumDuration",
                    "amenities",
                    "images",
                    "floorPlanUrl",
                    "openHours",
                    "contact",
                    "metadata",
                    "assignedTo",
                    "createdVia",
                    "lastSyncedAt",
                    "createdAt",
                    "updatedAt",
                    "outcome"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                  "externalRef": "unit-4711",
                  "status": "published",
                  "publishBlockers": [],
                  "address": {
                    "streetAddress": "Sveavägen 44",
                    "streetAddress2": null,
                    "postalCode": "111 34",
                    "city": "Stockholm",
                    "region": null,
                    "countryCode": "SE"
                  },
                  "location": {
                    "lng": 18.062649,
                    "lat": 59.3368083
                  },
                  "buildingRef": "bldg-12",
                  "type": "office",
                  "locale": "sv",
                  "description": "Ljust hörnkontor på plan 4 med sex arbetsplatser, eget mötesrum och pentry.",
                  "areaM2": 120,
                  "capacity": 6,
                  "furnished": true,
                  "price": {
                    "amount": 38000,
                    "currency": "sek",
                    "period": "month"
                  },
                  "priceBasis": "total",
                  "noticePeriod": 3,
                  "minimumDuration": 12,
                  "amenities": [
                    "WiFi",
                    "Takterrass",
                    "Laddstolpar i garaget"
                  ],
                  "images": [
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/df8f8bd6-34ae-4b0b-b7b1-f3b01f53c433.webp",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/86937c08-cc69-4118-8816-9dddc4ab166d.webp",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/4c695935-0bff-4865-8121-b46dbb44b4e2.webp"
                  ],
                  "floorPlanUrl": null,
                  "openHours": null,
                  "assignedTo": "erik.holm@nordicfastigheter.se",
                  "contact": {
                    "email": "erik.holm@nordicfastigheter.se",
                    "firstName": "Erik",
                    "lastName": "Holm"
                  },
                  "metadata": {
                    "responsibleId": "E-4411"
                  },
                  "createdVia": "api",
                  "lastSyncedAt": "2026-09-02T13:19:00.445Z",
                  "createdAt": "2026-09-02T13:19:00.445Z",
                  "updatedAt": "2026-09-02T13:19:00.445Z",
                  "outcome": "created"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "validation": {
                    "summary": "Field validation failed",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "noticePeriod"
                            ],
                            "message": "Notice period only applies to month-priced listings"
                          }
                        ]
                      }
                    }
                  },
                  "invalidReference": {
                    "summary": "The reference in the path is not a valid reference",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Send your reference without the ext: prefix; ext: is only for GET and unpublish"
                          }
                        ]
                      }
                    }
                  },
                  "geocoding": {
                    "summary": "The address could not be resolved to coordinates",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Geocoding failed: could not resolve address to coordinates"
                    }
                  },
                  "imageUrl": {
                    "summary": "An image URL cannot be fetched as sent (a 404, a host name that does not resolve), or the file is not a supported image",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Invalid media URLs",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "images",
                              1
                            ],
                            "message": "Could not fetch image: server answered HTTP 404"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "createRace": {
                    "summary": "Two requests raced to create the same reference; retry once",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "A listing with externalRef \"unit-4711\" was just created. Retry the request.",
                      "data": {
                        "reason": "create_race"
                      }
                    }
                  },
                  "noOwner": {
                    "summary": "The organization has no owner yet; retrying does not help",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "The organization has no owner to attribute listings to. Accept the owner invite first.",
                      "data": {
                        "reason": "no_owner"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable. Your image host did not answer; retry with backoff.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "imageHost": {
                    "summary": "Your image host did not answer; retry later",
                    "value": {
                      "code": "IMAGE_HOST_UNAVAILABLE",
                      "status": 503,
                      "message": "Could not fetch one or more image URLs. Retry later.",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "images",
                              0
                            ],
                            "message": "Could not fetch image: no response within 20 seconds"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "getListing",
        "summary": "Retrieve a listing",
        "description": "`id` is a Shace UUID or `ext:<externalRef>`. A UUID that is not one of your listings is looked up as an externalRef, so a system whose references are GUIDs can read back at the URL it pushed to; any other reference needs the `ext:` prefix.",
        "tags": [
          "Listings"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Listing id, or `ext:<your reference>`."
            },
            "example": "ext:unit-4711"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id."
                    },
                    "externalRef": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference, or null when none was sent."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "published",
                        "unpublished"
                      ],
                      "description": "published (live) or unpublished (not live). publishBlockers says what keeps a listing from going live."
                    },
                    "publishBlockers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "images",
                          "price",
                          "noticePeriod"
                        ]
                      },
                      "description": "Empty when the listing can go live; otherwise what is missing: images, price, noticePeriod."
                    },
                    "address": {
                      "type": "object",
                      "properties": {
                        "streetAddress": {
                          "type": "string",
                          "description": "Street and number."
                        },
                        "streetAddress2": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Floor, entrance or suite, or null."
                        },
                        "postalCode": {
                          "type": "string",
                          "description": "Postal code."
                        },
                        "city": {
                          "type": "string",
                          "description": "City."
                        },
                        "region": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "County or region, or null."
                        },
                        "countryCode": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2."
                        }
                      },
                      "required": [
                        "streetAddress",
                        "streetAddress2",
                        "postalCode",
                        "city",
                        "region",
                        "countryCode"
                      ],
                      "additionalProperties": false,
                      "description": "The address, as stored."
                    },
                    "location": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "lng": {
                              "type": "number"
                            },
                            "lat": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "lng",
                            "lat"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Geocoded point for the address, WGS84."
                    },
                    "buildingRef": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference for the building or property the unit belongs to, or null when none was sent."
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "office",
                        "coworking",
                        "part_of_office"
                      ],
                      "description": "office for a whole office, coworking for desks or rooms in a shared workspace, part_of_office for part of a larger office."
                    },
                    "locale": {
                      "type": "string",
                      "enum": [
                        "sv",
                        "en"
                      ],
                      "description": "Locale the description and amenities were submitted in."
                    },
                    "description": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Free text about the premises, in locale."
                    },
                    "areaM2": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Floor area in square metres."
                    },
                    "capacity": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Number of workplaces."
                    },
                    "furnished": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Furnished or not."
                    },
                    "price": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "number",
                          "description": "Rent excluding VAT, per period."
                        },
                        "currency": {
                          "type": "string",
                          "const": "sek",
                          "description": "Only SEK today."
                        },
                        "period": {
                          "type": "string",
                          "enum": [
                            "month",
                            "day"
                          ],
                          "description": "month for open-ended leases, day for day rates."
                        }
                      },
                      "required": [
                        "amount",
                        "currency",
                        "period"
                      ],
                      "additionalProperties": false,
                      "description": "Base rent, as sent."
                    },
                    "priceBasis": {
                      "type": "string",
                      "enum": [
                        "total",
                        "per_person"
                      ],
                      "description": "Whether price.amount is for the whole space or per person. Per-person pricing is only allowed for coworking and part_of_office."
                    },
                    "noticePeriod": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Notice period in months, month-priced listings only."
                    },
                    "minimumDuration": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Binding period in months, or null for no minimum."
                    },
                    "amenities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Amenities as stored in the listing's locale, in display order."
                    },
                    "images": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Public image URLs in display order."
                    },
                    "floorPlanUrl": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Public floor plan URL, or null."
                    },
                    "openHours": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "monday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "tuesday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "wednesday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "thursday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "friday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "saturday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "sunday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "monday",
                            "tuesday",
                            "wednesday",
                            "thursday",
                            "friday",
                            "saturday",
                            "sunday"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Opening hours per weekday for coworking listings, or null."
                    },
                    "contact": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "firstName": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lastName": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "email",
                            "firstName",
                            "lastName"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The contact from your last push, with missing parts as null. Null only for a listing that has not been pushed with a contact."
                    },
                    "metadata": {
                      "type": "object",
                      "maxProperties": 50,
                      "propertyNames": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "additionalProperties": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "description": "Your metadata as sent, or {} when none. Omitted on update keeps it; null or {} clears it. Sending a map replaces the whole map."
                    },
                    "assignedTo": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Email of the Shace user the listing is assigned to: `contact.email`, or null while a contact who was invited to your organization has not joined yet."
                    },
                    "createdVia": {
                      "type": "string",
                      "enum": [
                        "app",
                        "api",
                        "admin"
                      ],
                      "description": "Whether the listing was created in the app, API, or by an admin."
                    },
                    "lastSyncedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Last time a PUT through this API wrote content fields."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "ISO 8601 UTC."
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "Latest change to the listing: your pushes, edits in Shace, and Shace's re-indexing shortly after a content change. ISO 8601 UTC, millisecond precision."
                    }
                  },
                  "required": [
                    "id",
                    "externalRef",
                    "status",
                    "publishBlockers",
                    "address",
                    "location",
                    "buildingRef",
                    "type",
                    "locale",
                    "description",
                    "areaM2",
                    "capacity",
                    "furnished",
                    "price",
                    "priceBasis",
                    "noticePeriod",
                    "minimumDuration",
                    "amenities",
                    "images",
                    "floorPlanUrl",
                    "openHours",
                    "contact",
                    "metadata",
                    "assignedTo",
                    "createdVia",
                    "lastSyncedAt",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                  "externalRef": "unit-4711",
                  "status": "published",
                  "publishBlockers": [],
                  "address": {
                    "streetAddress": "Sveavägen 44",
                    "streetAddress2": null,
                    "postalCode": "111 34",
                    "city": "Stockholm",
                    "region": null,
                    "countryCode": "SE"
                  },
                  "location": {
                    "lng": 18.062649,
                    "lat": 59.3368083
                  },
                  "buildingRef": "bldg-12",
                  "type": "office",
                  "locale": "sv",
                  "description": "Ljust hörnkontor på plan 4 med sex arbetsplatser, eget mötesrum och pentry.",
                  "areaM2": 120,
                  "capacity": 6,
                  "furnished": true,
                  "price": {
                    "amount": 38000,
                    "currency": "sek",
                    "period": "month"
                  },
                  "priceBasis": "total",
                  "noticePeriod": 3,
                  "minimumDuration": 12,
                  "amenities": [
                    "WiFi",
                    "Takterrass",
                    "Laddstolpar i garaget"
                  ],
                  "images": [
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/df8f8bd6-34ae-4b0b-b7b1-f3b01f53c433.webp",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/86937c08-cc69-4118-8816-9dddc4ab166d.webp",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/4c695935-0bff-4865-8121-b46dbb44b4e2.webp"
                  ],
                  "floorPlanUrl": null,
                  "openHours": null,
                  "assignedTo": "erik.holm@nordicfastigheter.se",
                  "contact": {
                    "email": "erik.holm@nordicfastigheter.se",
                    "firstName": "Erik",
                    "lastName": "Holm"
                  },
                  "metadata": {
                    "responsibleId": "E-4411"
                  },
                  "createdVia": "api",
                  "lastSyncedAt": "2026-09-02T13:19:00.445Z",
                  "createdAt": "2026-09-02T13:19:00.445Z",
                  "updatedAt": "2026-09-02T13:19:00.445Z"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id is neither a Shace UUID nor ext:<your reference>",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Must be a Shace UUID or ext:<externalRef>"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No listing with that id or reference in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No listing with externalRef \"unit-4711\""
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/listings/{id}/unpublish": {
      "post": {
        "operationId": "unpublishListing",
        "summary": "Unpublish a listing",
        "description": "For the unpublish action in your system. `id` is a Shace UUID or `ext:<externalRef>`. The listing is hidden from matchmaking and keeps its content and reference; nothing is deleted, and the next `PUT` of the same reference puts it back on the market. Idempotent: a listing that is already off the market answers `outcome: \"unchanged\"`.",
        "tags": [
          "Listings"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Listing id, or `ext:<your reference>`."
            },
            "example": "ext:unit-4711"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id."
                    },
                    "externalRef": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference, or null when none was sent."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "published",
                        "unpublished"
                      ],
                      "description": "published (live) or unpublished (not live). publishBlockers says what keeps a listing from going live."
                    },
                    "publishBlockers": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "images",
                          "price",
                          "noticePeriod"
                        ]
                      },
                      "description": "Empty when the listing can go live; otherwise what is missing: images, price, noticePeriod."
                    },
                    "address": {
                      "type": "object",
                      "properties": {
                        "streetAddress": {
                          "type": "string",
                          "description": "Street and number."
                        },
                        "streetAddress2": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Floor, entrance or suite, or null."
                        },
                        "postalCode": {
                          "type": "string",
                          "description": "Postal code."
                        },
                        "city": {
                          "type": "string",
                          "description": "City."
                        },
                        "region": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "County or region, or null."
                        },
                        "countryCode": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2."
                        }
                      },
                      "required": [
                        "streetAddress",
                        "streetAddress2",
                        "postalCode",
                        "city",
                        "region",
                        "countryCode"
                      ],
                      "additionalProperties": false,
                      "description": "The address, as stored."
                    },
                    "location": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "lng": {
                              "type": "number"
                            },
                            "lat": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "lng",
                            "lat"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Geocoded point for the address, WGS84."
                    },
                    "buildingRef": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Your reference for the building or property the unit belongs to, or null when none was sent."
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "office",
                        "coworking",
                        "part_of_office"
                      ],
                      "description": "office for a whole office, coworking for desks or rooms in a shared workspace, part_of_office for part of a larger office."
                    },
                    "locale": {
                      "type": "string",
                      "enum": [
                        "sv",
                        "en"
                      ],
                      "description": "Locale the description and amenities were submitted in."
                    },
                    "description": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Free text about the premises, in locale."
                    },
                    "areaM2": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Floor area in square metres."
                    },
                    "capacity": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Number of workplaces."
                    },
                    "furnished": {
                      "anyOf": [
                        {
                          "type": "boolean"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Furnished or not."
                    },
                    "price": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "number",
                          "description": "Rent excluding VAT, per period."
                        },
                        "currency": {
                          "type": "string",
                          "const": "sek",
                          "description": "Only SEK today."
                        },
                        "period": {
                          "type": "string",
                          "enum": [
                            "month",
                            "day"
                          ],
                          "description": "month for open-ended leases, day for day rates."
                        }
                      },
                      "required": [
                        "amount",
                        "currency",
                        "period"
                      ],
                      "additionalProperties": false,
                      "description": "Base rent, as sent."
                    },
                    "priceBasis": {
                      "type": "string",
                      "enum": [
                        "total",
                        "per_person"
                      ],
                      "description": "Whether price.amount is for the whole space or per person. Per-person pricing is only allowed for coworking and part_of_office."
                    },
                    "noticePeriod": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Notice period in months, month-priced listings only."
                    },
                    "minimumDuration": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Binding period in months, or null for no minimum."
                    },
                    "amenities": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Amenities as stored in the listing's locale, in display order."
                    },
                    "images": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Public image URLs in display order."
                    },
                    "floorPlanUrl": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Public floor plan URL, or null."
                    },
                    "openHours": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "monday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "tuesday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "wednesday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "thursday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "friday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "saturday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "sunday": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "open": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Opening time, HH:MM (00:00 to 23:59)."
                                    },
                                    "close": {
                                      "type": "string",
                                      "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
                                      "description": "Closing time, HH:MM (00:00 to 23:59)."
                                    },
                                    "allDay": {
                                      "description": "Open around the clock.",
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "open",
                                    "close"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "monday",
                            "tuesday",
                            "wednesday",
                            "thursday",
                            "friday",
                            "saturday",
                            "sunday"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Opening hours per weekday for coworking listings, or null."
                    },
                    "contact": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "email": {
                              "type": "string"
                            },
                            "firstName": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "lastName": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "email",
                            "firstName",
                            "lastName"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The contact from your last push, with missing parts as null. Null only for a listing that has not been pushed with a contact."
                    },
                    "metadata": {
                      "type": "object",
                      "maxProperties": 50,
                      "propertyNames": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "additionalProperties": {
                        "type": "string",
                        "maxLength": 500
                      },
                      "description": "Your metadata as sent, or {} when none. Omitted on update keeps it; null or {} clears it. Sending a map replaces the whole map."
                    },
                    "assignedTo": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Email of the Shace user the listing is assigned to: `contact.email`, or null while a contact who was invited to your organization has not joined yet."
                    },
                    "createdVia": {
                      "type": "string",
                      "enum": [
                        "app",
                        "api",
                        "admin"
                      ],
                      "description": "Whether the listing was created in the app, API, or by an admin."
                    },
                    "lastSyncedAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "Last time a PUT through this API wrote content fields."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "ISO 8601 UTC."
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "Latest change to the listing: your pushes, edits in Shace, and Shace's re-indexing shortly after a content change. ISO 8601 UTC, millisecond precision."
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "created",
                        "updated",
                        "unchanged"
                      ],
                      "description": "What the request did. unchanged means the body matched what Shace already holds."
                    }
                  },
                  "required": [
                    "id",
                    "externalRef",
                    "status",
                    "publishBlockers",
                    "address",
                    "location",
                    "buildingRef",
                    "type",
                    "locale",
                    "description",
                    "areaM2",
                    "capacity",
                    "furnished",
                    "price",
                    "priceBasis",
                    "noticePeriod",
                    "minimumDuration",
                    "amenities",
                    "images",
                    "floorPlanUrl",
                    "openHours",
                    "contact",
                    "metadata",
                    "assignedTo",
                    "createdVia",
                    "lastSyncedAt",
                    "createdAt",
                    "updatedAt",
                    "outcome"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                  "externalRef": "unit-4711",
                  "status": "unpublished",
                  "publishBlockers": [],
                  "address": {
                    "streetAddress": "Sveavägen 44",
                    "streetAddress2": null,
                    "postalCode": "111 34",
                    "city": "Stockholm",
                    "region": null,
                    "countryCode": "SE"
                  },
                  "location": {
                    "lng": 18.062649,
                    "lat": 59.3368083
                  },
                  "buildingRef": "bldg-12",
                  "type": "office",
                  "locale": "sv",
                  "description": "Ljust hörnkontor på plan 4 med sex arbetsplatser, eget mötesrum och pentry.",
                  "areaM2": 120,
                  "capacity": 6,
                  "furnished": true,
                  "price": {
                    "amount": 38000,
                    "currency": "sek",
                    "period": "month"
                  },
                  "priceBasis": "total",
                  "noticePeriod": 3,
                  "minimumDuration": 12,
                  "amenities": [
                    "WiFi",
                    "Takterrass",
                    "Laddstolpar i garaget"
                  ],
                  "images": [
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/df8f8bd6-34ae-4b0b-b7b1-f3b01f53c433.webp",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/86937c08-cc69-4118-8816-9dddc4ab166d.webp",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/4c695935-0bff-4865-8121-b46dbb44b4e2.webp"
                  ],
                  "floorPlanUrl": null,
                  "openHours": null,
                  "assignedTo": "erik.holm@nordicfastigheter.se",
                  "contact": {
                    "email": "erik.holm@nordicfastigheter.se",
                    "firstName": "Erik",
                    "lastName": "Holm"
                  },
                  "metadata": {
                    "responsibleId": "E-4411"
                  },
                  "createdVia": "api",
                  "lastSyncedAt": "2026-09-02T13:19:00.445Z",
                  "createdAt": "2026-09-02T13:19:00.445Z",
                  "updatedAt": "2026-09-18T08:02:11.310Z",
                  "outcome": "updated"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id is neither a Shace UUID nor ext:<your reference>",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Must be a Shace UUID or ext:<externalRef>"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No listing with that id or reference in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No listing with externalRef \"unit-4711\""
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/deals/{id}": {
      "get": {
        "operationId": "getDeal",
        "summary": "Retrieve a deal",
        "description": "The deal as it is now. Events can arrive out of order or late; when in doubt, read the current state here. `listing.metadata` is the listing's current metadata, while an event carries it as it was when the event was created.",
        "tags": [
          "Deals"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of the deal, from the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "pending",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T09:12:40.118Z",
                  "expiresAt": "2026-10-08T09:12:40.118Z",
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/dashboard/deals?peek=VAS-1042",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No deal with that id for your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "Deal not found"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/deals/{id}/accept": {
      "post": {
        "operationId": "acceptDeal",
        "summary": "Accept a deal",
        "description": "Takes the tenant on. `message` opens the conversation and is shown to the tenant as written by `from`, who also becomes responsible for the deal. Only a `pending` deal can be accepted. Answers `409` when the deal is no longer pending, the tenant has not finished signing up yet (try again later), the listing is unpublished (push it again first) or no longer yours, or nobody can answer for your organization (the member the lead is routed to has left and there is no owner; send `from`). A retry after a timeout can get `409` not_pending because the first attempt went through: after any `409`, `GET /deals/{id}` to see where the deal stands.",
        "tags": [
          "Deals"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of the deal, from the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000,
                    "description": "The first message to the tenant, in plain text."
                  },
                  "from": {
                    "description": "Email of the member the message is from, for example a listing contact. Defaults to the member the lead is routed to (usually the listing's contact), or the owner.",
                    "type": "string",
                    "format": "email",
                    "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  }
                },
                "required": [
                  "message"
                ]
              },
              "example": {
                "message": "Hej! Kul att ni är intresserade av lokalen på Sveavägen 44. När passar det att komma på visning?",
                "from": "erik.holm@nordicfastigheter.se"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "accepted",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T13:40:02.517Z",
                  "expiresAt": null,
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "fromNotMember": {
                    "summary": "from is not a member of your organization",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "from is not a member of your organization. Push a listing with them as contact first, or leave from out.",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "from"
                            ],
                            "message": "from is not a member of your organization. Push a listing with them as contact first, or leave from out."
                          }
                        ]
                      }
                    }
                  },
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No deal with that id for your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "Deal not found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notPending": {
                    "summary": "The deal was already answered, expired or withdrawn",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "Only a pending deal can be accepted",
                      "data": {
                        "reason": "not_pending"
                      }
                    }
                  },
                  "tenantNotReady": {
                    "summary": "The tenant has not finished signing up; try again later",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "The tenant has not finished signing up yet. Try again later.",
                      "data": {
                        "reason": "tenant_not_ready"
                      }
                    }
                  },
                  "listingUnpublished": {
                    "summary": "The listing is off the market; push it again, then accept",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "The listing must be published to accept. Push it again, then accept.",
                      "data": {
                        "reason": "listing_unpublished"
                      }
                    }
                  },
                  "listingNotYours": {
                    "summary": "The deal's listing no longer belongs to your organization",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "The listing no longer belongs to your organization",
                      "data": {
                        "reason": "listing_not_yours"
                      }
                    }
                  },
                  "noOwner": {
                    "summary": "The organization has no owner yet; retrying does not help",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "The organization has no owner to attribute listings to. Accept the owner invite first.",
                      "data": {
                        "reason": "no_owner"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/deals/{id}/decline": {
      "post": {
        "operationId": "declineDeal",
        "summary": "Decline a deal",
        "description": "Says no to the tenant. Only a `pending` deal can be declined; the tenant is not told the reason. Unlike accepting, declining also works when the listing has been unpublished since the lead arrived. After a `409` (for example a retry whose first attempt went through), `GET /deals/{id}` to see where the deal stands.",
        "tags": [
          "Deals"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of the deal, from the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "reason": {
                    "description": "Why, for Shace. Never shown to the tenant.",
                    "type": "string",
                    "maxLength": 500
                  }
                }
              },
              "example": {
                "reason": "Lokalen är redan uthyrd."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "declined",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T13:40:02.517Z",
                  "expiresAt": null,
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/dashboard/deals",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No deal with that id for your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "Deal not found"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notPending": {
                    "summary": "The deal was already answered, expired or withdrawn",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "Only a pending deal can be declined",
                      "data": {
                        "reason": "not_pending"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "summary": "List webhook endpoints",
        "description": "Your organization's endpoints, oldest first.",
        "tags": [
          "Webhook endpoints"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the endpoint."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "Where events are POSTed."
                          },
                          "eventTypes": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "deal.created",
                                    "deal.reopened",
                                    "deal.accepted",
                                    "deal.declined",
                                    "deal.expired",
                                    "deal.lost",
                                    "deal.viewing_proposed",
                                    "deal.viewing_booked",
                                    "deal.viewing_cancelled",
                                    "deal.contract_signed",
                                    "deal.message_created",
                                    "deal.message_sent",
                                    "listing.status_changed"
                                  ]
                                }
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "null means every event. Always null today: every endpoint gets every event your organization receives."
                          },
                          "description": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Your note, or null."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "ISO 8601 UTC."
                          }
                        },
                        "required": [
                          "id",
                          "url",
                          "eventTypes",
                          "description",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "data": [
                    {
                      "id": "b7e4c2a9-1d3f-4e6b-8a5c-9f0d2e7b4c16",
                      "url": "https://integrations.nordicfastigheter.se/shace/events",
                      "eventTypes": null,
                      "description": "Dynamics 365 Sales",
                      "createdAt": "2026-09-24T08:30:12.004Z"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "operationId": "testWebhook",
        "summary": "Send a test event",
        "description": "Queues a `webhook.test` event for this endpoint, signed like any other and sent once, without retries. It arrives within seconds. Limited to 10 test events per organization every 10 minutes; over that, the answer is 429 with `Retry-After` in seconds.",
        "tags": [
          "Webhook endpoints"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of the endpoint."
            },
            "example": "b7e4c2a9-1d3f-4e6b-8a5c-9f0d2e7b4c16"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "eventId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "The id the test event is delivered with."
                    }
                  },
                  "required": [
                    "eventId"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "eventId": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No endpoint with that id in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "Webhook endpoint not found"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "testRateLimited": {
                    "summary": "More than 10 test events in 10 minutes; wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Too many test events, please try again in a few minutes"
                    }
                  },
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/me": {
      "get": {
        "operationId": "me",
        "summary": "Retrieve your account",
        "description": "The first call in every quickstart: confirms the key works and shows which organization it acts for.",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "org": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                          "description": "Shace id of the organization."
                        },
                        "name": {
                          "type": "string",
                          "description": "Organization name."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Organization number, digits only. Null only for an organization registered without one."
                        },
                        "orgType": {
                          "type": "string",
                          "enum": [
                            "lister",
                            "realtor"
                          ],
                          "description": "lister is a landlord, realtor a broker acting for one."
                        },
                        "integration": {
                          "type": "string",
                          "enum": [
                            "listings",
                            "full"
                          ],
                          "description": "listings: you sync listings and your team handles leads in Shace. full: leads also come to your system as webhooks, and the Deals endpoints are open to you. Shace sets it up with you."
                        },
                        "emailDomains": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Your organization's email domains, lowercase: verified by one of your developers with DNS under Developer > Email domains in the Shace dashboard, or set up by Shace. A listing contact on one of them can be assigned without being a member yet, and with full integration staff on them can answer leads by mail. The match is exact: landlord.se does not cover team.landlord.se."
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "orgNumber",
                        "orgType",
                        "integration",
                        "emailDomains"
                      ],
                      "additionalProperties": false,
                      "description": "The organization the key acts for."
                    },
                    "key": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                          "description": "Shace id of the key."
                        },
                        "name": {
                          "type": "string",
                          "description": "The label the key was issued with."
                        },
                        "keyPrefix": {
                          "type": "string",
                          "description": "The first characters of the key, to tell keys apart."
                        },
                        "expiresAt": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "When the key stops working, or null for no expiry."
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                          "description": "ISO 8601 UTC."
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "keyPrefix",
                        "expiresAt",
                        "createdAt"
                      ],
                      "additionalProperties": false,
                      "description": "The key that made this request."
                    },
                    "rateLimit": {
                      "type": "object",
                      "properties": {
                        "requestsPerMinute": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Requests per minute across all endpoints."
                        },
                        "uploadsPerMinute": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991,
                          "description": "Requests per minute to the upload endpoints, however many files each carries. They count towards requestsPerMinute too."
                        }
                      },
                      "required": [
                        "requestsPerMinute",
                        "uploadsPerMinute"
                      ],
                      "additionalProperties": false,
                      "description": "Limits per organization, shared across its keys, in fixed one-minute windows. A request over a limit gets 429 TOO_MANY_REQUESTS with Retry-After in seconds. Responses to a valid key carry RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset for the window closest to its limit."
                    }
                  },
                  "required": [
                    "org",
                    "key",
                    "rateLimit"
                  ],
                  "additionalProperties": false
                },
                "example": {
                  "org": {
                    "id": "8ac643b3-dab8-4254-ae00-96e0c88b95fb",
                    "name": "Nordic Fastigheter AB",
                    "orgNumber": "5568123456",
                    "orgType": "lister",
                    "integration": "full",
                    "emailDomains": [
                      "nordicfastigheter.se"
                    ]
                  },
                  "key": {
                    "id": "ca2d7f01-45e6-4845-a18e-6c99be527414",
                    "name": "Nordic Fastigheter AB",
                    "keyPrefix": "shace_sk_0123",
                    "expiresAt": null,
                    "createdAt": "2026-09-02T13:17:51.949Z"
                  },
                  "rateLimit": {
                    "requestsPerMinute": 600,
                    "uploadsPerMinute": 60
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/deals": {
      "post": {
        "operationId": "sandboxCreateDeal",
        "summary": "Create a test lead",
        "description": "A test tenant shows interest in one of your published listings. The deal starts `pending` and fires `deal.created`, exactly like a real lead; answer it with `POST /deals/{id}/accept` or `/decline`, or by mail. Answers `409` when the listing is not published, and `412` when the sandbox's test tenant is not set up on this environment.",
        "tags": [
          "Sandbox"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "listingId": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The listing the tenant is interested in: its Shace id, or `ext:<your reference>`."
                  }
                },
                "required": [
                  "listingId"
                ]
              },
              "example": {
                "listingId": "ext:unit-4711"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "pending",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T09:12:40.118Z",
                  "expiresAt": "2026-10-08T09:12:40.118Z",
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/dashboard/deals?peek=VAS-1042",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id is neither a Shace UUID nor ext:<your reference>",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "listingId"
                            ],
                            "message": "Must be a Shace UUID or ext:<externalRef>"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No listing with that id or reference in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No listing with externalRef \"unit-4711\""
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "listingUnpublished": {
                    "summary": "Tenants only see published listings",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "The listing must be published",
                      "data": {
                        "reason": "listing_unpublished"
                      }
                    }
                  },
                  "noOwner": {
                    "summary": "The organization has no owner yet; retrying does not help",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "The organization has no owner to attribute listings to. Accept the owner invite first.",
                      "data": {
                        "reason": "no_owner"
                      }
                    }
                  }
                }
              }
            }
          },
          "412": {
            "description": "Precondition failed. The sandbox is not set up for this; retrying does not help.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "sandboxNotConfigured": {
                    "summary": "The sandbox's test tenant is not set up here; tell us",
                    "value": {
                      "code": "PRECONDITION_FAILED",
                      "status": 412,
                      "message": "The sandbox test tenant is not configured"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/deals/{id}/message": {
      "post": {
        "operationId": "sandboxTenantMessage",
        "summary": "Write as the tenant",
        "description": "The test tenant writes in the deal's conversation, which fires `deal.message_created` and is mailed to your side like any tenant message. Only an accepted deal has a conversation; answers `409` before that.",
        "tags": [
          "Sandbox"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of a test deal, from POST /sandbox/deals or the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "message": {
                    "description": "What the tenant writes, in plain text. Defaults to \"Hej! Passar torsdag kl 10 för en visning? (simulerat)\"",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  }
                }
              },
              "example": {
                "message": "Hej! Går det bra med en visning på torsdag kl 10?"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "accepted",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T13:40:02.517Z",
                  "expiresAt": null,
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No test deal with that id in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No test deal with that id in your organization. Sandbox endpoints only act on test deals, such as those from POST /sandbox/deals."
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notAccepted": {
                    "summary": "The step needs an accepted deal",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "Accept the deal first",
                      "data": {
                        "reason": "not_accepted"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/deals/{id}/viewing": {
      "post": {
        "operationId": "sandboxBookViewing",
        "summary": "Book a viewing as the tenant",
        "description": "Proposes a viewing tomorrow at 10:00 Stockholm time on your organization's behalf and has the test tenant book it, which fires `deal.viewing_proposed` and then `deal.viewing_booked` (and `deal.viewing_cancelled` first when it replaces a booked viewing). Only an accepted deal can book a viewing; answers `409` before that.",
        "tags": [
          "Sandbox"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of a test deal, from POST /sandbox/deals or the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "accepted",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T13:40:02.517Z",
                  "expiresAt": null,
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No test deal with that id in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No test deal with that id in your organization. Sandbox endpoints only act on test deals, such as those from POST /sandbox/deals."
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notAccepted": {
                    "summary": "The step needs an accepted deal",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "Accept the deal first",
                      "data": {
                        "reason": "not_accepted"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/deals/{id}/contract": {
      "post": {
        "operationId": "sandboxSignContract",
        "summary": "Sign a contract",
        "description": "Both sides sign a placeholder contract, which fires `deal.contract_signed`. No e-signing service is involved. Only an accepted deal without a contract can be signed; answers `409` otherwise.",
        "tags": [
          "Sandbox"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of a test deal, from POST /sandbox/deals or the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "accepted",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T13:40:02.517Z",
                  "expiresAt": null,
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No test deal with that id in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No test deal with that id in your organization. Sandbox endpoints only act on test deals, such as those from POST /sandbox/deals."
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notAccepted": {
                    "summary": "The step needs an accepted deal",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "Accept the deal first",
                      "data": {
                        "reason": "not_accepted"
                      }
                    }
                  },
                  "contractExists": {
                    "summary": "The deal already has a contract",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "The deal already has a signed contract",
                      "data": {
                        "reason": "contract_exists"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/deals/{id}/withdraw": {
      "post": {
        "operationId": "sandboxWithdrawDeal",
        "summary": "Withdraw as the tenant",
        "description": "The test tenant loses interest before you answer, which fires `deal.lost`. Only a `pending` deal can be withdrawn.",
        "tags": [
          "Sandbox"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of a test deal, from POST /sandbox/deals or the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "lost",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T10:02:11.730Z",
                  "expiresAt": null,
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/dashboard/deals",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No test deal with that id in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No test deal with that id in your organization. Sandbox endpoints only act on test deals, such as those from POST /sandbox/deals."
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notPending": {
                    "summary": "The deal was already answered, expired or withdrawn",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "Only a pending deal can be withdrawn",
                      "data": {
                        "reason": "not_pending"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/deals/{id}/reopen": {
      "post": {
        "operationId": "sandboxReopenDeal",
        "summary": "Come back as the tenant",
        "description": "The test tenant is interested again after withdrawing, which fires `deal.reopened` and makes the deal `pending` again. Only a withdrawn deal can come back.",
        "tags": [
          "Sandbox"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of a test deal, from POST /sandbox/deals or the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "pending",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-25T08:15:43.206Z",
                  "expiresAt": "2026-10-09T08:15:43.206Z",
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/dashboard/deals?peek=VAS-1042",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No test deal with that id in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No test deal with that id in your organization. Sandbox endpoints only act on test deals, such as those from POST /sandbox/deals."
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notWithdrawn": {
                    "summary": "Only a deal the tenant withdrew can come back",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "Only a withdrawn deal can come back",
                      "data": {
                        "reason": "not_withdrawn"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/deals/{id}/expire": {
      "post": {
        "operationId": "sandboxExpireDeal",
        "summary": "Expire the lead",
        "description": "Skips the wait: the deal runs out unanswered now instead of at `expiresAt`, which fires `deal.expired`. Only a `pending` deal can expire.",
        "tags": [
          "Sandbox"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
              "description": "Shace id of a test deal, from POST /sandbox/deals or the event."
            },
            "example": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "Shace id of the deal."
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "accepted",
                        "declined",
                        "expired",
                        "lost"
                      ],
                      "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the tenant showed interest."
                    },
                    "statusChangedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                      "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                    },
                    "expiresAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                    },
                    "number": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                    },
                    "reference": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                    },
                    "replyAddress": {
                      "type": "string",
                      "format": "email",
                      "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                      "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                    },
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                    },
                    "listing": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                              "description": "Shace id of the listing."
                            },
                            "externalRef": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ],
                              "description": "Your reference for the listing."
                            },
                            "metadata": {
                              "type": "object",
                              "maxProperties": 50,
                              "propertyNames": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "additionalProperties": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                            }
                          },
                          "required": [
                            "id",
                            "externalRef",
                            "metadata"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                    },
                    "tenant": {
                      "type": "object",
                      "properties": {
                        "companyName": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's company, as registered or as entered."
                        },
                        "orgNumber": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's organization number, when known."
                        },
                        "country": {
                          "type": "string",
                          "description": "ISO 3166-1 alpha-2 of the organization number."
                        },
                        "underRegistration": {
                          "type": "boolean",
                          "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                        },
                        "description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                        }
                      },
                      "required": [
                        "companyName",
                        "orgNumber",
                        "country",
                        "underRegistration",
                        "description"
                      ],
                      "additionalProperties": false,
                      "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                    },
                    "request": {
                      "type": "object",
                      "properties": {
                        "city": {
                          "type": "string",
                          "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                        },
                        "teamSize": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Number of people."
                        },
                        "areaM2Min": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Smallest area in m²."
                        },
                        "areaM2Max": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Largest area in m²."
                        },
                        "moveIn": {
                          "type": "string",
                          "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                        },
                        "term": {
                          "type": "string",
                          "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                        }
                      },
                      "required": [
                        "city",
                        "teamSize",
                        "areaM2Min",
                        "areaM2Max",
                        "moveIn",
                        "term"
                      ],
                      "additionalProperties": false,
                      "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "createdAt",
                    "statusChangedAt",
                    "expiresAt",
                    "number",
                    "reference",
                    "replyAddress",
                    "url",
                    "listing",
                    "tenant",
                    "request"
                  ],
                  "additionalProperties": false,
                  "description": "A tenant's interest in one of your listings."
                },
                "example": {
                  "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                  "status": "expired",
                  "createdAt": "2026-09-24T09:12:40.118Z",
                  "statusChangedAt": "2026-09-24T10:02:11.730Z",
                  "expiresAt": null,
                  "number": 1042,
                  "reference": "VAS-1042",
                  "replyAddress": "vas-1042@chat.shace.se",
                  "url": "https://www.shace.se/dashboard/deals",
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "tenant": {
                    "companyName": "Lumen Design AB",
                    "orgNumber": "5591234567",
                    "country": "SE",
                    "underRegistration": false,
                    "description": null
                  },
                  "request": {
                    "city": "stockholm",
                    "teamSize": "8",
                    "areaM2Min": "100",
                    "areaM2Max": "150",
                    "moveIn": "1-3m",
                    "term": "1-2y"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidId": {
                    "summary": "The id in the path is not a UUID",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Input validation failed",
                      "data": {
                        "issues": [
                          {
                            "path": [
                              "id"
                            ],
                            "message": "Invalid UUID"
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Your organization is not set up for this; the message says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFullIntegration": {
                    "summary": "Your organization syncs listings only; deals need full integration",
                    "value": {
                      "code": "FORBIDDEN",
                      "status": 403,
                      "message": "Deals are part of full integration. Contact Shace support to turn it on."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found in your organization. Other organizations' ids answer the same, so ids leak nothing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "No test deal with that id in your organization",
                    "value": {
                      "code": "NOT_FOUND",
                      "status": 404,
                      "message": "No test deal with that id in your organization. Sandbox endpoints only act on test deals, such as those from POST /sandbox/deals."
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict. The resource is not in a state that allows this; `data.reason` says which. Retry only `create_race`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notPending": {
                    "summary": "The deal was already answered, expired or withdrawn",
                    "value": {
                      "code": "CONFLICT",
                      "status": 409,
                      "message": "Only a pending deal can expire",
                      "data": {
                        "reason": "not_pending"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 600 requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/uploads/images": {
      "post": {
        "operationId": "uploadImages",
        "tags": [
          "Uploads"
        ],
        "summary": "Upload images",
        "description": "Multipart form with one or more `files` fields. Each image is converted to webp, resized to at most 2048 px and given a blur placeholder, exactly like uploads from the app. Reference the returned URLs from `images` on a listing. At most 8 files per request, each at most 15 MB. JPEG, PNG, WebP and HEIC (at most 50 megapixels) are supported, judged by the file's content; any other format (GIF, SVG, AVIF) or a file that cannot be decoded is rejected with `400 BAD_REQUEST`, and so is a file over 15 MB. A request body over 121 MB is refused with `413` before any file is read.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "files"
                ],
                "properties": {
                  "files": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 8,
                    "description": "One multipart field per image, all named files. Order is preserved in the response. At most 15 MB each.",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    }
                  }
                }
              },
              "encoding": {
                "files": {
                  "contentType": "image/jpeg, image/png, image/webp, image/heic"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "urls",
                    "blurPlaceholders"
                  ],
                  "properties": {
                    "urls": {
                      "type": "array",
                      "description": "Public URLs, in upload order. Use these in `images`.",
                      "items": {
                        "type": "string",
                        "format": "uri"
                      }
                    },
                    "blurPlaceholders": {
                      "type": "object",
                      "description": "Tiny base64 webp per URL. Pass along as `blurPlaceholders` on the listing if you want instant previews in the app; optional.",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": {
                  "urls": [
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/df8f8bd6-34ae-4b0b-b7b1-f3b01f53c433.webp",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/86937c08-cc69-4118-8816-9dddc4ab166d.webp",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/4c695935-0bff-4865-8121-b46dbb44b4e2.webp"
                  ],
                  "blurPlaceholders": {
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/df8f8bd6-34ae-4b0b-b7b1-f3b01f53c433.webp": "data:image/webp;base64,UklGRkAAAABXRUJQVlA4IDQAAAAwAgCdASoKAAoAAUAmJaQAA3AA/vuUaAA=",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/86937c08-cc69-4118-8816-9dddc4ab166d.webp": "data:image/webp;base64,UklGRkAAAABXRUJQVlA4IDQAAAAwAgCdASoKAAoAAUAmJaQAA3AA/vuUaAA=",
                    "https://cdn.shace.se/listing-images/8ac643b3-dab8-4254-ae00-96e0c88b95fb/4c695935-0bff-4865-8121-b46dbb44b4e2.webp": "data:image/webp;base64,UklGRkAAAABXRUJQVlA4IDQAAAAwAgCdASoKAAoAAUAmJaQAA3AA/vuUaAA="
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "undecodable": {
                    "summary": "A file is not a supported image",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "One or more files are not a supported image (JPEG, PNG, WebP or HEIC)"
                    }
                  },
                  "fileTooLarge": {
                    "summary": "One file is over 15 MB",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Each image must be at most 15MB"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "408": {
            "description": "Request timeout. The body arrived too slowly; retry, on a faster connection or with a smaller batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "bodyTimeout": {
                    "summary": "The request body arrived too slowly; retry",
                    "value": {
                      "code": "REQUEST_TIMEOUT",
                      "status": 408,
                      "message": "The request body did not arrive within 104 seconds"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Payload too large. Split the batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "tooLarge": {
                    "summary": "The request body is over 121 MB; split the batch",
                    "value": {
                      "code": "PAYLOAD_TOO_LARGE",
                      "status": 413,
                      "message": "At most 8 images of 15MB each per request"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 60 upload requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  },
                  "uploadInProgress": {
                    "summary": "Your organization already has an image upload in progress; retry once it finishes",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "An image upload for your organization is already in progress. Wait for it to finish before sending the next batch."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/uploads/floor-plan": {
      "post": {
        "operationId": "uploadFloorPlan",
        "tags": [
          "Uploads"
        ],
        "summary": "Upload a floor plan",
        "description": "Multipart form with exactly one `file` field: PNG, JPEG, WebP or PDF, at most 15 MB. Reference the returned URL from `floorPlanUrl` on a listing. The format is read from the file's content, and the stored file's type follows it. Images may be at most 100 megapixels, or 32 megapixels for an interlaced PNG or progressive JPEG. A file in any other format, an image that does not decode (a corrupt or cut-off file) or is over those sizes, one whose content does not match the type or name it was sent with, a second `file` field or a file over 15 MB is a `400 BAD_REQUEST`. A request body over 31 MB is refused with `413` before the file is read.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "PNG, JPEG, WebP or PDF, at most 15 MB."
                  }
                }
              },
              "encoding": {
                "file": {
                  "contentType": "image/png, image/jpeg, image/webp, application/pdf"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "url"
                  ],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri",
                      "description": "Public URL. Use it as `floorPlanUrl`."
                    }
                  }
                },
                "example": {
                  "url": "https://cdn.shace.se/listing-floor-plans/8ac643b3-dab8-4254-ae00-96e0c88b95fb/1f6e2c1a-8d1e-4a4e-9f27-0d3d9c8f1b2a.pdf"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Fix the body; do not retry as is.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unsupportedFormat": {
                    "summary": "The file is not PNG, JPEG, WebP or PDF",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "Only PNG, JPEG, WebP, or PDF files are allowed"
                    }
                  },
                  "typeMismatch": {
                    "summary": "The file's content is not the type it was sent as",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "The file's content is PDF, not PNG"
                    }
                  },
                  "fileTooLarge": {
                    "summary": "The file is over 15 MB",
                    "value": {
                      "code": "BAD_REQUEST",
                      "status": 400,
                      "message": "File too large (max 15MB)"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The key is missing, malformed, revoked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Missing, malformed, revoked or expired key",
                    "value": {
                      "code": "UNAUTHORIZED",
                      "status": 401,
                      "message": "Missing or invalid API key"
                    }
                  }
                }
              }
            }
          },
          "408": {
            "description": "Request timeout. The body arrived too slowly; retry, on a faster connection or with a smaller batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "bodyTimeout": {
                    "summary": "The request body arrived too slowly; retry",
                    "value": {
                      "code": "REQUEST_TIMEOUT",
                      "status": 408,
                      "message": "The request body did not arrive within 104 seconds"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Payload too large. Split the batch.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "tooLarge": {
                    "summary": "The request body is over 31 MB",
                    "value": {
                      "code": "PAYLOAD_TOO_LARGE",
                      "status": 413,
                      "message": "Request body too large (one floor plan of at most 15MB)"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the number of seconds in `Retry-After`, then retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rateLimited": {
                    "summary": "Over the organization's rate limit (shared by its keys); wait for Retry-After seconds",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Rate limit exceeded: at most 60 upload requests per minute for this organization, shared across its API keys. Retry after the number of seconds in Retry-After."
                    }
                  },
                  "uploadInProgress": {
                    "summary": "Your organization already has two floor-plan uploads in progress; retry once one finishes",
                    "value": {
                      "code": "TOO_MANY_REQUESTS",
                      "status": 429,
                      "message": "Two floor plan uploads for your organization are already in progress. Wait for one to finish before sending another."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Listings",
      "description": "Units for rent, each with its own address. `PUT /listings/{id}` by your own reference is the call to make whenever a unit is saved in your system; `POST /listings/{id}/unpublish` takes it off the market. The [publishing guide](https://docs.shace.se/publishing-from-your-system) covers the rules behind both.\n\n**Contacts.** Every push names the person responsible for the unit as `contact: { email, firstName?, lastName? }`; it is required, so a unit without one fails instead of landing with someone else. Email is trimmed, lowercased and at most 254 characters. Names are trimmed, up to 100 characters; leave them out, or send null or an empty string, when your system has none.\n\n- A member of your organization is assigned directly.\n- Anyone else needs an email on one of your organization's email domains (exact, case-insensitive match, no subdomains): verified by one of your developers with a DNS TXT record under Developer > Email domains in the Shace dashboard, or set up by Shace. `GET /me` lists them as `org.emailDomains`.\n- With listings sync (leads in Shace), they are invited and the listing stays unassigned until they accept; an unanswered invite is re-sent at most once a day, for three weeks.\n- With full integration (leads in your own system), they get a passwordless account, are assigned right away and receive nothing; the names you send update theirs until they sign in. An email with a Shace account outside your organization, or with an unexpired pending or a declined invite to it, is rejected.\n- Anything Shace cannot assign is a `400` with an issue on `contact.email` that says why, and nothing is stored.\n\nThe response's `assignedTo` is the assigned user's email, or null while an invited contact has not joined. In requests, `assignedTo` is a deprecated shorthand for `contact: { email }`; sending both is a 400 with an issue on `assignedTo`.\n\n**Metadata.** `metadata` is for your own ids: a flat map of at most 50 keys (1-40 characters) with string values up to 500 characters. Shace stores it untouched, returns it on reads (`{}` when none) and sends it with every deal event, so you can route a lead to the right person. Leave it out on an update to keep it; send null or `{}` to clear it. A map you send replaces the stored one whole."
    },
    {
      "name": "Uploads",
      "description": "Listings reference images by URL, and there are two kinds of URL you can send in `images`.\n\n**Your own URLs.** If your system already serves the photos, send those URLs directly on the listing. Shace downloads each image once, converts it to webp, resizes it to at most 2048 px, gives it a blur placeholder and hosts the copy itself; the listing never links to your server. The URL is remembered per organization, so pushing the same URL again is a no-op with no download, and a photo shared by several units (a building exterior) is fetched once. To replace a photo, send a new URL: Shace does not re-check a URL it has already fetched. URLs must be `https` on the default port, on a public hostname, without credentials and at most 2048 bytes; each file at most 15 MB in JPEG, PNG, WebP or HEIC, judged by its content (HEIC at most 50 megapixels). Shace follows up to 3 redirects and gives each image 20 seconds in all (looking up the host, redirects and download). A push gets 75 seconds for its image URLs, including time spent waiting behind other pushes; images not fetched by then fail as unavailable. Anything else, including a file that is not an image, a GIF or SVG, or a host name that does not resolve, is a `400` with the failing index under `issues`. A host that does not answer, times out, rate-limits or answers a server error is a `503 IMAGE_HOST_UNAVAILABLE`, also with the failing index, and safe to retry: images that did get through are kept, so the retry only fetches the rest. A push with both kinds of failure is a `400` listing every failing index, since retrying it cannot succeed until the body is fixed. The same URL may not appear twice in `images`. A listing that mixes the two kinds of URL is fine.\n\n**Uploads.** For photos that live behind a login, or in a system with no public URLs, send the files to `POST /uploads/images` and reference the returned URLs. Store them next to the unit in your system; later pushes send the same URLs and the listing comes back `unchanged`. Upload again only when a photo actually changed. Shace checks that each upload URL points into your organization's folder but does not fetch it, so a URL for an upload that no longer exists is accepted and shows as a broken image.\n\n**Deletion.** An upload or a fetched copy that a push stops using is kept for about 15 minutes, then deleted once no listing in your organization references it. Within those minutes it can be sent again, on the same listing or another one, so a photo or floor plan that moves between units (unit A drops it and unit B gains it) survives if both pushes land within the window. After that, an upload URL shows as a broken image and one of your own URLs is fetched again. Dropping one of your URLs and adding it back within the window reuses the old copy, so to replace a photo, give it a new URL.\n\n**Order matters.** `images` is the display order in Shace and the first image is the cover. Reordering the array counts as a change and re-indexes the listing.\n\n**Floor plans** are optional, uploaded through `POST /uploads/floor-plan` and do not count towards the three-image minimum. **Blur placeholders** from the upload response are optional to pass along on the listing; leave them out if your system has nowhere to keep them. They are only read for upload URLs: images fetched from your URLs get theirs generated, and a `blurPlaceholders` entry for one of your own URLs is ignored."
    },
    {
      "name": "Deals",
      "description": "**Full integration only.** These endpoints are for organizations that get their leads as webhooks, set up with Shace. With listings sync, your team answers leads in Shace and every call here answers `403`. `GET /me` shows which you have under `org.integration`.\n\nA deal is a tenant's interest in one of your listings. It reaches you as a [`deal.created`](https://docs.shace.se/webhooks/events#dealcreated) webhook with status `pending`, and waits for your answer until `expiresAt` (14 days). Answer it with `POST /deals/{id}/accept` or `POST /deals/{id}/decline`, or in Shace.\n\n**Contact.** The tenant's company name and organization number are shared; their name, email and phone are not. A company still under registration in Sweden has no number yet: `tenant.underRegistration` is `true` and `tenant.description` holds what the tenant wrote about their business instead. `replyAddress` is the tenant's address for the deal: store it as the lead's email in your CRM, and your CRM can track the whole conversation on the lead.\n\n**Answering by mail.** Your staff can reply to the tenant straight from Outlook. Mail to `replyAddress` becomes a chat message from the sender, and the first mail to a `pending` deal accepts it. The tenant's messages come back from the same address, threaded, to whoever last wrote (at first, the listing's contact). Mail is accepted from your members and from anyone on your organization's email domains, and it must pass DMARC; colleagues without a Shace account get one silently. Automated mail (out-of-office replies, newsletters, noreply and CRM send-outs) is ignored, so point your CRM's own automations elsewhere. Quoted history, signatures and images pasted into the mail are left out, and the text is cut at 5,000 characters. Attached files come along, up to 10 per mail and 25 MB each, as PNG, JPEG, WebP, GIF, PDF, Word, Excel, text or CSV; other files are dropped and the message still goes through. A mail that cannot be delivered (the deal is closed, the tenant has not finished signing up, the sender's domain is not yours) gets a short explanation back.\n\n**Who answers.** Accepting posts your `message` to the tenant from the member named in `from` (by default whoever the lead is routed to, usually the listing's contact, else the owner), and makes them responsible for the deal. Declining never shows your `reason` to the tenant.\n\n**Statuses.** `pending`, then `accepted`, `declined`, `expired` (nobody answered in time) or `lost` (the tenant withdrew, or Shace closed it). A tenant who withdrew can come back, which makes the deal `pending` again and sends `deal.reopened` (or `deal.created` if no earlier event about the deal reached you). `declined`, `expired` and `lost` only end a pending lead: an accepted deal stays `accepted`, and a tenant who cancels after that is announced in the deal's mail thread, not by an event."
    },
    {
      "name": "Webhook endpoints",
      "description": "The URLs Shace sends events to: your listings going live or coming off the market and, with full integration, new leads and what happens to them. Your developers add them under Developer > Webhooks in the Shace dashboard, where each endpoint's signing secret is shown once; here you can list them and send a test event.\n\nThe [webhooks overview](https://docs.shace.se/webhooks) covers delivery, signatures, retries and duplicates, and [Events](https://docs.shace.se/webhooks/events) lists every event with its fields and an example. The downloadable schema has the same payloads under `webhooks`."
    },
    {
      "name": "Account",
      "description": "The organization and key behind a request."
    },
    {
      "name": "Sandbox",
      "description": "**Sandbox only, full integration only.** These endpoints exist on `api-sandbox.shace.se` and not in production, where they answer `404`. Like the Deals endpoints they need full integration and answer `403` with listings sync. They play the tenant's side of a lead, one call per step, so you can watch every deal event reach your receiver and build against it without a real tenant.\n\nStart with `POST /sandbox/deals` on one of your published listings: a test tenant shows interest and `deal.created` fires. Then answer it the way you will in production (`POST /deals/{id}/accept` or `/decline`, or by mail) and drive the rest from here: the tenant writes, books a viewing, signs, withdraws and comes back, or the lead expires. Each call returns the deal as it is afterwards, and the events arrive at your endpoints as they would in production.\n\nThe steps only act on test deals made here, and the test tenant is the same for every organization in the sandbox."
    }
  ],
  "webhooks": {
    "deal.created": {
      "post": {
        "operationId": "dealCreatedEvent",
        "summary": "New lead",
        "description": "A tenant is interested in one of your listings and waits for your answer. Create the lead in your system and store `deal.replyAddress` as its email.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.created",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      }
                    },
                    "required": [
                      "deal"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.created",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "pending",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T09:12:40.118Z",
                    "expiresAt": "2026-10-08T09:12:40.118Z",
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/dashboard/deals?peek=VAS-1042",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.reopened": {
      "post": {
        "operationId": "dealReopenedEvent",
        "summary": "Lead is back",
        "description": "A lead your organization already heard about is pending again, usually because a tenant who withdrew is interested again. Same id and reply address. Sent only when an earlier event about this deal reached your organization; a lead that reaches you for the first time arrives as `deal.created`, even after an earlier withdrawal. If your system has no record of the deal (say your endpoint skipped `deal.created`), create it from this event.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.reopened",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      }
                    },
                    "required": [
                      "deal"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.reopened",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "pending",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T09:12:40.118Z",
                    "expiresAt": "2026-10-08T09:12:40.118Z",
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/dashboard/deals?peek=VAS-1042",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.accepted": {
      "post": {
        "operationId": "dealAcceptedEvent",
        "summary": "Lead accepted",
        "description": "The deal was accepted, through the API, by a mail to the reply address, or in Shace. The conversation with the tenant is open.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.accepted",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      }
                    },
                    "required": [
                      "deal"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.accepted",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "accepted",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T13:40:02.517Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.declined": {
      "post": {
        "operationId": "dealDeclinedEvent",
        "summary": "Lead declined",
        "description": "Your organization declined the lead.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.declined",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      }
                    },
                    "required": [
                      "deal"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.declined",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "declined",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T09:12:40.118Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/dashboard/deals",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.expired": {
      "post": {
        "operationId": "dealExpiredEvent",
        "summary": "Lead expired",
        "description": "Nobody answered the lead before `expiresAt`. The tenant has moved on.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.expired",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      }
                    },
                    "required": [
                      "deal"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.expired",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "expired",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-10-08T02:00:04.221Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/dashboard/deals",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.lost": {
      "post": {
        "operationId": "dealLostEvent",
        "summary": "Lead lost",
        "description": "The tenant withdrew their interest, or Shace closed the lead. A withdrawal can be undone by the tenant, which sends `deal.reopened`.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.lost",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      }
                    },
                    "required": [
                      "deal"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.lost",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "lost",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T09:12:40.118Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/dashboard/deals",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.viewing_proposed": {
      "post": {
        "operationId": "dealViewingProposedEvent",
        "summary": "Viewing times offered",
        "description": "Your side offered the tenant viewing times to pick from: in Shace, or by a mail to the reply address that names times (Shace reads them and offers them as a pick-a-time card). Every new round sends it, and a new round replaces the one before: an upcoming booked viewing it replaces sends `deal.viewing_cancelled`. When the offered times of a round change in Shace, it is sent again with the same viewing id and the current times; the latest one is current. A round your side withdraws in Shace is sent again with the same id and no slots.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.viewing_proposed",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      },
                      "viewing": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the viewing; `deal.viewing_booked` carries the same id when the tenant picks a time."
                          },
                          "slots": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "startsAt": {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                                  "description": "When the viewing starts."
                                }
                              },
                              "required": [
                                "startsAt"
                              ],
                              "additionalProperties": false
                            },
                            "description": "The times the tenant can pick from, earliest first. Empty once the round is withdrawn."
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "app",
                              "email"
                            ],
                            "description": "Where the times were offered: `app` in Shace, `email` read from a mail to the reply address."
                          }
                        },
                        "required": [
                          "id",
                          "slots",
                          "source"
                        ],
                        "additionalProperties": false,
                        "description": "The viewing times offered."
                      }
                    },
                    "required": [
                      "deal",
                      "viewing"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.viewing_proposed",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "accepted",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T13:40:02.517Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  },
                  "viewing": {
                    "id": "e1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
                    "slots": [
                      {
                        "startsAt": "2026-09-30T08:00:00.000Z"
                      },
                      {
                        "startsAt": "2026-10-01T12:00:00.000Z"
                      }
                    ],
                    "source": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.viewing_booked": {
      "post": {
        "operationId": "dealViewingBookedEvent",
        "summary": "Viewing booked",
        "description": "The tenant booked one of the viewing times offered.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.viewing_booked",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      },
                      "viewing": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the viewing."
                          },
                          "startsAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the viewing starts."
                          }
                        },
                        "required": [
                          "id",
                          "startsAt"
                        ],
                        "additionalProperties": false,
                        "description": "The viewing the tenant booked."
                      }
                    },
                    "required": [
                      "deal",
                      "viewing"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.viewing_booked",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "accepted",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T13:40:02.517Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  },
                  "viewing": {
                    "id": "e1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
                    "startsAt": "2026-09-30T08:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.viewing_cancelled": {
      "post": {
        "operationId": "dealViewingCancelledEvent",
        "summary": "Booked viewing cancelled",
        "description": "A booked viewing that has not taken place yet is off because your side offered new times, in Shace or by mail. `deal.viewing_proposed` with the new times comes with it.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.viewing_cancelled",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      },
                      "viewing": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the viewing."
                          },
                          "startsAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the viewing was to start."
                          }
                        },
                        "required": [
                          "id",
                          "startsAt"
                        ],
                        "additionalProperties": false,
                        "description": "The viewing that was booked."
                      }
                    },
                    "required": [
                      "deal",
                      "viewing"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.viewing_cancelled",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "accepted",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T13:40:02.517Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  },
                  "viewing": {
                    "id": "b7c8d9e0-f1a2-4b3c-8d4e-5f6a7b8c9d0e",
                    "startsAt": "2026-09-30T08:00:00.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.contract_signed": {
      "post": {
        "operationId": "dealContractSignedEvent",
        "summary": "Contract signed",
        "description": "Both parties signed the contract. A signed renewal sends it again, with the new contract.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.contract_signed",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      },
                      "contract": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the contract."
                          },
                          "signedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the last signature landed."
                          }
                        },
                        "required": [
                          "id",
                          "signedAt"
                        ],
                        "additionalProperties": false,
                        "description": "The contract both parties signed."
                      }
                    },
                    "required": [
                      "deal",
                      "contract"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.contract_signed",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "accepted",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T13:40:02.517Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  },
                  "contract": {
                    "id": "c9d8e7f6-a5b4-4c3d-9e2f-1a0b9c8d7e6f",
                    "signedAt": "2026-10-14T15:22:41.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.message_created": {
      "post": {
        "operationId": "dealMessageCreatedEvent",
        "summary": "Tenant wrote",
        "description": "The tenant wrote in the chat. The same message is mailed from the deal's reply address to whoever last wrote from your side, so you only need this to route it yourself. Messages from your side send `deal.message_sent`.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.message_created",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      },
                      "message": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the message."
                          },
                          "body": {
                            "type": "string",
                            "description": "The text, as written."
                          },
                          "attachments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "description": "File name."
                                },
                                "mimeType": {
                                  "type": "string",
                                  "description": "MIME type."
                                },
                                "size": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "description": "Size in bytes."
                                }
                              },
                              "required": [
                                "name",
                                "mimeType",
                                "size"
                              ],
                              "additionalProperties": false
                            },
                            "description": "Attached files; the mail carries the files."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When it was sent."
                          }
                        },
                        "required": [
                          "id",
                          "body",
                          "attachments",
                          "createdAt"
                        ],
                        "additionalProperties": false,
                        "description": "The tenant's message."
                      }
                    },
                    "required": [
                      "deal",
                      "message"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.message_created",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "accepted",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T13:40:02.517Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  },
                  "message": {
                    "id": "5d4c3b2a-1f0e-4d9c-8b7a-6e5f4d3c2b1a",
                    "body": "Hej! Passar torsdag kl 10 för en visning?",
                    "attachments": [],
                    "createdAt": "2026-09-24T14:02:10.000Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "deal.message_sent": {
      "post": {
        "operationId": "dealMessageSentEvent",
        "summary": "Your side wrote",
        "description": "Someone on your side wrote to the tenant: in Shace, by a mail to the reply address, or with an accept through the API. For a mail, `body` is what the tenant sees in the chat, after Shace left out the quoted history and the signature, so you can check what came through. Use `via` to skip messages your own system sent.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "deal.message_sent",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "deal": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the deal."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "accepted",
                              "declined",
                              "expired",
                              "lost"
                            ],
                            "description": "pending: waiting for your answer. accepted: you took the tenant on and the conversation is open. declined: you said no. expired: nobody answered in time. lost: the tenant withdrew or Shace closed it."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the tenant showed interest."
                          },
                          "statusChangedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When the deal entered its current status. Events that do not change the status (a viewing, a message) keep it. Neither this nor an event's `createdAt` guarantees the order events arrive in; when order matters, read the deal."
                          },
                          "expiresAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a pending deal expires unanswered; null in every other status. Expiry runs nightly, so the deal can still be answered until that run; `deal.expired` follows it."
                          },
                          "number": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The deal's number at your organization, counting from 1000. Fixed for the deal's life."
                          },
                          "reference": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "How people refer to the deal, like `VAS-1042`: your organization's prefix and the deal's number. Show it to your staff; key your records on `id`."
                          },
                          "replyAddress": {
                            "type": "string",
                            "format": "email",
                            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                            "description": "The tenant's contact address for this deal. Store it as the lead's email: the tenant's messages arrive from it, and mail your staff send to it reaches the tenant's chat. The first mail to a pending deal accepts it."
                          },
                          "url": {
                            "type": "string",
                            "format": "uri",
                            "description": "The deal in Shace, for people with an account. Its form follows the status: `/dashboard/deals?peek=<reference>` (the lead) while pending, `/chats/<id>` (the conversation) once accepted, `/dashboard/deals` after that. Take it as a link; do not parse it."
                          },
                          "listing": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                                    "description": "Shace id of the listing."
                                  },
                                  "externalRef": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ],
                                    "description": "Your reference for the listing."
                                  },
                                  "metadata": {
                                    "type": "object",
                                    "maxProperties": 50,
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    },
                                    "additionalProperties": {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    "description": "The `metadata` you pushed on the listing, to route the lead. In an event it is the metadata when the event was created; `GET /deals/{id}` returns the listing's current metadata."
                                  }
                                },
                                "required": [
                                  "id",
                                  "externalRef",
                                  "metadata"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The listing the tenant is interested in; null when the match was not on one of your listings."
                          },
                          "tenant": {
                            "type": "object",
                            "properties": {
                              "companyName": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's company, as registered or as entered."
                              },
                              "orgNumber": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's organization number, when known."
                              },
                              "country": {
                                "type": "string",
                                "description": "ISO 3166-1 alpha-2 of the organization number."
                              },
                              "underRegistration": {
                                "type": "boolean",
                                "description": "True when the tenant's company is being registered in Sweden and has no organization number yet; `description` says who they are."
                              },
                              "description": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "The tenant's own description of their business, given instead of an organization number while the company is under registration. Null otherwise."
                              }
                            },
                            "required": [
                              "companyName",
                              "orgNumber",
                              "country",
                              "underRegistration",
                              "description"
                            ],
                            "additionalProperties": false,
                            "description": "Who the tenant is. Personal contact details are never shared; use `replyAddress`."
                          },
                          "request": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string",
                                "description": "Where they are looking: `stockholm`, `gothenburg` or `malmo`, or the city the tenant typed in."
                              },
                              "teamSize": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Number of people."
                              },
                              "areaM2Min": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Smallest area in m²."
                              },
                              "areaM2Max": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Largest area in m²."
                              },
                              "moveIn": {
                                "type": "string",
                                "description": "When they want to move in: `asap`, `1-3m`, `3-6m` or `6+m` (months from the request)."
                              },
                              "term": {
                                "type": "string",
                                "description": "How long they want to stay: `flexible`, `6-12m`, `1-2y` or `2+y`."
                              }
                            },
                            "required": [
                              "city",
                              "teamSize",
                              "areaM2Min",
                              "areaM2Max",
                              "moveIn",
                              "term"
                            ],
                            "additionalProperties": false,
                            "description": "What the tenant asked for. The listed codes are the current ones; treat an unknown value as free text."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "createdAt",
                          "statusChangedAt",
                          "expiresAt",
                          "number",
                          "reference",
                          "replyAddress",
                          "url",
                          "listing",
                          "tenant",
                          "request"
                        ],
                        "additionalProperties": false,
                        "description": "A tenant's interest in one of your listings."
                      },
                      "message": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the message."
                          },
                          "body": {
                            "type": "string",
                            "description": "The text as the tenant sees it; empty when only files were sent. Viewing times read from a mail are left out of it, since the tenant gets them as a pick-a-time card (`deal.viewing_proposed`)."
                          },
                          "attachments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "description": "File name."
                                },
                                "mimeType": {
                                  "type": "string",
                                  "description": "MIME type."
                                },
                                "size": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "description": "Size in bytes."
                                }
                              },
                              "required": [
                                "name",
                                "mimeType",
                                "size"
                              ],
                              "additionalProperties": false
                            },
                            "description": "Attached files that reached the chat."
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                            "description": "When it was sent."
                          },
                          "via": {
                            "type": "string",
                            "enum": [
                              "app",
                              "email",
                              "api"
                            ],
                            "description": "Where it was written: `app` in Shace, `email` by a mail to the reply address, `api` with `POST /deals/{id}/accept`."
                          },
                          "from": {
                            "type": "object",
                            "properties": {
                              "email": {
                                "type": "string",
                                "format": "email",
                                "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
                                "description": "The member's email in your organization."
                              },
                              "name": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ],
                                "description": "Their name in Shace, when known."
                              }
                            },
                            "required": [
                              "email",
                              "name"
                            ],
                            "additionalProperties": false,
                            "description": "Who wrote it."
                          }
                        },
                        "required": [
                          "id",
                          "body",
                          "attachments",
                          "createdAt",
                          "via",
                          "from"
                        ],
                        "additionalProperties": false,
                        "description": "The message from your side."
                      }
                    },
                    "required": [
                      "deal",
                      "message"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "deal.message_sent",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "deal": {
                    "id": "3f6b1d2e-8c47-4a0e-9f5d-7b2c1e4a9d30",
                    "status": "accepted",
                    "createdAt": "2026-09-24T09:12:40.118Z",
                    "statusChangedAt": "2026-09-24T13:40:02.517Z",
                    "expiresAt": null,
                    "number": 1042,
                    "reference": "VAS-1042",
                    "replyAddress": "vas-1042@chat.shace.se",
                    "url": "https://www.shace.se/chats/5d2e8f1a-3b7c-4e9d-a6f0-1c4b8e2d7a93",
                    "listing": {
                      "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                      "externalRef": "unit-4711",
                      "metadata": {
                        "responsibleId": "E-4411"
                      }
                    },
                    "tenant": {
                      "companyName": "Lumen Design AB",
                      "orgNumber": "5591234567",
                      "country": "SE",
                      "underRegistration": false,
                      "description": null
                    },
                    "request": {
                      "city": "stockholm",
                      "teamSize": "8",
                      "areaM2Min": "100",
                      "areaM2Max": "150",
                      "moveIn": "1-3m",
                      "term": "1-2y"
                    }
                  },
                  "message": {
                    "id": "7b6a5c4d-3e2f-4a1b-9c8d-0e1f2a3b4c5d",
                    "body": "Hej! Torsdag kl 10 passar bra. Portkoden är 1430.",
                    "attachments": [
                      {
                        "name": "planritning.pdf",
                        "mimeType": "application/pdf",
                        "size": 184320
                      }
                    ],
                    "createdAt": "2026-09-24T14:20:31.000Z",
                    "via": "email",
                    "from": {
                      "email": "anna@landlord.se",
                      "name": "Anna Lind"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "listing.status_changed": {
      "post": {
        "operationId": "listingStatusChangedEvent",
        "summary": "Listing went live or came off the market",
        "description": "One of your pushed listings changed status, whoever changed it: your own push, someone in Shace, or Shace support. Use it to keep your publish flag in step. A first push that creates a listing sends no event; its status is in the response.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "listing.status_changed",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "listing": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                            "description": "Shace id of the listing."
                          },
                          "externalRef": {
                            "type": "string",
                            "description": "Your reference for the listing."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "published",
                              "unpublished"
                            ],
                            "description": "The listing's status now."
                          },
                          "publishBlockers": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "images",
                                "price",
                                "noticePeriod"
                              ]
                            },
                            "description": "What keeps it from going live; empty when nothing does."
                          },
                          "metadata": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "type": "string"
                            },
                            "description": "The `metadata` you pushed on the listing."
                          }
                        },
                        "required": [
                          "id",
                          "externalRef",
                          "status",
                          "publishBlockers",
                          "metadata"
                        ],
                        "additionalProperties": false,
                        "description": "Your listing as it is now."
                      },
                      "previousStatus": {
                        "type": "string",
                        "enum": [
                          "published",
                          "unpublished"
                        ],
                        "description": "The status before the change."
                      }
                    },
                    "required": [
                      "listing",
                      "previousStatus"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "listing.status_changed",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "listing": {
                    "id": "5c1c8f0e-6a3b-4a4c-9a3e-2b7f0d9a1e11",
                    "externalRef": "unit-4711",
                    "status": "unpublished",
                    "publishBlockers": [],
                    "metadata": {
                      "responsibleId": "E-4411"
                    }
                  },
                  "previousStatus": "published"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. Anything else is retried."
          }
        }
      }
    },
    "webhook.test": {
      "post": {
        "operationId": "webhookTestEvent",
        "summary": "Test",
        "description": "Sent by `POST /webhooks/{id}/test` or the dashboard's test button to that endpoint only, once, without retries.",
        "security": [],
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "The event id; the same on every retry of the event.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "When this attempt was sent, in Unix seconds.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `<webhook-id>.<webhook-timestamp>.<body>`, keyed with your endpoint secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "Event id, also sent as the `webhook-id` header. The same event is retried with the same id, so use it to drop duplicates."
                  },
                  "type": {
                    "type": "string",
                    "const": "webhook.test",
                    "description": "The event type, for example `deal.created`."
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                    "description": "When the event happened."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "endpointId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                        "description": "The endpoint being tested."
                      }
                    },
                    "required": [
                      "endpointId"
                    ],
                    "additionalProperties": false,
                    "description": "The payload. What it holds depends on `type`."
                  }
                },
                "required": [
                  "id",
                  "type",
                  "createdAt",
                  "data"
                ],
                "additionalProperties": false
              },
              "example": {
                "id": "9a7c5e3b-1f2d-4b6a-8c0e-2d4f6a8b0c1e",
                "type": "webhook.test",
                "createdAt": "2026-09-24T09:12:40.130Z",
                "data": {
                  "endpointId": "b7e4c2a9-1d3f-4e6b-8a5c-9f0d2e7b4c16"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx within 10 seconds acknowledges the event. A test event is sent once and not retried."
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api-sandbox.shace.se/partner/v1",
      "description": "Sandbox"
    },
    {
      "url": "https://api.shace.se/partner/v1",
      "description": "Production"
    }
  ]
}
