Skip to main content
POST
/
v1
/
pdf
/
convert
/
from
/
email
PDF from Email
curl --request POST \
  --url https://api.pdf.co/v1/pdf/convert/from/email \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "url": "<string>",
  "margins": "10px 10px 10px 10px",
  "papersize": "A4",
  "orientation": "Portrait",
  "embedattachments": true,
  "convertattachments": true,
  "name": "<string>",
  "async": true,
  "header": "<string>",
  "footer": "<string>",
  "expiration": 60,
  "profiles": "<string>",
  "httpusername": "<string>",
  "httppassword": "<string>"
}'

Authorizations

x-api-key
string
header
required

Body

application/json
url
string<uri>
default:https://pdfco-test-files.s3.us-west-2.amazonaws.com/email-to-pdf/sample.eml
required

URL to the source file url attribute.

margins
string<{topMargin} {rightMargin} {bottomMargin} {leftMargin}>

Set custom margins, overriding CSS default margins. Specify the margins in the format {top} {right} {bottom} {left}. You can usepx,mm,cmorinunits. Also, you can set margins for all sides at once using a single value.

Example:

"10px 10px 10px 10px"

papersize
default:A4

Specifies the paper size. Accepts standard sizes like 'Letter', 'Legal', 'Tabloid', 'Ledger', 'A0'–'A6'. You can also set a custom size by providing width and height separated by a space, with optional units: px (pixels), mm (millimeters), cm (centimeters), or in (inches). Examples: '200 300', '200px 300px', '200mm 300mm', '20cm 30cm', '6in 8in'.

Available options:
Letter,
Legal,
Tabloid,
Ledger,
A0,
A1,
A2,
A3,
A4,
A5,
A6
Example:

"A4"

orientation
enum<string>
default:Portrait

Sets the document orientation. Options: Portrait for vertical layout, and Landscape for horizontal layout.

Available options:
Portrait,
Landscape
embedattachments
boolean
default:true
convertattachments
boolean
name
string
default:email-with-attachments

File name for generated output.

async
boolean
default:false

Set async to true for long processes to run in the background, API will then return a jobId which you can use with the Background Job Check endpoint. Also see Webhooks & Callbacks

header
string<html>

Set this to can add user definable HTML for the header to be applied on every page header. The format is html.

Set this to can add user definable HTML for the footer to be applied on every page bottom. The format is html.

expiration
number
default:60

Sets the expiration time for the output link, in minutes. After this period, generated output file(s) are automatically deleted from PDF.co Temporary Files Storage. The maximum allowed duration depends on your subscription plan. For permanent storage of input files (e.g., reusable images, PDF templates, documents), use PDF.co Built‑In Files Storage.

profiles
string
default:{"orientation": "landscape", "paperSize": "letter" }

Profiles are used configure extra options for specific API endpoints and may be unique to an API. For more information, see Profiles and the documentation of each endpoint for profiles specific to it.

httpusername
string

HTTP auth user name if required to access source URL.

httppassword
string

HTTP auth password if required to access source URL.