Quick Start
Get up and running with the Enconvert API in minutes. This guide walks you through your first conversion request.
Getting Started in 3 Steps
- Sign up -- Create an account at enconvert.com to get your API key.
- Get your API key -- Navigate to the dashboard and generate a private key (
sk_...). Copy it and keep it secure. - Make your first request -- Use the examples below to convert a file or URL.
Example: Convert a URL to PDF
Use the /v1/convert/url-to-pdf endpoint to capture any web page as a PDF document.
cURL
curl -X POST https://api.enconvert.com/v1/convert/url-to-pdf \
-H "X-API-Key: sk_your_private_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com"
}'
Response
A successful conversion returns the download URL, storage path, and metadata:
{
"presigned_url": "https://econverter.nyc3.cdn.digitaloceanspaces.com/...",
"object_key": "live/files/12345/url-to-pdf/example_20250202_120530123.pdf",
"filename": "example_20250202_120530123.pdf",
"file_size": 45678,
"conversion_time_seconds": 3.21
}
presigned_url-- A temporary, downloadable URL for the converted file.object_key-- The storage path of the file (e.g.,live/files/12345/url-to-pdf/...).filename-- The generated filename.file_size-- The size of the converted file in bytes.conversion_time_seconds-- How long the conversion took.
Example: Convert a File (JSON to XML)
Upload a file for conversion using multipart/form-data.
cURL
curl -X POST https://api.enconvert.com/v1/convert/json-to-xml \
-H "X-API-Key: sk_your_private_key" \
-F "file=@data.json"
Response
{
"presigned_url": "https://econverter.nyc3.cdn.digitaloceanspaces.com/...",
"object_key": "live/files/12345/json-to-xml/data_20250202_120530123.xml",
"filename": "data_20250202_120530123.xml",
"file_size": 1024,
"conversion_time_seconds": 0.45
}
Python Example
Use the requests library to convert a URL to PDF:
import requests
API_KEY = "sk_your_private_key"
BASE_URL = "https://api.enconvert.com"
response = requests.post(
f"{BASE_URL}/v1/convert/url-to-pdf",
headers={"X-API-Key": API_KEY},
json={"url": "https://example.com"}
)
data = response.json()
print(f"Download URL: {data['presigned_url']}")
print(f"File size: {data['file_size']} bytes")
# Download the converted file
pdf_response = requests.get(data["presigned_url"])
with open("output.pdf", "wb") as f:
f.write(pdf_response.content)
JavaScript (Node.js) Example
Use the built-in fetch API (Node.js 18+) or any HTTP client:
const API_KEY = "sk_your_private_key";
const BASE_URL = "https://api.enconvert.com";
async function convertUrlToPdf(url) {
const response = await fetch(`${BASE_URL}/v1/convert/url-to-pdf`, {
method: "POST",
headers: {
"X-API-Key": API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ url }),
});
const data = await response.json();
console.log(`Download URL: ${data.presigned_url}`);
console.log(`File size: ${data.file_size} bytes`);
return data;
}
convertUrlToPdf("https://example.com");
For file uploads in Node.js, use FormData:
import { readFileSync } from "fs";
async function convertFile(filePath) {
const formData = new FormData();
formData.append("file", new Blob([readFileSync(filePath)]), "data.json");
const response = await fetch(`${BASE_URL}/v1/convert/json-to-xml`, {
method: "POST",
headers: {
"X-API-Key": API_KEY,
},
body: formData,
});
return await response.json();
}