{
  "openapi": "3.1.0",
  "info": {
    "title": "Rezu Office API",
    "version": "v1",
    "description": "Machine API for a company's own systems (access control, ANPR camera bridges, ERP). Authenticate with an organization API key: `Authorization: Bearer rz_live_...`. Guide, webhook verification and retry semantics: https://getrezu.app/en/rezu-office-api"
  },
  "servers": [
    {
      "url": "https://neighbor-parking-backend.vercel.app/api",
      "description": "Production"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "rz_live_<32 base62 chars>",
        "description": "Organization API key created by a company admin. Scopes: read:roster, read:bookings, read:plates, write:gate-events, webhooks."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {}
            }
          }
        }
      },
      "RosterEntry": {
        "type": "object",
        "required": [
          "memberId",
          "displayName",
          "email",
          "role",
          "kind",
          "bookingId",
          "spotId",
          "spotLabel",
          "locationId"
        ],
        "properties": {
          "memberId": {
            "type": "string"
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string",
            "description": "Work e-mail the company invited the member with."
          },
          "role": {
            "type": "string",
            "enum": [
              "employee",
              "team_lead",
              "executive",
              "contractor"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "booking",
              "fixed"
            ]
          },
          "bookingId": {
            "type": [
              "string",
              "null"
            ]
          },
          "spotId": {
            "type": "string"
          },
          "spotLabel": {
            "type": "string"
          },
          "locationId": {
            "type": "string"
          },
          "plates": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Only with the read:plates scope. Uppercase, no spaces."
          }
        }
      },
      "Roster": {
        "type": "object",
        "required": [
          "date",
          "openDay",
          "entries"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "examples": [
              "2026-11-02"
            ]
          },
          "openDay": {
            "type": "boolean"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RosterEntry"
            }
          }
        }
      },
      "Booking": {
        "type": "object",
        "required": [
          "id",
          "date",
          "status",
          "source",
          "memberId",
          "spotId",
          "spotLabel",
          "locationId",
          "createdAt",
          "cancelledAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date",
            "examples": [
              "2026-11-02"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "confirmed",
              "cancelled",
              "released_no_show",
              "released_by_holder"
            ]
          },
          "source": {
            "type": "string"
          },
          "memberId": {
            "type": "string"
          },
          "spotId": {
            "type": "string"
          },
          "spotLabel": {
            "type": "string"
          },
          "locationId": {
            "type": "string"
          },
          "createdAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cancelledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "BookingPage": {
        "type": "object",
        "required": [
          "bookings",
          "nextCursor"
        ],
        "properties": {
          "bookings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Booking"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Spots": {
        "type": "object",
        "required": [
          "locations",
          "spots"
        ],
        "properties": {
          "locations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "address": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "active": {
                  "type": "boolean"
                }
              }
            }
          },
          "spots": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "locationId": {
                  "type": "string"
                },
                "level": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "zone": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "standard",
                    "ev",
                    "accessible"
                  ]
                },
                "active": {
                  "type": "boolean"
                },
                "fixedHolderMemberId": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "Me": {
        "type": "object",
        "properties": {
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "apiKey": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "prefix": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "today": {
            "type": "string",
            "format": "date",
            "examples": [
              "2026-11-02"
            ]
          }
        }
      },
      "GateEventRequest": {
        "type": "object",
        "required": [
          "gateId"
        ],
        "description": "Either `plate` or `memberId` is required.",
        "properties": {
          "gateId": {
            "type": "string",
            "maxLength": 64
          },
          "plate": {
            "type": "string",
            "maxLength": 20,
            "description": "Any formatting; normalized to uppercase without separators."
          },
          "memberId": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time",
            "description": "Default: now. Must be within the last 24 hours."
          },
          "idempotencyKey": {
            "type": "string",
            "maxLength": 128,
            "description": "Alternative to the Idempotency-Key header."
          }
        }
      },
      "GateEventResponse": {
        "type": "object",
        "required": [
          "gateEventId",
          "gateId",
          "occurredAt",
          "date",
          "decision",
          "hasValidBooking",
          "reason",
          "member",
          "booking",
          "spot",
          "replayed"
        ],
        "properties": {
          "gateEventId": {
            "type": "string"
          },
          "gateId": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "date": {
            "type": "string",
            "format": "date",
            "examples": [
              "2026-11-02"
            ]
          },
          "decision": {
            "type": "string",
            "enum": [
              "allow",
              "deny"
            ]
          },
          "hasValidBooking": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "enum": [
              "booking",
              "fixed_spot",
              "no_booking",
              "unknown_plate",
              "unknown_member",
              "member_inactive"
            ]
          },
          "member": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              }
            }
          },
          "booking": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "date": {
                "type": "string",
                "format": "date",
                "examples": [
                  "2026-11-02"
                ]
              },
              "spotId": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "spot": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "locationId": {
                "type": "string"
              }
            }
          },
          "plate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Only with the read:plates scope."
          },
          "replayed": {
            "type": "boolean"
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          },
          "includePlates": {
            "type": "boolean"
          },
          "consecutiveFailures": {
            "type": "integer"
          },
          "disabledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "disabledReason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              null,
              "too_many_failures",
              "manual",
              "deleted"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventType": {
        "type": "string",
        "enum": [
          "booking.created",
          "booking.cancelled",
          "spot.released",
          "gate.entry"
        ]
      },
      "WebhookCreate": {
        "type": "object",
        "required": [
          "url",
          "eventTypes"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "https only, port 443 or 8443, must resolve to public addresses."
          },
          "eventTypes": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "includePlates": {
            "type": "boolean",
            "description": "Needs the read:plates scope."
          }
        }
      },
      "WebhookPatch": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "url": {
            "type": "string"
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "includePlates": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "disabled"
            ]
          }
        }
      },
      "Delivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "eventId": {
            "type": "string"
          },
          "eventType": {
            "$ref": "#/components/schemas/EventType"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "nextAttemptAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastAttemptAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastStatusCode": {
            "type": [
              "integer",
              "null"
            ]
          },
          "lastError": {
            "type": [
              "string",
              "null"
            ]
          },
          "deliveredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "apiVersion",
          "createdAt",
          "organization",
          "data"
        ],
        "description": "Body of every webhook POST, signed with the Rezu-Signature header.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Idempotent event id (evt_...). Deduplicate on it."
          },
          "type": {
            "$ref": "#/components/schemas/EventType"
          },
          "apiVersion": {
            "const": "v1"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "organization": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              }
            }
          },
          "data": {
            "type": "object"
          }
        }
      }
    }
  },
  "paths": {
    "/v1/office/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Key introspection",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [],
        "responses": {
          "200": {
            "description": "Organization and scopes of this key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/office/roster": {
      "get": {
        "operationId": "getRoster",
        "summary": "Who has a spot on a date",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "read:roster"
        ],
        "responses": {
          "200": {
            "description": "Roster.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Roster"
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "Default: today (Europe/Warsaw).",
            "schema": {
              "type": "string",
              "format": "date",
              "examples": [
                "2026-11-02"
              ]
            }
          },
          {
            "name": "locationId",
            "in": "query",
            "required": false,
            "description": "One location only.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/office/bookings": {
      "get": {
        "operationId": "listBookings",
        "summary": "Bookings in a date range",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "read:bookings"
        ],
        "responses": {
          "200": {
            "description": "A page of bookings ordered by (date, id).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BookingPage"
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "First day (inclusive).",
            "schema": {
              "type": "string",
              "format": "date",
              "examples": [
                "2026-11-02"
              ]
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "description": "Last day (inclusive), at most 62 days after from.",
            "schema": {
              "type": "string",
              "format": "date",
              "examples": [
                "2026-11-02"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filter.",
            "schema": {
              "type": "string",
              "enum": [
                "confirmed",
                "cancelled",
                "released_no_show",
                "released_by_holder"
              ]
            }
          },
          {
            "name": "locationId",
            "in": "query",
            "required": false,
            "description": "Filter.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 500
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "nextCursor of the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/office/spots": {
      "get": {
        "operationId": "listSpots",
        "summary": "Locations and spots",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "read:roster | read:bookings"
        ],
        "responses": {
          "200": {
            "description": "Locations and spots.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Spots"
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "locationId",
            "in": "query",
            "required": false,
            "description": "One location only.",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/office/gate-events": {
      "post": {
        "operationId": "postGateEvent",
        "summary": "Report a gate entry and get the decision",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "write:gate-events"
        ],
        "responses": {
          "200": {
            "description": "Replay of an earlier request with the same Idempotency-Key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GateEventResponse"
                }
              }
            }
          },
          "201": {
            "description": "Recorded; `gate.entry` emitted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GateEventResponse"
                }
              }
            }
          },
          "400": {
            "description": "`validation_error` (details.reason: invalid_plate, occurred_at_out_of_range, ...).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_key_reused`: same key, different request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GateEventRequest"
              }
            }
          }
        }
      }
    },
    "/v1/office/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "summary": "List webhook endpoints",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "webhooks"
        ],
        "responses": {
          "200": {
            "description": "Endpoints (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookEndpoint"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "summary": "Register a webhook endpoint",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "webhooks"
        ],
        "responses": {
          "201": {
            "description": "Created. `secret` is shown only here.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "endpoint": {
                      "$ref": "#/components/schemas/WebhookEndpoint"
                    },
                    "secret": {
                      "type": "string",
                      "examples": [
                        "whsec_..."
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`webhook_url_not_allowed` (details.reason) or `validation_error`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`webhook_endpoint_limit_reached` (max 10).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCreate"
              }
            }
          }
        }
      }
    },
    "/v1/office/webhooks/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "patch": {
        "operationId": "updateWebhook",
        "summary": "Update / re-enable an endpoint",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "webhooks"
        ],
        "responses": {
          "200": {
            "description": "Updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "endpoint": {
                      "$ref": "#/components/schemas/WebhookEndpoint"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "`webhook_url_not_allowed` or `validation_error`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPatch"
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Delete an endpoint",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "webhooks"
        ],
        "responses": {
          "200": {
            "description": "Deleted; pending deliveries are failed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/office/webhooks/{id}/deliveries": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "listWebhookDeliveries",
        "summary": "Delivery log of an endpoint",
        "security": [
          {
            "apiKey": []
          }
        ],
        "x-required-scopes": [
          "webhooks"
        ],
        "responses": {
          "200": {
            "description": "Newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deliveries": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Delivery"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "`api_key_invalid` (missing / unknown key) or `api_key_revoked`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`api_key_scope_missing` (details.required) or `org_suspended`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "`feature_disabled` (Rezu Office not enabled) or a resource-specific not-found code.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`rate_limited`: 120 requests per key per minute; 30 failed authentications per IP per 10 minutes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          }
        ]
      }
    }
  },
  "webhooks": {
    "booking.created": {
      "post": {
        "summary": "booking.created event",
        "parameters": [
          {
            "name": "Rezu-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + '.' + raw body)>"
          },
          {
            "name": "Rezu-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Rezu-Event-Type",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Rezu-Delivery-Attempt",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Any 2xx within 10 s acknowledges the delivery. Anything else (incl. redirects) is retried."
          }
        }
      }
    },
    "booking.cancelled": {
      "post": {
        "summary": "booking.cancelled event",
        "parameters": [
          {
            "name": "Rezu-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + '.' + raw body)>"
          },
          {
            "name": "Rezu-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Rezu-Event-Type",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Rezu-Delivery-Attempt",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Any 2xx within 10 s acknowledges the delivery. Anything else (incl. redirects) is retried."
          }
        }
      }
    },
    "spot.released": {
      "post": {
        "summary": "spot.released event",
        "parameters": [
          {
            "name": "Rezu-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + '.' + raw body)>"
          },
          {
            "name": "Rezu-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Rezu-Event-Type",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Rezu-Delivery-Attempt",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Any 2xx within 10 s acknowledges the delivery. Anything else (incl. redirects) is retried."
          }
        }
      }
    },
    "gate.entry": {
      "post": {
        "summary": "gate.entry event",
        "parameters": [
          {
            "name": "Rezu-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + '.' + raw body)>"
          },
          {
            "name": "Rezu-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Rezu-Event-Type",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Rezu-Delivery-Attempt",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "2XX": {
            "description": "Any 2xx within 10 s acknowledges the delivery. Anything else (incl. redirects) is retried."
          }
        }
      }
    }
  }
}
