Skip to main content

Email yourself a preview of the quote

POST/api/v1/quotes/{id}/preview

Emails the quote as the customer would get it, with the same note, link and PDF, to the email address of the member making the request and to nobody else, with "Preview" at the start of the subject. The quote is left as it is: a draft stays a draft, nothing is recorded as sent, and it is not listed among the customer's messages. message and valid_until are previewed as sendQuote would send them. Errors: 409 invalid_transition for a declined quote; 422 quote_has_no_items; 422 message_too_long. It counts towards the 100 emails a day that sendQuote and sendInvoice share.

  • 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 previewQuote.

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.

  • messagestring or null

    Replaces the default email text (`email_message` on the quote).

    Up to 2000 characters.

  • valid_untilstring (date)

    A new last day for the quote, previewed as sendQuote would set it. Ignored once the quote is accepted.

Responses

200Where the preview went.

  • dataobjectrequired

    Fields(1)
    • sent_tostring (email)required

      The address the preview was emailed to.

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/quotes/7b5058e5-2d85-572f-8904-aff17cc66328/preview" \
  -H "Authorization: Bearer $TRADESENDER_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "Here is the quote for the hedge and borders we talked about. [Link]"
}'