URL Converters

URL converters accept one or more URLs in a JSON request body and convert the target web pages to PDF or screenshot (PNG) format. These endpoints support single-URL synchronous conversion, batch processing, and asynchronous execution.


Available Endpoints

Endpoint Output
POST /v1/convert/url-to-pdf PDF document
POST /v1/convert/url-to-screenshot PNG image

Request Format

URL converters accept application/json request bodies.

curl -X POST https://api.enconvert.com/v1/convert/url-to-pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com"
  }'

Parameters

Parameter Type Default Description
url string or string[] (required) A single URL or an array of URLs to convert. When an array is provided, the job is processed as a batch.
async_mode boolean false When true, the job is queued and a job_id is returned immediately for polling. Required for batch (array) requests.
direct_download boolean false When true, the converted file is returned as a binary download instead of a JSON response. Only works with single-URL synchronous requests.
output_format string null Set to "zip" to bundle all batch results into a single ZIP archive. Only applies to batch requests.
output_filename string null Custom filename for the converted output.
load_media boolean true Load images and media assets on the page before conversion.
enable_scroll boolean true Scroll through the page to trigger lazy-loaded content.
handle_sticky_header boolean true Detect and neutralize sticky/fixed headers to prevent them from repeating on every page of the PDF.
handle_cookies boolean true Automatically dismiss cookie consent banners and overlays.
wait_for_images boolean true Wait for all images to finish loading before capturing.
single_page boolean false Render the entire page as a single continuous page (no page breaks).
viewport_width integer 1920 Width of the browser viewport in pixels.
viewport_height integer 1080 Height of the browser viewport in pixels.
notification_email string null Email address to notify when the job completes. See Job Notifications.
callback_url string null Webhook URL to receive a POST request when the job completes. See Job Notifications.

Single URL -- Synchronous

The simplest usage: convert a single URL and receive the result immediately.

Request

curl -X POST https://api.enconvert.com/v1/convert/url-to-pdf \
  -H "Authorization: Bearer YOUR_PRIVATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "output_filename": "example-page.pdf"
  }'

Response (Private Key)

HTTP 200 OK

{
  "success": true,
  "message": "Conversion successful",
  "presigned_url": "https://storage.enconvert.com/live/files/abc123/url-to-pdf/example-page.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...",
  "object_key": "live/files/abc123/url-to-pdf/example-page.pdf",
  "filename": "example-page.pdf",
  "file_size": 184320,
  "conversion_time": 3.721
}

Direct Download Mode

When direct_download is set to true, the API returns the converted file as a binary stream instead of a JSON response. This is useful for embedding conversion directly into download flows.

Request

curl -X POST https://api.enconvert.com/v1/convert/url-to-pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "direct_download": true
  }' \
  -o output.pdf

Response

HTTP 200 OK -- Binary file stream

The response body contains the raw file content. Metadata is provided in the response headers:

Header Description Example
Content-Disposition Indicates the filename. attachment; filename="example-com.pdf"
Content-Type MIME type of the output. application/pdf
X-Object-Key Storage path of the file. live/files/abc123/url-to-pdf/example-com.pdf
X-File-Size File size in bytes. 184320
X-Conversion-Time Conversion duration in seconds. 3.721
X-Filename Output filename. example-com.pdf
Note: direct_download is incompatible with async_mode and with multiple URLs. It only works for single-URL synchronous requests. If used with an array of URLs or with async_mode: true, the API will return a 400 Bad Request error.

Clear Capture Mode

Enconvert uses an intelligent page preparation system called Clear Capture Mode to ensure high-fidelity conversions. This system automatically handles the many challenges of converting live web pages into static documents.

All Clear Capture features are enabled by default. You can selectively disable them using the boolean parameters listed in the Parameters table above.

When handle_cookies is enabled, the converter automatically detects and dismisses cookie consent banners, GDPR overlays, and similar pop-ups. It recognizes common consent management platforms and clicks the appropriate "Accept" or "Close" buttons so they do not appear in the output.

Sticky Header Handling

When handle_sticky_header is enabled, the converter detects elements with position: fixed or position: sticky (such as navigation bars) and neutralizes them. This prevents sticky headers from being rendered at the top of every page in the PDF output.

Lazy-Load Triggering

When enable_scroll is enabled, the converter scrolls through the full length of the page to trigger lazy-loaded content. This ensures that elements which only load on scroll (images, sections, infinite scroll content) are fully rendered before capture.

Image Loading

When wait_for_images is enabled, the converter waits for all <img> elements and CSS background images to finish loading before performing the capture. Combined with load_media, this ensures no broken image placeholders appear in the output.

Animation Handling

The converter detects and triggers common animation libraries to ensure all animated content is in its final rendered state:

  • AOS (Animate on Scroll) -- all elements are revealed
  • WOW.js -- all animated elements are displayed
  • ScrollReveal -- all scroll-triggered reveals are completed
  • GSAP (GreenSock) -- timeline animations are advanced to their end state
  • Swiper -- slider/carousel elements are properly rendered

The converter automatically detects and closes modal dialogs, pop-up overlays, and interstitial screens that may obstruct the page content.

Viewport Unit Normalization

CSS viewport units (vh, svh, lvh, dvh) are normalized to match the configured viewport_height. This prevents layout issues where elements sized with viewport units render incorrectly in the headless browser environment.

Elementor Fixes

For pages built with the Elementor page builder, the converter applies targeted fixes to ensure sections, columns, and widgets render at full fidelity. This includes correcting known rendering quirks specific to Elementor's CSS framework.

Open dropdown navigation menus are detected and closed before capture, ensuring they do not obscure page content in the final output.

Video Dimension Preservation

Embedded videos (<video>, <iframe> embeds for YouTube, Vimeo, etc.) have their dimensions preserved and are rendered as static placeholder frames so the layout remains intact.


Error Responses

Invalid URL (400)

{
  "success": false,
  "error": "Invalid URL provided",
  "code": "INVALID_URL"
}

Direct Download Conflict (400)

{
  "success": false,
  "error": "direct_download cannot be used with async_mode or multiple URLs",
  "code": "INVALID_PARAMETERS"
}