POST /v1/email/extract-attachments

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.
inlinebooleanNofalseSet to true to return results inside the response. Otherwise, the endpoint will return a URL to the output file generated.
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
profilesobjectNo-See Profiles for more information.
    outputDataFormatstringNo-If you require your output as base64 format, set this to base64
    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.
responseParametersobjectNo--
    bodyobjectNo-Response body.
    pageCountintegerNo-Number of pages in the PDF document.
    errorbooleanNo-Indicates whether an error occurred (false means success)
    statusstringNo-Status code of the request (200, 404, 500, etc.). For more information, see Response Codes.
    namestringNo-Name of the output file
    creditsintegerNo-Number of credits consumed by the request
    remainingCreditsintegerNo-Number of credits remaining in the account
    durationintegerNo-Time taken for the operation in milliseconds

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/email-extractor/sample.eml",
  "inline": true,
  "async": false
}

Example Response

To see the main response codes, please refer to the Response Codes page.
{
  "body": {
    "from": "test@example.com",
    "subject": "Test email with attachments",
    "bodyHtml": null,
    "bodyText": "Test Email Message with 2 PDF files as attachments\r\n\r\n",
    "attachments": [
      {
        "filename": "DigitalOcean.pdf",
        "url": "https://pdf-temp-files.s3.amazonaws.com/2943e6bb80e646ec92e839292e95d542/DigitalOcean.pdf"
      },
      {
        "filename": "sample.pdf",
        "url": "https://pdf-temp-files.s3.amazonaws.com/e10e37fbb438432a83ece50ccdc719b3/sample.pdf"
      }
    ]
  },
  "pageCount": 2,
  "error": false,
  "status": 200,
  "name": "sample.json",
  "remainingCredits": 60085
}

Code Samples

curl --location --request POST 'https://api.pdf.co/v1/email/extract-attachments' \
--header 'Content-Type: application/json' \
--header 'x-api-key: *******************' \
--data-raw '{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/email-extractor/sample.eml",
"inline": true,
"async": false
}'