Link Search Menu Expand Document

POST/HEAD/GET /v1/quotes/:quote_id/pdf

Once a quote is ready to be presented to a customer, you may build and download its PDF via the API. The PDF is also available via partners.poweredbyagile.com.

Unlike policy documents, the quote PDF is not built automatically. You first send a POST request to ask the system to build it. The PDF is created using a background job, so it is not immediately available after the POST. You may then send a HEAD request to the same url to see if the document is ready, and a GET request to retrieve a download url once it is.

In general, the PDF is available within a few seconds of the POST request. However, on occasion, the system might have a lot of jobs in the queue (after a bulk quote creation run, for example), and the document might take a bit longer before it is available.

Path params

quote_id – string, required

The UUID of the quote the required PDF belongs to. The quote id is the value of the id in the response from creating or retrieving a quote.

POST /v1/quotes/:quote_id/pdf

Requests that the quote PDF be built. The quote must be in a state where it can be presented to a customer. If it is, a 204 No Content is returned and the PDF will be built in the background. Otherwise a 422 Unprocessable Entry is returned and no PDF is built.

HEAD /v1/quotes/:quote_id/pdf

Will return a 404 Not Found if the quote PDF is not yet available, and a 204 No Content if the document is ready for download.

GET /v1/quotes/:quote_id/pdf

Will return a 404 Not Found if the quote PDF is not yet available, and a 200 OK if the document is ready for download.

Notes on url

The url returned by the GET request has an expiration of 30 seconds, so it is not possible to store the url for future use.

Response examples from GET requests


200 OK

{
    "url": "http://api.poweredbyagile.com/rails/active_storage/disk/----long-unique-token-----/Agile-Product-QNUMBER.pdf?content_type=application%2Fpdf&disposition=attachment%3B+filename%3D%22Agile-Product-QNUMBER.pdf%22%3B+filename%2A%3DUTF-8%27%27Agile-Product-QNUMBER.pdf"
}



404 Not Found

{
    "errors": {
        "base": "The PDF file is not yet available for download"
    }
}

Response example from POST request


422 Unprocessable Entry

{
    "errors": {
        "base": "A PDF cannot be created for this quote at this time."
    }
}