Skip to main content

Create the draft quote for a completed assessment

POST/api/v1/visits/{id}/quote

Manager only. Requires the assessment lock_version. Returns the existing unarchived quote if already created; internal assessment notes are not copied into customer-facing quote text. A new quote's valid_until is 30 days from today. Archived quotes retain source_visit_id and may be replaced by a new draft.

  • Needs an API key, and runs with the access of the member who made the key.
  • Send an Idempotency-Key. The same key with the same request within 24 hours gives the first answer again and changes nothing.
  • A connected AI assistant can use it too, as createAssessmentQuote.

Parameters

In the address

  • idstring (uuid)required

Headers

  • Idempotency-Keystringrequired

    Unique user-scoped key for safely retrying this mutation for 24 hours.

    At least 1 character. Up to 200 characters.

Request body

Sent as application/json.

  • lock_versionintegerrequired

    At least 0.

Responses

201Quote details.

  • dataobjectrequired

    Fields(31)
    • lock_versionintegerrequired

      At least 0.

    • created_atstring (date-time)required

    • updated_atstring (date-time)required

    • idstring (uuid)required

    • source_visit_idstring (uuid) or null

      Assessment which produced this quote; retained when archived or converted to a job.

    • account_idstring (uuid)required

    • customer_idstring (uuid)required

    • property_idstring (uuid) or null

    • numberstringrequired

    • titlestringrequired

    • descriptionstring or null

    • statusstringrequired

      One of: draft, sent, accepted, declined.

    • expiredbooleanrequired

    • currencystringrequired

    • subtotal_centsinteger (int64)required

      Integer minor currency units, such as pence.

      At least 0.

    • discount_centsinteger (int64)required

      Integer minor currency units, such as pence.

      At least 0.

    • tax_centsinteger (int64)required

      Integer minor currency units, such as pence.

      At least 0.

    • total_centsinteger (int64)required

      Integer minor currency units, such as pence.

      At least 0.

    • deposit_centsinteger (int64)

      The deposit asked for when the quote is accepted, tax included; 0 when none is. Accepting the quote issues an invoice of `kind` `deposit` for it, which carries this quote's `quote_id`.

      At least 0.

    • valid_untilstring (date) or null

    • sent_atstring (date-time) or null

    • sent_to_emailstring (email) or null

      Where the quote was last emailed.

    • email_messagestring

      The note the quote is emailed with unless the sender edits it, from the account's template. [Link] and any placeholder without a value yet are filled in on sending.

    • public_urlstring (uri) or null

      The customer's link. Null while the quote is a draft or archived.

    • accepted_atstring (date-time) or null

    • accepted_by_namestring or null

    • accepted_by_emailstring (email) or null

    • declined_atstring (date-time) or null

    • termsstring or null

    • notesstring or null

    • itemsarray of objectrequired

      Each item(12)
      • idstring (uuid)required

      • service_idstring (uuid) or null

      • positionintegerrequired

      • descriptionstringrequired

      • quantitystringrequired

        Matches ^\d{1,9}(\.\d{1,3})?$.

      • unit_namestring or null

      • unit_price_centsinteger (int64)required

        Integer minor currency units, such as pence.

        At least 0.

      • tax_rate_basis_pointsintegerrequired

        At least 0. At most 10000.

      • tax_inclusivebooleanrequired

      • subtotal_centsinteger (int64)required

        Integer minor currency units, such as pence.

        At least 0.

      • tax_centsinteger (int64)required

        Integer minor currency units, such as pence.

        At least 0.

      • total_centsinteger (int64)required

        Integer minor currency units, such as pence.

        At least 0.

A refusal answers in the one error shape every operation shares.

Example

A request our own tests send. The ids are made up: put your own in their place.

curl -X POST "https://app.tradesender.co.uk/api/v1/visits/5450ec62-0eec-59fb-8bc1-a6c3c8ba1639/quote" \
  -H "Authorization: Bearer $TRADESENDER_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "lock_version": "1"
}'