{
  "openapi": "3.1.0",
  "info": {
    "title": "XA Security API",
    "version": "1.0.0",
    "summary": "Published prices, staffing estimates and patrol route checks for XA Security, Calgary and Edmonton.",
    "description": "Read-only public API for XA Security, a licensed security company in Calgary and Edmonton, Alberta. It returns the published price list, prices guard, parking and stage crew shifts with the same rate book as the calculator at https://xasecurity.ca/pricing, and says what a mobile patrol stop costs at a Calgary postal code.\n\n**Authentication:** none. Every endpoint is public and needs no key.\n\n**Safe to call:** nothing writes, books or stores anything, so there is no separate sandbox: production is safe to experiment with. Estimates are not bookings; a person at XA reviews every request sent from the website and sends a final binding estimate.\n\n**Errors:** RFC 9457 problem details (`application/problem+json`) with a stable `code`, the offending `field` where there is one, and a `hint`.\n\n**Rate limits:** 120 requests a minute per client (30 for patrol route checks). Every response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`; a 429 adds `Retry-After`.\n\n**Versioning:** the major version is in the path (`/api/v1`). Additive changes (new fields, new endpoints) can ship in v1 at any time, so ignore fields you don't know. A breaking change ships as `/api/v2`; v1 then answers with `Deprecation` and `Sunset` headers for at least 6 months before it is removed.\n\n**Also available:** the same operations as MCP tools at https://xasecurity.ca/mcp, and the site's pages as Markdown (see https://xasecurity.ca/llms.txt).",
    "termsOfService": "https://xasecurity.ca/pages/terms-conditions",
    "contact": {
      "name": "XA Security",
      "url": "https://xasecurity.ca/developers",
      "email": "dispatch@xasecurity.ca"
    }
  },
  "externalDocs": {
    "description": "Developer guide",
    "url": "https://xasecurity.ca/developers"
  },
  "servers": [
    {
      "url": "https://xasecurity.ca/api/v1",
      "description": "Production (read-only, safe to call)"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "Prices",
      "description": "Published prices"
    },
    {
      "name": "Estimates",
      "description": "Price shifts with the rate book"
    },
    {
      "name": "Mobile patrol",
      "description": "Calgary patrol route"
    }
  ],
  "paths": {
    "/prices": {
      "get": {
        "operationId": "getPrices",
        "tags": [
          "Prices"
        ],
        "summary": "Get every published price",
        "description": "The full published price list: hourly rates for every guard, parking and stage crew role, mobile patrol stop prices, monitored camera plans and fees, and the terms that apply (minimums, overtime, holidays, GST). Prices are CAD before GST.",
        "responses": {
          "200": {
            "description": "The price book.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceBook"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/roles": {
      "get": {
        "operationId": "listRoles",
        "tags": [
          "Prices"
        ],
        "summary": "List hourly roles",
        "description": "The hourly roles that can be booked, with their rates, a page at a time. Use a role's `id` in createEstimate.",
        "parameters": [
          {
            "name": "line",
            "in": "query",
            "required": false,
            "description": "Only roles in this service line.",
            "schema": {
              "type": "string",
              "enum": [
                "events",
                "property",
                "parking",
                "crew"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Roles per page, 1 to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "`next_cursor` from the previous page. Leave out for the first page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of roles.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RolePage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/estimates": {
      "post": {
        "operationId": "createEstimate",
        "tags": [
          "Estimates"
        ],
        "summary": "Estimate the cost of shifts",
        "description": "Prices shifts of guards, parking attendants or stage crew with the published rate book, as the /pricing calculator does: minimums, overtime, Alberta holidays, the short-notice premium and required supervisors are included. Returns line items and totals. Computes only: nothing is stored or booked, so retrying is always safe.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Any unique string, 1 to 255 characters. Echoed back. The same body always gives the same estimate, so retries are safe with or without it.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EstimateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The estimate.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Estimate"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "415": {
            "$ref": "#/components/responses/UnsupportedMediaType"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/patrol-route": {
      "get": {
        "operationId": "checkPatrolRoute",
        "tags": [
          "Mobile patrol"
        ],
        "summary": "Check the patrol stop price for a postal code",
        "description": "Says whether a site is on XA's Calgary patrol route and what a recurring scheduled guard stop costs there.",
        "parameters": [
          {
            "name": "postal_code",
            "in": "query",
            "required": true,
            "description": "Canadian postal code, e.g. T2G 4K9.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]\\d[A-Za-z] ?\\d[A-Za-z]\\d$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The patrol price for that postal code.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatrolPrice"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    }
  },
  "components": {
    "headers": {
      "RateLimit-Limit": {
        "description": "Requests allowed per minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in this minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The request is not valid; `field` and `detail` say what to fix.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limited. Wait `Retry-After` seconds.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "UnsupportedMediaType": {
        "description": "Send the body as application/json.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimit-Limit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimit-Remaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimit-Reset"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details.",
        "required": [
          "type",
          "title",
          "status",
          "code",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "Documentation for this error."
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "enum": [
              "invalid_request",
              "invalid_json",
              "not_found",
              "method_not_allowed",
              "unsupported_media_type",
              "rate_limited",
              "upstream_unavailable"
            ],
            "description": "Stable, machine-readable error code."
          },
          "detail": {
            "type": "string",
            "description": "What went wrong, in words."
          },
          "reason": {
            "type": "string",
            "description": "Finer-grained cause, e.g. unknown_role or invalid_shift."
          },
          "field": {
            "type": "string",
            "description": "The input to fix, e.g. shifts[0].role."
          },
          "hint": {
            "type": "string",
            "description": "How to fix it."
          }
        }
      },
      "HourlyRole": {
        "type": "object",
        "required": [
          "id",
          "name",
          "line",
          "line_name",
          "hourly_rate",
          "minimum_hours",
          "supervisory",
          "description"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "esg",
              "ess",
              "esd",
              "ert",
              "esm",
              "sg",
              "stl",
              "mp",
              "msup",
              "pa",
              "ps",
              "sh",
              "fs",
              "cc"
            ],
            "description": "Use in createEstimate."
          },
          "name": {
            "type": "string"
          },
          "line": {
            "type": "string",
            "enum": [
              "events",
              "property",
              "parking",
              "crew"
            ]
          },
          "line_name": {
            "type": "string"
          },
          "hourly_rate": {
            "type": "number",
            "description": "CAD, before GST."
          },
          "minimum_hours": {
            "type": "number",
            "description": "Minimum billed hours a person per shift."
          },
          "supervisory": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "RolePage": {
        "type": "object",
        "required": [
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HourlyRole"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page; null on the last page."
          }
        }
      },
      "PriceBook": {
        "type": "object",
        "required": [
          "currency",
          "prices_include_gst",
          "gst_rate",
          "rate_card_version",
          "hourly_roles",
          "mobile_patrol",
          "monitored_cameras",
          "terms",
          "estimate_note",
          "links"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "const": "CAD"
          },
          "prices_include_gst": {
            "type": "boolean",
            "const": false
          },
          "gst_rate": {
            "type": "number",
            "const": 0.05
          },
          "rate_card_version": {
            "type": "string",
            "examples": [
              "2026-10-28"
            ]
          },
          "hourly_roles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/HourlyRole"
            }
          },
          "mobile_patrol": {
            "type": "object",
            "required": [
              "route_area",
              "recurring_stop_on_route",
              "recurring_stop_off_route",
              "one_off_stop",
              "note"
            ],
            "properties": {
              "route_area": {
                "type": "string"
              },
              "recurring_stop_on_route": {
                "type": "number",
                "description": "CAD, before GST."
              },
              "recurring_stop_off_route": {
                "type": "number",
                "description": "CAD, before GST."
              },
              "one_off_stop": {
                "type": "number",
                "description": "CAD, before GST."
              },
              "note": {
                "type": "string"
              }
            }
          },
          "monitored_cameras": {
            "type": "object",
            "required": [
              "minimum_term_months",
              "plans",
              "fees",
              "note"
            ],
            "properties": {
              "minimum_term_months": {
                "type": "integer"
              },
              "plans": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "camera",
                    "tier",
                    "monthly_price"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "camera": {
                      "type": "string",
                      "enum": [
                        "Docklight",
                        "Lookout"
                      ]
                    },
                    "tier": {
                      "type": "string"
                    },
                    "monthly_price": {
                      "type": "number",
                      "description": "CAD, before GST."
                    }
                  }
                }
              },
              "fees": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "description": "CAD, before GST."
                }
              },
              "note": {
                "type": "string"
              }
            }
          },
          "terms": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "title",
                "text"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "estimate_note": {
            "type": "string"
          },
          "links": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "Shift": {
        "type": "object",
        "description": "One role, on one day, from one start time. Several days means several shifts.",
        "required": [
          "role",
          "people",
          "date",
          "start_time",
          "hours"
        ],
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "esg",
              "ess",
              "esd",
              "ert",
              "esm",
              "sg",
              "stl",
              "mp",
              "msup",
              "pa",
              "ps",
              "sh",
              "fs",
              "cc"
            ],
            "description": "esg Event Security Guard, ess Event Security Supervisor, esd Event Dispatcher, ert Event Response Team, esm Event Security Manager, sg Security Guard, stl Security Team Lead, mp Mobile Patrol, msup Mobile Supervisor, pa Parking Attendant, ps Parking Supervisor, sh Stagehand, fs Followspot Operator, cc Stage Crew Chief"
          },
          "people": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200,
            "description": "How many people in this role."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Service date in Alberta, YYYY-MM-DD. Must be in the future."
          },
          "start_time": {
            "type": "string",
            "pattern": "^\\d{2}:\\d{2}$",
            "description": "24-hour local start time, HH:MM."
          },
          "hours": {
            "type": "number",
            "minimum": 1,
            "maximum": 24,
            "description": "Shift length in hours; the 4-hour minimum applies."
          }
        }
      },
      "EstimateRequest": {
        "type": "object",
        "required": [
          "area",
          "shifts"
        ],
        "properties": {
          "area": {
            "type": "string",
            "enum": [
              "calgary",
              "edmonton",
              "elsewhere"
            ],
            "description": "Where the site is. 'elsewhere' (other Alberta) excludes travel, which is quoted separately."
          },
          "shifts": {
            "type": "array",
            "minItems": 1,
            "maxItems": 60,
            "items": {
              "$ref": "#/components/schemas/Shift"
            }
          }
        },
        "examples": [
          {
            "area": "calgary",
            "shifts": [
              {
                "role": "esg",
                "people": 4,
                "date": "2027-03-14",
                "start_time": "18:00",
                "hours": 6
              }
            ]
          }
        ]
      },
      "Estimate": {
        "type": "object",
        "required": [
          "currency",
          "area",
          "lines",
          "subtotal_before_gst",
          "gst",
          "total",
          "billed_hours",
          "holidays",
          "short_notice_premium",
          "travel_not_included",
          "volume_rates_possible",
          "notes",
          "rate_card_version",
          "disclaimer",
          "next_step"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "const": "CAD"
          },
          "area": {
            "type": "string",
            "enum": [
              "calgary",
              "edmonton",
              "elsewhere"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "label",
                "detail",
                "amount"
              ],
              "properties": {
                "label": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                },
                "amount": {
                  "type": "number",
                  "description": "CAD, before GST."
                }
              }
            }
          },
          "subtotal_before_gst": {
            "type": "number",
            "description": "CAD, before GST."
          },
          "gst": {
            "type": "number"
          },
          "total": {
            "type": "number",
            "description": "CAD including GST."
          },
          "billed_hours": {
            "type": "number"
          },
          "holidays": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "date",
                "name",
                "factor"
              ],
              "properties": {
                "date": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "factor": {
                  "type": "number"
                }
              }
            }
          },
          "short_notice_premium": {
            "type": "boolean",
            "description": "True when a shift starts within 48 hours (50% premium)."
          },
          "travel_not_included": {
            "type": "boolean"
          },
          "volume_rates_possible": {
            "type": "boolean"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rate_card_version": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          },
          "next_step": {
            "type": "string"
          }
        }
      },
      "PatrolPrice": {
        "type": "object",
        "required": [
          "postal_code",
          "on_route",
          "recurring_stop_price",
          "one_off_stop_price",
          "currency",
          "summary"
        ],
        "properties": {
          "postal_code": {
            "type": "string"
          },
          "on_route": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "null when the postal code couldn't be placed."
          },
          "recurring_stop_price": {
            "type": [
              "number",
              "null"
            ],
            "description": "CAD before GST, per stop."
          },
          "one_off_stop_price": {
            "type": "number",
            "description": "CAD, before GST."
          },
          "currency": {
            "type": "string",
            "const": "CAD"
          },
          "summary": {
            "type": "string"
          }
        }
      }
    }
  }
}