PDF, Word, Excel and PowerPoint to Markdown
When the address is a document, format: "markdown" or "text" converts it like a web page: headings, paragraphs, lists and tables come out as Markdown – ready for search, an index or a language model.
curl https://api.virginproxy.com/v1/requests \
-H "Authorization: Bearer $VP_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/annual-report-2025.pdf",
"format": "markdown",
"format_options": {
"max_pages": 20
}
}'import os, requests
r = requests.post(
"https://api.virginproxy.com/v1/requests",
headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
json={
"url": "https://example.com/annual-report-2025.pdf",
"format": "markdown",
"format_options": {"max_pages": 20},
},
timeout=180,
)
data = r.json()
if not r.ok:
raise SystemExit(data["error"]["code"] + ": " + data["error"]["message"])
print(data["document"], data["tokens"])
print(data["body"])const res = await fetch("https://api.virginproxy.com/v1/requests", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.VP_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
url: "https://example.com/annual-report-2025.pdf",
format: "markdown",
format_options: { max_pages: 20 },
}),
signal: AbortSignal.timeout(180_000),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error.code + ": " + data.error.message);
console.log(data.document, data.tokens);
console.log(data.body);from virginproxy import VirginProxy # docs.virginproxy.com/sdk/virginproxy.py
vp = VirginProxy() # reads VP_KEY
data = vp.request({
"url": "https://example.com/annual-report-2025.pdf",
"format": "markdown",
"format_options": {"max_pages": 20},
})
print(data)import { VirginProxy } from "./virginproxy.mjs"; // docs.virginproxy.com/sdk/virginproxy.mjs
const vp = new VirginProxy(); // reads VP_KEY
const data = await vp.request({
url: "https://example.com/annual-report-2025.pdf",
format: "markdown",
format_options: { max_pages: 20 },
});
console.log(data);<?php
$ch = curl_init("https://api.virginproxy.com/v1/requests");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 180,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("VP_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"url" => "https://example.com/annual-report-2025.pdf",
"format" => "markdown",
"format_options" => ["max_pages" => 20],
], JSON_UNESCAPED_SLASHES),
]);
$data = json_decode(curl_exec($ch), true);
if (isset($data["error"])) {
exit($data["error"]["code"] . ": " . $data["error"]["message"] . PHP_EOL);
}
echo json_encode([$data["document"], $data["tokens"]], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), PHP_EOL;
echo $data["body"], PHP_EOL;package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"time"
)
func main() {
payload := []byte(`{
"url": "https://example.com/annual-report-2025.pdf",
"format": "markdown",
"format_options": {
"max_pages": 20
}
}`)
req, err := http.NewRequest("POST", "https://api.virginproxy.com/v1/requests", bytes.NewReader(payload))
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 180 * time.Second}
res, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var data map[string]any
if err := json.NewDecoder(res.Body).Decode(&data); err != nil {
log.Fatal(err)
}
if res.StatusCode >= 300 {
e := data["error"].(map[string]any)
log.Fatalf("%v: %v", e["code"], e["message"])
}
fmt.Println(data["document"], data["tokens"])
fmt.Println(data["body"])
}require "json"
require "net/http"
uri = URI("https://api.virginproxy.com/v1/requests")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer " + ENV.fetch("VP_KEY")
req["Content-Type"] = "application/json"
req.body = JSON.generate({
"url" => "https://example.com/annual-report-2025.pdf",
"format" => "markdown",
"format_options" => { "max_pages" => 20 },
})
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 180) { |http| http.request(req) }
data = JSON.parse(res.body)
abort(data["error"]["code"] + ": " + data["error"]["message"]) unless res.is_a?(Net::HTTPSuccess)
puts JSON.pretty_generate([data["document"], data["tokens"]])
puts data["body"]import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"url": "https://example.com/annual-report-2025.pdf",
"format": "markdown",
"format_options": {
"max_pages": 20
}
}
""";
HttpRequest req = HttpRequest.newBuilder(URI.create("https://api.virginproxy.com/v1/requests"))
.header("Authorization", "Bearer " + System.getenv("VP_KEY"))
.header("Content-Type", "application/json")
.timeout(Duration.ofSeconds(180))
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
if (res.statusCode() >= 300) {
System.err.println(res.statusCode() + " " + res.body()); // the error object: code, message
System.exit(1);
}
System.out.println(res.body()); // JSON: read it with the JSON library of your choice
}
}using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(180) };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VP_KEY"));
var payload = """
{
"url": "https://example.com/annual-report-2025.pdf",
"format": "markdown",
"format_options": {
"max_pages": 20
}
}
""";
var req = new HttpRequestMessage(HttpMethod.Post, "https://api.virginproxy.com/v1/requests");
req.Content = new StringContent(payload, Encoding.UTF8, "application/json");
var res = await http.SendAsync(req);
using var data = JsonDocument.Parse(await res.Content.ReadAsStringAsync());
if (!res.IsSuccessStatusCode)
{
var e = data.RootElement.GetProperty("error");
Console.Error.WriteLine(e.GetProperty("code") + ": " + e.GetProperty("message"));
Environment.Exit(1);
}
Console.WriteLine(data.RootElement.GetProperty("document") + " " + data.RootElement.GetProperty("tokens"));
Console.WriteLine(data.RootElement.GetProperty("body"));POST
/v1/requests≈ 1 creditOpen in Playground{
"status": 200,
"format": "markdown",
"body": "# Annual Report 2025\n\n## Letter to shareholders\n\nThe year …",
"body_encoding": "utf8",
"document": { "type": "pdf", "pages": 20, "truncated": true, "text": true },
"tokens": 18420,
"cost": { "credits": 4 }
}What is converted
| Type | What you get |
|---|---|
The text layer, page by page. A scanned PDF without text gives an empty body and "text": false. | |
| Word (.docx), OpenDocument (.odt) | Headings, paragraphs, lists and tables. |
| Excel (.xlsx), CSV | Each sheet as a Markdown table (with text: tab-separated). |
| PowerPoint (.pptx) | Each slide with its title and text. |
The type is read from the answer's Content-Type, or from the file itself when the server sends a generic one. format_options.max_pages (1 to 500, default 100) limits pages, slides or sheets; document.truncated says when it cut. Without format the file comes back unchanged (base64).
What it costs
Like any request: 1 credit per started MB of the file. The conversion is free.
Tip
Combine with redact to black out e-mail addresses and phone numbers before the text goes into your index.
Was this page helpful?
Last updated