POST /v1/email/send

For converting email to PDF please see PDF from Email.

Attributes

Attributes are case-sensitive and should be inside JSON for POST request. for example: { "url": "https://example.com/file1.pdf" }
AttributeTypeRequiredDefaultDescription
urlstringYes-URL to the source file url attribute
callbackstringNo-The callback URL (or Webhook) used to receive the POST data. see Webhooks & Callbacks. This is only applicable when async is set to true.
asyncbooleanNofalseSet 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
fromstringYes-The “From” field with sender name and email
tostringYes-The “To” field with receiver name and email
subjectstringYes-The subject for the outgoing email.
bodytextstringNo-The plain text version of the outgoing email message.
bodyhtmlstringNo-The HTML version of the outgoing email message.
smtpserverstringYes-The SMTP server to use for sending the email.
smtpportintegerYes-The port number of the SMTP server.
smtpusernamestringYes-The username for the SMTP server.
smtppasswordstringYes-The password for the SMTP server. If you use Gmail then you need to generate an app-specific password
profilesobjectNo-See Profiles for more information.
    DataEncryptionAlgorithmstringNo-Controls the encryption algorithm used for data encryption. See User-Controlled Encryption for more information. The available algorithms are: AES128, AES192, AES256.
    DataEncryptionKeystringNo-Controls the encryption key used for data encryption. See User-Controlled Encryption for more information.
    DataEncryptionIVstringNo-Controls the encryption IV used for data encryption. See User-Controlled Encryption for more information.
    DataDecryptionAlgorithmstringNo-Controls the decryption algorithm used for data decryption. See User-Controlled Encryption for more information. The available algorithms are: AES128, AES192, AES256.
    DataDecryptionKeystringNo-Controls the decryption key used for data decryption. See User-Controlled Encryption for more information.
    DataDecryptionIVstringNo-Controls the decryption IV used for data decryption. See User-Controlled Encryption for more information.

Query parameters

No query parameters accepted.

Responses

ParameterTypeDescription
errorbooleanIndicates whether an error occurred (false means success)
statusstringStatus code of the request (200, 404, 500, etc.). For more information, see Response Codes.
creditsintegerNumber of credits consumed by the request
remainingCreditsintegerNumber of credits remaining in the account

Example Payload

To see the request size limits, please refer to the Request Size Limits.
{
  "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-info/sample.pdf",
  "from": "John Doe <john@example.com>",
  "to": "Partner <partner@example.com>",
  "subject": "Check attached sample pdf",
  "bodytext": "Please check the attached pdf",
  "bodyHtml": "Please check the attached pdf",
  "smtpserver": "smtp.gmail.com",
  "smtpport": "587",
  "smtpusername": "my@gmail.com",
  "smtppassword": "app specific password created as https://support.google.com/accounts/answer/185833",
  "async": false
}

Example Response

To see the main response codes, please refer to the Response Codes page.
{
  "error": false,
  "status": 200,
  "remainingCredits": 60095
}

Code Samples

curl --location --request POST 'https://api.pdf.co/v1/email/send' \
--header 'Content-Type: application/json' \
--header 'x-api-key: *******************' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-info/sample.pdf",
"from": "John Doe <john@example.com>",
"to": "Partner <partner@example.com>",
"subject": "Check attached sample pdf",
"bodytext": "Please check the attached pdf",
"bodyHtml": "Please check the attached pdf",
"smtpserver": "smtp.gmail.com",
"smtpport": "587",
"smtpusername": "my@gmail.com",
"smtppassword": "app specific password created as https://support.google.com/accounts/answer/185833",
"async": false
}'