# SureQuote agent API

SureQuote gives guide prices for Australian home jobs (59 trades, from painting and plumbing to roofing and solar) and sends quote requests to matched local tradies. Homeowners pay nothing.

## Access

Open to any assistant acting for a homeowner. No sign-in, key or access code is needed: call the endpoints directly.

A partner SureQuote has given its own access code sends it as `Authorization: Bearer <code>` (or, over MCP, the optional `access_code` argument) for its own limits.

## Endpoints

- MCP (Streamable HTTP): `https://www.surequote.com.au/api/agent/mcp`
- OpenAPI: `https://www.surequote.com.au/api/agent/v1/openapi.json`

## Flow

1. `search_jobs`: describe the work in plain English and pick a `job_id`. If two results could both fit, ask the homeowner which they mean.
2. `get_job_estimate`: show the guide range and say what it assumed. Then ask the homeowner every question in `unanswered_price_questions` in one message. If they may want quotes, add the questions with `affects_price: false` (tradies use them) to that same message. Call again with `answers`.
3. `start_quote_request`: only when the homeowner asks for quotes and agrees to share their name, email and phone with the tradies who take the job (`consent: true`). Ask for contact details, suburb and how soon in one message. The postcode is optional when the suburb name is unique. SureQuote emails them a 6-digit code.
4. `confirm_quote_request`: pass the code the homeowner gives you, as `{"code": "123456"}`. Nothing reaches a tradie before this step.
5. `get_quote_request_status`: whether the request went through, and how many local tradies it was sent to. Tradies contact the homeowner directly.

6. `withdraw_quote_request` then `confirm_withdraw_quote_request`: when the homeowner wants to cancel a submitted request. SureQuote emails them a new 6-digit code; pass it to the confirm step. Tradies who already took the job may still contact them.
7. `send_feedback`: we're building SureQuote into the most useful way for AI assistants to price home jobs and hire tradies in Australia, so tell us if anything failed, was confusing or took more steps than it should, or what you'd add. We read every report. It costs no estimate or quote limit.

Answers and ranges: `affects_price` says whether another answer would move the range under the current answers. Ranges are national guides, at least 15% either side, so some answers leave the range unchanged; that is expected, not an error.

## Operations

Each example shows the REST body (path parameters filled into the URL) and the response. Over MCP, pass the same fields, path parameters included, as the tool arguments.

### search_jobs

`POST /api/agent/v1/jobs/search`

Find the SureQuote job that matches a plain-English description of Australian home work (for example "repaint two bedrooms" or "replace a hot water system"). Returns up to 5 jobs, best match first. Use a job_id with get_job_estimate.

Example: `POST /api/agent/v1/jobs/search`

```json
{
  "query": "repaint two bedrooms"
}
```

Response:

```json
{
  "jobs": [
    {
      "job_id": "280f3a5a-2bb0-4973-a9fb-a7247e0f9b36",
      "name": "Interior Painting",
      "trade": "Painting"
    }
  ]
}
```

### get_job_estimate

`POST /api/agent/v1/estimates`

Get a SureQuote guide price range (AUD) for one job, the questions that shape the price, and what drives the cost. Unanswered questions use a typical answer, listed as assumed_answer. A question with affects_price true moves the range under the current answers; ask the homeowner the questions in unanswered_price_questions and call again with their answers to tailor the range. Questions with affects_price false do not change the guide but help tradies quote: if the homeowner may want quotes, ask them in the same message. Ranges are deliberately wide (at least 15% either side) and national, so an answer can leave the range unchanged. This is a guide, not a quote.

Example: `POST /api/agent/v1/estimates`

```json
{
  "job_id": "280f3a5a-2bb0-4973-a9fb-a7247e0f9b36",
  "answers": {
    "rooms_count_band": 2
  }
}
```

Response:

```json
{
  "job": {
    "job_id": "280f3a5a-2bb0-4973-a9fb-a7247e0f9b36",
    "name": "Interior Painting",
    "trade": "Painting"
  },
  "estimate": {
    "low_aud": 1000,
    "high_aud": 2100,
    "currency": "AUD",
    "basis": "national_guide",
    "indicative_only": true
  },
  "price_factors": [
    "Rooms",
    "Surfaces"
  ],
  "questions": [
    {
      "key": "rooms_count_band",
      "question": "How many rooms need painting? (Include bedrooms, living areas, and hallways.)",
      "label": "Rooms",
      "type": "number",
      "affects_price": true,
      "options": [
        {
          "value": 1,
          "label": "1"
        },
        {
          "value": 2,
          "label": "2"
        },
        {
          "value": 3,
          "label": "3"
        }
      ],
      "answer": 2,
      "assumed_answer": null
    }
  ],
  "unanswered_price_questions": [
    "painting__surfaces_included"
  ],
  "job_page_url": "https://www.surequote.com.au/painting-services/jobs/painting-interior",
  "disclaimer": "A guide range from SureQuote for a typical job of this kind in Australia, not a quote. Prices vary by location, access and site conditions. Only a tradie who has seen the job can quote it.",
  "source": "SureQuote"
}
```

### start_quote_request

`POST /api/agent/v1/quote-requests`

Send the homeowner's job to SureQuote to get quotes from matched local tradies. Only call this when the homeowner has asked for quotes and agreed to share their name, email and phone with the tradies who take the job (set consent to true). Collect everything in one message: contact details, suburb, how soon, consent, and the job questions from get_job_estimate (pass their answers here). SureQuote emails the homeowner a 6-digit code; nothing is sent to tradies until you call confirm_quote_request with that code.

Example: `POST /api/agent/v1/quote-requests`

Header: `Idempotency-Key: sam-painting-2026-12-01` (reuse it when retrying; over MCP send it as `idempotency_key`).

```json
{
  "job_id": "280f3a5a-2bb0-4973-a9fb-a7247e0f9b36",
  "answers": {
    "rooms_count_band": 2
  },
  "contact": {
    "name": "Sam Taylor",
    "email": "sam@example.com",
    "phone": "0412 345 678"
  },
  "suburb": "Bondi",
  "postcode": "2026",
  "urgency": "normal",
  "notes": "Two bedrooms, walls only. Furniture can be moved out.",
  "consent": true
}
```

Response:

```json
{
  "request_id": "6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10",
  "status": "awaiting_confirmation",
  "confirmation": {
    "channel": "email",
    "sent_to": "sa***@example.com",
    "expires_in_minutes": 30
  },
  "estimate": {
    "low_aud": 1000,
    "high_aud": 2100,
    "currency": "AUD",
    "basis": "national_guide",
    "indicative_only": true
  },
  "next_step": "SureQuote emailed the homeowner a 6-digit code. Ask them for it, then call the confirm operation with it. Nothing is sent to tradies until then."
}
```

### confirm_quote_request

`POST /api/agent/v1/quote-requests/{request_id}/confirm`

Send a quote request to local tradies, using the 6-digit code SureQuote emailed the homeowner. Ask the homeowner for the code; never guess it. Five wrong codes end the request.

Example: `POST /api/agent/v1/quote-requests/6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10/confirm`

```json
{
  "code": "402642",
  "assistant": "Claude"
}
```

Response:

```json
{
  "request_id": "6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10",
  "status": "submitted",
  "next_step": "The request is with SureQuote. Matched local tradies can now see the job, and SureQuote has emailed the homeowner a confirmation with a link to follow it."
}
```

### get_quote_request_status

`GET /api/agent/v1/quote-requests/{request_id}`

Whether a quote request is waiting for the homeowner's code, has been sent to tradies, or has expired. A submitted request also returns tradies_matched: how many local tradies SureQuote has sent the job to so far. Tradies reply to the homeowner directly; quotes are not available through this API. Check when the homeowner asks, not on a loop.

Example: `GET /api/agent/v1/quote-requests/6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10`

Response:

```json
{
  "request_id": "6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10",
  "status": "submitted",
  "tradies_matched": 3
}
```

### withdraw_quote_request

`POST /api/agent/v1/quote-requests/{request_id}/withdraw`

Start withdrawing a quote request that was sent to tradies, when the homeowner no longer wants quotes. SureQuote emails the homeowner a 6-digit code; nothing changes until you call confirm_withdraw_quote_request with it. A request still waiting for its first code was never sent to tradies and expires on its own.

Example: `POST /api/agent/v1/quote-requests/6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10/withdraw`

Response:

```json
{
  "request_id": "6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10",
  "status": "awaiting_withdrawal_code",
  "confirmation": {
    "channel": "email",
    "sent_to": "sa***@example.com",
    "expires_in_minutes": 30
  },
  "next_step": "SureQuote emailed the homeowner a 6-digit code to withdraw this request. Ask them for it, then call confirm_withdraw_quote_request with it. The request stays open until then."
}
```

### confirm_withdraw_quote_request

`POST /api/agent/v1/quote-requests/{request_id}/withdraw/confirm`

Withdraw a quote request, using the 6-digit code SureQuote emailed the homeowner after withdraw_quote_request. Ask the homeowner for the code; never guess it. No more tradies can take the job once it is withdrawn; tradies who already took it may still contact the homeowner. Five wrong codes end the code; call withdraw_quote_request for a new one.

Example: `POST /api/agent/v1/quote-requests/6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10/withdraw/confirm`

```json
{
  "code": "402642"
}
```

Response:

```json
{
  "request_id": "6f1c2a4e-8d3b-4c55-9a1e-2b7d0c9e4f10",
  "status": "withdrawn",
  "next_step": "The request is withdrawn. No more tradies can take the job. Tradies who already took it may still contact the homeowner."
}
```

### send_feedback

`POST /api/agent/v1/feedback`

We're building SureQuote into the most useful way for AI assistants to price home jobs and hire tradies in Australia, so your feedback is welcome: report friction, a bug, a suggestion or something that worked well while using this API. Any caller may send it and it does not use estimate or quote limits. Describe what you tried and what happened. Do not include the homeowner's name, email, phone or address.

Example: `POST /api/agent/v1/feedback`

```json
{
  "kind": "friction",
  "message": "get_job_estimate did not say which questions change the price, so I asked the homeowner all of them.",
  "operation": "get_job_estimate",
  "agent_name": "Claude"
}
```

Response:

```json
{
  "feedback_id": "3b0e6a52-1c7d-4f2e-9a8b-5d4c3e2f1a09",
  "received": true,
  "next_step": "Thanks. SureQuote staff read agent feedback every week and use it to improve the API. No reply is sent, so carry on with the homeowner's task."
}
```

## Rules

- Ranges are guides for a typical job in Australia, not quotes. Only a tradie who has seen the job can quote it.
- Calls are rate limited per network address. A refused call says when to retry (`retry_after_seconds`).
- Errors are JSON: `{"error": {"code", "message", "retry_after_seconds"?, "details"?}}`.
