{
  "openapi": "3.1.0",
  "info": {
    "title": "Community Auto Repair public inquiry API",
    "version": "1.0.0",
    "description": "Customer-authorized inquiries only. No appointment, repair approval, date, or price is confirmed. No registration or identity-based privileges. Default limits: 30 attempts/minute/IP and five accepted inquiries/rolling hour per normalized email or phone. No public inquiry lookup. Do not send VINs, attachments, payment information, or sensitive records."
  },
  "servers": [
    {
      "url": "https://communityautorepair.us"
    }
  ],
  "paths": {
    "/api/v1/business": {
      "get": {
        "operationId": "getBusiness",
        "summary": "Read verified business facts and current intake availability",
        "responses": {
          "200": {
            "description": "Public facts. acceptingInquiries reflects runtime availability",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "name",
                    "status",
                    "services",
                    "capabilities",
                    "acceptingInquiries"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "preopening",
                        "open"
                      ]
                    },
                    "acceptingInquiries": {
                      "type": "boolean"
                    },
                    "services": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "capabilities": {
                      "type": "object"
                    },
                    "inquiry": {
                      "type": "object"
                    },
                    "limits": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/inquiries": {
      "post": {
        "operationId": "submitInquiry",
        "summary": "Submit one customer-authorized inquiry",
        "description": "Use the same key and normalized fields on retries. Reuse with different content returns 409. Consent means the customer authorized contact about this inquiry. Receipt has no customer details. Do not interpret received as booked.",
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 16,
              "maxLength": 100,
              "pattern": "^[A-Za-z0-9_-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "name",
                  "preferredContact",
                  "message",
                  "consent"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "email",
                    "maxLength": 254
                  },
                  "phone": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 32
                  },
                  "preferredContact": {
                    "type": "string",
                    "enum": [
                      "email",
                      "phone"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000
                  },
                  "vehicleYear": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 1900,
                    "maximum": 2028
                  },
                  "vehicleMake": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 80
                  },
                  "vehicleModel": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 80
                  },
                  "consent": {
                    "const": true
                  }
                },
                "description": "Provide at least the contact selected by preferredContact. Optional empty fields may be omitted or null. Permission must come from the customer."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original receipt for an idempotent retry",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "reference",
                    "status",
                    "message"
                  ],
                  "properties": {
                    "reference": {
                      "type": "string",
                      "pattern": "^CAR-[a-f0-9-]{36}$"
                    },
                    "status": {
                      "const": "received"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Stored with a durable notification job",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "reference",
                    "status",
                    "message"
                  ],
                  "properties": {
                    "reference": {
                      "type": "string",
                      "pattern": "^CAR-[a-f0-9-]{36}$"
                    },
                    "status": {
                      "const": "received"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or missing/invalid idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Browser Origin rejected",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Key already used with different normalized details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Maximum payload is 16384 bytes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "Unsupported content type",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Correct the field validation errors",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. Wait Retry-After seconds before retrying",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds until retry",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "Intake unavailable or temporary failure. Retry same key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "fields": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}