POST /v3/convert/{type} endpoint, PDFShift will return you a different set of response that depends on the parameters you provided.
This is important to take into consideration when developing your logic
Default response
By default, PDFShift will return the raw binary document (either a PDF, JPEG, PNG or WEBP).filename parameter
But if you pass the filename parameter, the result will be a JSON object and the binary data will be stored on an S3 storage.
Here’s a sample of the JSON response:
The
pdf_pages is obviously only present when converting to a PDF documentfilename, you indicate to PDFShift that you don’t want to receive back the binary PDF, but you want to create a file and receive a pointer to that file, which is represented by the “url” parameter.
webhook parameter
Finally, if you pass the webhook parameter, you ask PDFShift to convert the document and then send you the data not in response, but as a POST request toward your server (provided by the webhook value).
In this case, PDFShift will send a POST request to your server with the same data as for the filename parameter, such as :