curl
curl --request POST \
--url https://api.iyzpdf.com/v1/convert/markdown-to-pdf \
--header "X-API-Key: $IYZPDF_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"markdown": "# Release Notes\n\n- New PDF routes\n- Updated credit tracking"
}' \
--output release-notes.pdfimport os
import requests
api_key = os.environ["IYZPDF_API_KEY"]
payload = {
"markdown": "# Release Notes\n\n- New PDF routes\n- Updated credit tracking"
}
response = requests.post(
"https://api.iyzpdf.com/v1/convert/markdown-to-pdf",
headers={"X-API-Key": api_key},
json=payload,
timeout=60,
)
if not response.ok:
raise Exception(response.text)
with open("release-notes.pdf", "wb") as output_file:
output_file.write(response.content)import { writeFile } from "node:fs/promises";
const apiKey = process.env.IYZPDF_API_KEY;
const response = await fetch("https://api.iyzpdf.com/v1/convert/markdown-to-pdf", {
method: "POST",
headers: {
"X-API-Key": apiKey,
"Content-Type": "application/json"
},
body: JSON.stringify({
markdown: "# Release Notes\n\n- New PDF routes\n- Updated credit tracking"
})
});
if (!response.ok) {
throw new Error(await response.text());
}
await writeFile("release-notes.pdf", Buffer.from(await response.arrayBuffer()));<?php
$apiKey = getenv('IYZPDF_API_KEY');
$payload = [
'markdown' => "# Release Notes\n\n- New PDF routes\n- Updated credit tracking",
];
$ch = curl_init('https://api.iyzpdf.com/v1/convert/markdown-to-pdf');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$pdf = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($pdf === false || $status !== 200) {
throw new RuntimeException('Request failed: ' . curl_error($ch) . PHP_EOL . $pdf);
}
file_put_contents('release-notes.pdf', $pdf);
curl_close($ch);import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
public class MarkdownToPdfExample {
public static void main(String[] args) throws Exception {
String apiKey = System.getenv("IYZPDF_API_KEY");
HttpClient client = HttpClient.newHttpClient();
String json = """
{
"markdown": "# Release Notes\\n\\n- New PDF routes\\n- Updated credit tracking"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.iyzpdf.com/v1/convert/markdown-to-pdf"))
.header("X-API-Key", apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
if (response.statusCode() != 200) {
throw new RuntimeException("Request failed with status " + response.statusCode());
}
Files.write(Path.of("release-notes.pdf"), response.body());
}
}using System.Net.Http.Json;
var apiKey = Environment.GetEnvironmentVariable("IYZPDF_API_KEY");
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", apiKey);
var payload = new
{
markdown = "# Release Notes\n\n- New PDF routes\n- Updated credit tracking"
};
using var response = await client.PostAsJsonAsync(
"https://api.iyzpdf.com/v1/convert/markdown-to-pdf",
payload);
response.EnsureSuccessStatusCode();
await using var output = File.Create("release-notes.pdf");
await response.Content.CopyToAsync(output);{
"fileName": "output.pdf",
"size": 183240,
"creditsUsed": 1,
"creditsRemaining": 49,
"contentType": "application/pdf"
}{
"error": {
"code": "INVALID_REQUEST",
"message": "The request payload is invalid or incomplete."
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid API key."
}
}{
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "You need more credits to complete this request.",
"creditsRequired": 2,
"creditsBalance": 0,
"purchaseUrl": "https://iyzpdf.com/portal/credits"
}
}{
"error": {
"code": "FILE_TOO_LARGE",
"message": "The uploaded file or request body exceeds the allowed size limit."
}
}{
"error": {
"code": "UNSUPPORTED_MEDIA_TYPE",
"message": "The uploaded file type or content type is not supported."
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please retry after the rate limit resets."
}
}{
"error": {
"code": "PROCESSING_FAILED",
"message": "The document could not be processed."
}
}Conversion
Markdown To PDF
Render inline Markdown or uploaded Markdown files into PDF.
POST
https://api.iyzpdf.com/v1
/
convert
/
markdown-to-pdf
curl
curl --request POST \
--url https://api.iyzpdf.com/v1/convert/markdown-to-pdf \
--header "X-API-Key: $IYZPDF_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"markdown": "# Release Notes\n\n- New PDF routes\n- Updated credit tracking"
}' \
--output release-notes.pdfimport os
import requests
api_key = os.environ["IYZPDF_API_KEY"]
payload = {
"markdown": "# Release Notes\n\n- New PDF routes\n- Updated credit tracking"
}
response = requests.post(
"https://api.iyzpdf.com/v1/convert/markdown-to-pdf",
headers={"X-API-Key": api_key},
json=payload,
timeout=60,
)
if not response.ok:
raise Exception(response.text)
with open("release-notes.pdf", "wb") as output_file:
output_file.write(response.content)import { writeFile } from "node:fs/promises";
const apiKey = process.env.IYZPDF_API_KEY;
const response = await fetch("https://api.iyzpdf.com/v1/convert/markdown-to-pdf", {
method: "POST",
headers: {
"X-API-Key": apiKey,
"Content-Type": "application/json"
},
body: JSON.stringify({
markdown: "# Release Notes\n\n- New PDF routes\n- Updated credit tracking"
})
});
if (!response.ok) {
throw new Error(await response.text());
}
await writeFile("release-notes.pdf", Buffer.from(await response.arrayBuffer()));<?php
$apiKey = getenv('IYZPDF_API_KEY');
$payload = [
'markdown' => "# Release Notes\n\n- New PDF routes\n- Updated credit tracking",
];
$ch = curl_init('https://api.iyzpdf.com/v1/convert/markdown-to-pdf');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$pdf = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($pdf === false || $status !== 200) {
throw new RuntimeException('Request failed: ' . curl_error($ch) . PHP_EOL . $pdf);
}
file_put_contents('release-notes.pdf', $pdf);
curl_close($ch);import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
public class MarkdownToPdfExample {
public static void main(String[] args) throws Exception {
String apiKey = System.getenv("IYZPDF_API_KEY");
HttpClient client = HttpClient.newHttpClient();
String json = """
{
"markdown": "# Release Notes\\n\\n- New PDF routes\\n- Updated credit tracking"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.iyzpdf.com/v1/convert/markdown-to-pdf"))
.header("X-API-Key", apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
if (response.statusCode() != 200) {
throw new RuntimeException("Request failed with status " + response.statusCode());
}
Files.write(Path.of("release-notes.pdf"), response.body());
}
}using System.Net.Http.Json;
var apiKey = Environment.GetEnvironmentVariable("IYZPDF_API_KEY");
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-Key", apiKey);
var payload = new
{
markdown = "# Release Notes\n\n- New PDF routes\n- Updated credit tracking"
};
using var response = await client.PostAsJsonAsync(
"https://api.iyzpdf.com/v1/convert/markdown-to-pdf",
payload);
response.EnsureSuccessStatusCode();
await using var output = File.Create("release-notes.pdf");
await response.Content.CopyToAsync(output);{
"fileName": "output.pdf",
"size": 183240,
"creditsUsed": 1,
"creditsRemaining": 49,
"contentType": "application/pdf"
}{
"error": {
"code": "INVALID_REQUEST",
"message": "The request payload is invalid or incomplete."
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid API key."
}
}{
"error": {
"code": "INSUFFICIENT_CREDITS",
"message": "You need more credits to complete this request.",
"creditsRequired": 2,
"creditsBalance": 0,
"purchaseUrl": "https://iyzpdf.com/portal/credits"
}
}{
"error": {
"code": "FILE_TOO_LARGE",
"message": "The uploaded file or request body exceeds the allowed size limit."
}
}{
"error": {
"code": "UNSUPPORTED_MEDIA_TYPE",
"message": "The uploaded file type or content type is not supported."
}
}{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please retry after the rate limit resets."
}
}{
"error": {
"code": "PROCESSING_FAILED",
"message": "The document could not be processed."
}
}Notes
- Credits:
1 - Authenticated Markdown payloads and uploads are limited to
100 MB - Uploaded Markdown must contain valid UTF-8 text
- The generated output file name is
markdown.pdf
Authorizations
Send your server-side API key in the X-API-Key header.
Body
application/jsonmultipart/form-data