{
  "openapi": "3.1.0",
  "info": {
    "title": "HaulCommand developer API",
    "version": "2026-10-25",
    "description": "The HaulCommand MCP server, the OAuth 2.1 sign-in in front of it, and the online booking routes. A service-account key works only on the MCP address."
  },
  "servers": [
    {
      "url": "https://api.haulcommand.ai"
    }
  ],
  "tags": [
    {
      "name": "mcp",
      "description": "MCP server"
    },
    {
      "name": "oauth",
      "description": "Sign-in (OAuth 2.1 with PKCE)"
    },
    {
      "name": "booking",
      "description": "Online booking"
    }
  ],
  "paths": {
    "/mcp/v1/{locationSlug}": {
      "servers": [
        {
          "url": "https://mcp.haulcommand.ai"
        }
      ],
      "post": {
        "operationId": "mcp.call",
        "tags": [
          "mcp"
        ],
        "summary": "Send one MCP message to a location: initialize, tools/list, tools/call or ping.",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "locationSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/McpJsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "operationId": "oauth.metadata",
        "tags": [
          "oauth"
        ],
        "summary": "The sign-in server’s details (RFC 8414).",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "operationId": "oauth.resource",
        "tags": [
          "oauth"
        ],
        "summary": "Which sign-in server guards a location’s MCP address (RFC 9728).",
        "parameters": [
          {
            "name": "location",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/mcp/oauth/register": {
      "post": {
        "operationId": "oauth.register",
        "tags": [
          "oauth"
        ],
        "summary": "Register a client (RFC 7591). A registered client holds no tools until a person approves it.",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OAuthRegisterRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthRegisterResponse"
                }
              }
            }
          }
        }
      }
    },
    "/mcp/oauth/authorize": {
      "get": {
        "operationId": "oauth.authorize",
        "tags": [
          "oauth"
        ],
        "summary": "Start sign-in with PKCE. The browser goes to the consent page.",
        "parameters": [
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "response_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "code"
              ]
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 43,
              "maxLength": 128
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "S256"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Success"
          }
        }
      }
    },
    "/mcp/oauth/token": {
      "post": {
        "operationId": "oauth.token",
        "tags": [
          "oauth"
        ],
        "summary": "Trade a code, or a refresh token, for an access token.",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/OAuthTokenRequest"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OAuthTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthTokenResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/order/{slug}": {
      "get": {
        "operationId": "booking.page",
        "tags": [
          "booking"
        ],
        "summary": "A location’s order page data: services, sizes and prices.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "zip",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{3,10}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/public/order/{slug}/availability": {
      "get": {
        "operationId": "booking.availability",
        "tags": [
          "booking"
        ],
        "summary": "The days a location can deliver.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30,
              "default": 14
            }
          },
          {
            "name": "asset_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/public/order/{slug}/quote": {
      "get": {
        "operationId": "booking.quote",
        "tags": [
          "booking"
        ],
        "summary": "The total for a container and material, tax included where it is set up.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "zip",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3
            }
          },
          {
            "name": "container_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "material",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunnelQuote"
                }
              }
            }
          }
        }
      }
    },
    "/public/order/{slug}/quote-request": {
      "post": {
        "operationId": "booking.quote_request",
        "tags": [
          "booking"
        ],
        "summary": "Ask for a quote instead of booking.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicQuoteRequestDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success"
          }
        }
      }
    },
    "/public/order/{slug}/email-code": {
      "post": {
        "operationId": "booking.email_code",
        "tags": [
          "booking"
        ],
        "summary": "Email a code to the customer’s address. The order carries it back to prove the email.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendOrderEmailCodeDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/public/order/{slug}/submit": {
      "post": {
        "operationId": "booking.submit",
        "tags": [
          "booking"
        ],
        "summary": "Place an order, with the code emailed to the customer.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitOrderBody"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "FunnelQuote": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "minLength": 1
          },
          "subtotal_cents": {
            "type": "integer",
            "minimum": 0
          },
          "tax": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "state": {
                    "const": "computed"
                  },
                  "tax_cents": {
                    "type": "integer",
                    "minimum": 0
                  }
                },
                "required": [
                  "state",
                  "tax_cents"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "state": {
                    "const": "not_registered"
                  }
                },
                "required": [
                  "state"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "state": {
                    "const": "not_computed"
                  },
                  "reason": {
                    "type": "string",
                    "enum": [
                      "connect_unavailable",
                      "address_unknown",
                      "tax_codes_unconfigured",
                      "no_taxable_lines",
                      "no_registrations"
                    ]
                  }
                },
                "required": [
                  "state",
                  "reason"
                ]
              }
            ]
          },
          "total_cents": {
            "type": "integer",
            "minimum": 0
          },
          "tax_inclusive": {
            "type": "boolean"
          },
          "zone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string",
                  "minLength": 1
                },
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "kind",
                "description",
                "amount_cents"
              ]
            }
          }
        },
        "required": [
          "currency",
          "subtotal_cents",
          "tax",
          "total_cents",
          "tax_inclusive",
          "zone",
          "lines"
        ]
      },
      "McpJsonRpcRequest": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              }
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "initialize",
              "tools/list",
              "tools/call",
              "ping"
            ]
          },
          "params": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "jsonrpc",
          "id",
          "method"
        ]
      },
      "OAuthRegisterRequest": {
        "type": "object",
        "properties": {
          "client_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "type": "string"
                },
                {
                  "type": "string",
                  "maxLength": 512
                }
              ]
            },
            "minItems": 1,
            "maxItems": 8
          },
          "token_endpoint_auth_method": {
            "const": "none"
          },
          "grant_types": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "authorization_code",
                "refresh_token"
              ]
            }
          },
          "response_types": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "code"
              ]
            }
          },
          "scope": {
            "type": "string"
          }
        },
        "required": [
          "client_name",
          "redirect_uris"
        ]
      },
      "OAuthRegisterResponse": {
        "type": "object",
        "properties": {
          "client_id": {
            "type": "string",
            "minLength": 1
          },
          "client_name": {
            "type": "string",
            "minLength": 1
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint_auth_method": {
            "const": "none"
          },
          "grant_types": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "authorization_code",
                "refresh_token"
              ]
            }
          },
          "response_types": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "code"
              ]
            }
          },
          "scope": {
            "const": ""
          }
        },
        "required": [
          "client_id",
          "client_name",
          "redirect_uris",
          "token_endpoint_auth_method",
          "grant_types",
          "response_types",
          "scope"
        ]
      },
      "OAuthTokenRequest": {
        "type": "object",
        "properties": {
          "grant_type": {
            "type": "string",
            "enum": [
              "authorization_code",
              "refresh_token"
            ]
          },
          "code": {
            "type": "string",
            "minLength": 1
          },
          "refresh_token": {
            "type": "string",
            "minLength": 1
          },
          "redirect_uri": {
            "type": "string"
          },
          "client_id": {
            "type": "string",
            "minLength": 1
          },
          "code_verifier": {
            "type": "string",
            "minLength": 43,
            "maxLength": 128
          }
        },
        "required": [
          "grant_type",
          "client_id"
        ]
      },
      "OAuthTokenResponse": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string",
            "minLength": 1
          },
          "token_type": {
            "const": "Bearer"
          },
          "expires_in": {
            "type": "integer",
            "exclusiveMinimum": 0
          },
          "refresh_token": {
            "type": "string",
            "minLength": 1
          },
          "scope": {
            "type": "string"
          }
        },
        "required": [
          "access_token",
          "token_type",
          "expires_in",
          "scope"
        ]
      },
      "PublicQuoteRequestDto": {
        "type": "object",
        "properties": {
          "job_type": {
            "type": "string",
            "minLength": 1
          },
          "asset_type": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "requested_date": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "contact": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "email": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "email"
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null
              },
              "phone": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 7,
                    "maxLength": 32
                  },
                  {
                    "type": "null"
                  }
                ],
                "default": null
              }
            },
            "required": [
              "name"
            ],
            "additionalProperties": false
          },
          "service_address": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 400
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "notes": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 2000
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "cadence": {
            "anyOf": [
              {
                "allOf": [
                  {
                    "type": "string",
                    "minLength": 1
                  },
                  {
                    "type": "string",
                    "enum": [
                      "FREQ=WEEKLY",
                      "FREQ=WEEKLY;INTERVAL=2",
                      "FREQ=MONTHLY"
                    ]
                  }
                ]
              },
              {
                "type": "null"
              }
            ],
            "default": null
          }
        },
        "required": [
          "job_type",
          "contact"
        ],
        "additionalProperties": false
      },
      "SendOrderEmailCodeDto": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false
      },
      "SubmitOrderBody": {
        "type": "object",
        "properties": {
          "zip": {
            "type": "string",
            "minLength": 3
          },
          "container_type": {
            "type": "string",
            "minLength": 1
          },
          "material": {
            "type": "string",
            "minLength": 1
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "address": {
            "type": "string",
            "minLength": 3
          },
          "name": {
            "type": "string",
            "minLength": 1
          },
          "phone": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "email": {
            "anyOf": [
              {
                "type": "string",
                "format": "email"
              },
              {
                "type": "null"
              }
            ],
            "default": null
          },
          "sms_consent": {
            "type": "boolean"
          },
          "agreement_accepted": {
            "type": "boolean",
            "default": false
          },
          "agreement_signature": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              }
            },
            "required": [
              "name"
            ]
          },
          "agreement_disclosure_ref": {
            "const": "2026-10-order-agreement-esign-v1"
          },
          "agreement_document_version": {
            "type": "integer",
            "minimum": 1
          },
          "card_on_file_consent": {
            "type": "boolean"
          },
          "po_number": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ]
          },
          "custom": {
            "type": "object",
            "additionalProperties": {},
            "default": {}
          },
          "submission_attempt_id": {
            "type": "string",
            "format": "uuid"
          },
          "site_pin": {
            "type": "object",
            "properties": {
              "lat": {
                "type": "number",
                "minimum": -90,
                "maximum": 90
              },
              "lng": {
                "type": "number",
                "minimum": -180,
                "maximum": 180
              }
            },
            "required": [
              "lat",
              "lng"
            ]
          },
          "attribution": {
            "type": "object"
          },
          "order_form_version": {
            "type": "integer"
          },
          "email_code": {
            "type": "string",
            "pattern": "^\\d{6}$"
          }
        },
        "required": [
          "zip",
          "container_type",
          "material",
          "date",
          "address",
          "name",
          "sms_consent"
        ]
      }
    },
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "A service-account key, or an access token from the sign-in routes."
      }
    }
  }
}
