This API allows you to convert Docsend documents to downloadable PDFs programmatically.
POST https://docsend2pdf.com/api/convertContent-Type: application/json{
"url": "https://docsend.com/view/abcdefg", // Required
"email": "user@example.com", // Optional; required for email-gated and email-verified documents
"passcode": "document-password", // Optional, for password-protected documents
"async": true, // Optional; omit to wait ~25 s for the PDF, true = 202 at once, false = wait up to 5 min
"space_choice": true, // Optional; set to true when converting a document taken from details.documents (see Error Responses)
"space_session": "<details.space_session>", // Optional; converts a document of a Space you verified by email without a second email (see Error Responses)
"searchable": false // Deprecated - always false
}By default the request waits up to about 25 seconds for the conversion. Most documents finish inside that window and the PDF comes back on the POST; otherwise you receive a task to poll:
200 with Content-Type: application/pdf - the conversion finished; the body is the PDF (with Content-Disposition: attachment; filename=*.pdf)202 with JSON - the conversion is still running (or you sent "async": true):{
"task_id": "1c0e4f6a-...",
"status": "processing", // last status seen; "queued" with "async": true
"poll_url": "/api/task/1c0e4f6a-..."
}Poll GET https://docsend2pdf.com/api/task/{task_id} every 1-2 seconds:
200 JSON with status: "queued" or "processing" - keep polling200 with Content-Type: application/pdf - done; the result stays available for about 5 minutes after completion, so retried downloads are safe200 JSON with status: "email_verification_required" - see below400 JSON - the conversion failed (see error format below)404 JSON - unknown or expired task (details.error_code: "storage_not_found"); start a new conversionChoosing how long to wait:
"async" omitted - wait up to about 25 seconds, then 202 with a poll_url if the conversion is still running. Always check the Content-Type of the POST response."async": true - return 202 as soon as the task is accepted. Best for callers with their own job queue."async": false - stay open until the PDF, a verification handoff, or an error is returned (up to 5 minutes; 504 if the window runs out).The API also includes rate limiting headers:
X-RateLimit-Limit: Maximum requests allowed in the time windowX-RateLimit-Remaining: Remaining requests in the current time windowX-RateLimit-Reset: Timestamp when the rate limit window resetsEmail-verified documents: some documents make DocSend email a verification link to the address you supplied. The task status (or, when the handoff happens inside the POST's wait, the POST response itself as a 202) then reports JSON instead of a PDF, so always check the Content-Type response header before treating a 2xx response as a PDF:
{
"status": "email_verification_required",
"session_id": "3f9a...",
"message": "Please check your email to verify access",
"details": { "email": "user@example.com", "document_owner": "..." },
"verify_url": "/api/verify-email",
"verify_method": "POST",
"verify_payload": {
"session_id": "3f9a...",
"verification_url": "<link behind the 'Verify email address' button in the DocSend email>"
},
"expires_at": "2026-09-26T09:00:00Z",
"expires_in_seconds": 86400,
"next_step": "..."
}To finish, have the inbox owner copy the link behind the "Verify email address" button in the DocSend email without opening it (the link is single-use) and POST it within 24 hours:
POST https://docsend2pdf.com/api/verify-email
Content-Type: application/json
{ "session_id": "3f9a...", "verification_url": "https://track.pstmrk.it/3s/..." }
// 202
{
"status": "processing",
"task_id": "7c1d...",
"poll_url": "/api/task/7c1d...",
"message": "Processing verified document",
"session_id": "7c1d...", // legacy: same value as task_id
"details": { "task_id": "7c1d..." }
}Poll poll_url like any other task. Repeating the POST with the same link returns the same task. 400 means the pasted link is not a verification link. The button link normally starts with https://track.pstmrk.it/ (or https://docsend.com/presentation_users/); a docsend.com/view/… address copied after the link was opened is answered with details.error_code: "opened_verification_link" and details.recovery_action: "restart_verification", because opening the link used it up. 404 means the session expired or was already used, so start a new conversion. If the request had no email, a verification-gated document fails with details.verification_required: true instead; there is no inbox to hand off to.
Every conversion of such a document sends a new email. To finish, submit the emailed link to the session you already hold instead of converting again. Once an address has been sent 6 verification emails for one link within 10 minutes, further conversions of that link for that address are answered with 429 and details.error_code: "verification_email_limit" until the 10 minutes, counted from the first of those emails, are over. details.retry_after and the Retry-After header give the seconds left. Earlier sessions stay usable meanwhile.
Every error from /api/convert, /api/task/{task_id} and /api/verify-email is JSON in this one shape, with the HTTP status repeated in errorCode:
{
"error": "Technical error message",
"user_message": "Human-friendly message suitable for display",
"details": {
"error_code": "document_not_found", // stable machine-readable reason
"retryable": false // whether the same request may succeed later
},
"errorCode": 400
}user_message is always safe to show to end users; error may contain technical detail intended for logs. Branch on details.error_code rather than on message text, and use details.retryable to decide whether to resubmit: false means the link, document, or credentials themselves are the problem. Codes you will see most often:
document_not_found, link_broken, space_access_required, space_document_required, space_unavailable (a Space link that cannot be resolved to one document; send the individual document's link), missing_email (email-gated document, no email supplied), missing_password (password-gated document, no passcode supplied), auth_rejected (the supplied email or passcode was refused), pages_denied (DocSend refused every page of the document; these documents keep failing when the request is repeated), link_expired, opened_verification_link, invalid_verification_link, invalid_requestrate_limited, verification_email_limit (this address was already sent 6 verification emails for this link in 10 minutes; use the most recent one, or wait details.retry_after seconds), timeout, network_error, pdf_integrity (some pages could not be fetched or the PDF could not be validated), download_failed, storage_unavailable, storage_not_found (task unknown or expired; submit a new conversion), internal_error, unknownSpaces with several documents: when a Space link fails with space_document_required and its documents could be listed, the error also carries details.recovery_action: "choose_document" and details.documents, between 1 and 200 entries in the Space's own order:
{
"error": "...",
"user_message": "This DocSend Space holds more than one item. Choose one of the listed documents, or open the Space in DocSend and paste the link to the document you want.",
"details": {
"error_code": "space_document_required",
"retryable": false,
"recovery_action": "choose_document",
"documents": [
{ "name": "Pitch deck", "url": "https://docsend.com/view/abc123/d/def456" },
{ "name": null, "url": "https://docsend.com/view/abc123/d/ghi789" }
]
},
"errorCode": 400
}name can be null. To convert one of the documents, send its url as a new /api/convert request, with email and passcode as for any other document. Set "space_choice": true on that request when the link was taken from details.documents; the field is optional and used only to measure how often the list is used. Nothing is converted until you send that request. An error without details.documents has no recovery_action either: open the Space in DocSend and send the individual document's link.
After email verification: when the Space link was verified by email (see Email-verified documents) and its conversion then ends with this error and a list, details also carries space_session, space_session_expires_at (UTC, 15 minutes later) and next_step:
"details": {
"error_code": "space_document_required",
"retryable": false,
"recovery_action": "choose_document",
"documents": [ { "name": "Pitch deck", "url": "https://docsend.com/view/abc123/d/def456" }, ... ],
"space_session": "<43 characters>",
"space_session_expires_at": "2026-11-12T21:15:00Z",
"next_step": "Convert one of details.documents: ..."
}Send space_session with the chosen document's url and the same email:
{
"url": "https://docsend.com/view/abc123/d/def456",
"email": "user@example.com",
"space_choice": true,
"space_session": "<details.space_session>"
}That conversion continues on the verification already completed, so DocSend sends no second email. The value works for any of the listed documents, more than once, until it expires. Treat it as a secret: it stands for your verified access to that Space. A request without it, after it expires, with another email, or for a link that was not listed is an ordinary conversion of that document, which asks for its own verification email. A verified Space whose session could not be kept fails without details.documents, as before.
New codes may be added over time; treat an unrecognised code as unknown and rely on retryable.
Common error status codes:
400 - Bad Request (missing or invalid parameters, or the conversion failed: the document could not be accessed or converted)404 - Not Found (unknown or expired conversion task, or expired verification session)429 - Too Many Requests (rate limit exceeded, or the verification email limit described under Email-verified documents)500 - Internal Server Error504 - Gateway Timeout (conversion exceeded the 5-minute limit)To ensure fair usage and service stability, the following rate limits apply:
If you exceed this limit, requests will be rejected with a 429 status code and include a Retry-After header indicating when you can retry.
A second limit applies only to documents that ask for email verification: 6 verification emails per link and address in 10 minutes. It also answers 429 with Retry-After, and is told apart by details.error_code: "verification_email_limit".
# Default: waits up to ~25 s. Usually the PDF; a 202 JSON task if it is still running
curl -s -X POST https://docsend2pdf.com/api/convert \
-H "Content-Type: application/json" \
-d '{"url": "https://docsend.com/view/abcdefg"}' \
--output response.bin -w '%{http_code} %{content_type}\n'
# => 200 application/pdf (response.bin is the PDF)
# => 202 application/json {"task_id": "...", "status": "processing", "poll_url": "/api/task/..."}
# Queue only - 202 immediately, then poll every second or two until the response is the PDF itself
curl -s -X POST https://docsend2pdf.com/api/convert \
-H "Content-Type: application/json" \
-d '{"url": "https://docsend.com/view/abcdefg", "async": true}'
curl -sL --output document.pdf https://docsend2pdf.com/api/task/TASK_ID
# Blocking mode - one request that waits for the PDF (up to 5 minutes)
curl -L -X POST https://docsend2pdf.com/api/convert \
-H "Content-Type: application/json" \
-d '{
"url": "https://docsend.com/view/abcdefg",
"passcode": "document-password",
"async": false
}' \
--output document.pdf// Using fetch (browser or Node.js 18+)
async function convertDocsend(url) {
const start = await fetch('https://docsend2pdf.com/api/convert', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url })
});
if (!start.ok) {
if (start.status === 429) {
const retryAfter = start.headers.get('Retry-After');
console.error(`Rate limit exceeded. Retry after ${retryAfter} seconds`);
return null;
}
const errorData = await start.json();
const { error_code, retryable } = errorData.details || {};
console.error('API Error:', errorData.user_message || errorData.error, { error_code, retryable });
return null;
}
// The default wait usually returns the PDF on the POST itself
if ((start.headers.get('content-type') || '').includes('application/pdf')) {
return await start.blob();
}
const started = await start.json();
if (started.status === 'email_verification_required') {
// See "Email-verified documents" above; the handoff can arrive here too.
console.error(started.next_step);
return null;
}
const { task_id } = started;
const deadline = Date.now() + 5 * 60 * 1000;
while (Date.now() < deadline) {
await new Promise((resolve) => setTimeout(resolve, 1000));
const poll = await fetch(`https://docsend2pdf.com/api/task/${task_id}`);
if (poll.ok && (poll.headers.get('content-type') || '').includes('application/pdf')) {
return await poll.blob();
}
const data = await poll.json();
if (!poll.ok || data.status === 'failed') {
console.error('API Error:', data.user_message || data.error);
return null;
}
if (data.status === 'email_verification_required') {
// Ask the inbox owner for the emailed link, then POST data.verify_payload
// (with the link as verification_url) to data.verify_url and poll the
// returned poll_url. See "Email-verified documents" above.
console.error(data.next_step);
return null;
}
// queued / processing - keep polling
}
console.error('Conversion timed out');
return null;
}
// Example usage
const pdfBlob = await convertDocsend('https://docsend.com/view/abcdefg');
if (pdfBlob) {
// Do something with the PDF blob
// e.g., save to file, display in browser, etc.
}import time
import requests
def convert_docsend(url, email=None, passcode=None):
"""
Convert a Docsend document to PDF, polling until it completes.
Args:
url (str): The DocSend URL
email (str, optional): Email for email-gated documents
passcode (str, optional): Password for password-protected documents
Returns:
bytes: The PDF file content or None if conversion failed
"""
api = 'https://docsend2pdf.com'
payload = {'url': url}
if email:
payload['email'] = email
if passcode:
payload['passcode'] = passcode
# The default wait keeps the POST open for up to ~25 s
start = requests.post(f'{api}/api/convert', json=payload, timeout=60)
if not start.ok:
if start.status_code == 429:
retry_after = start.headers.get('Retry-After')
print(f"Rate limit exceeded. Retry after {retry_after} seconds")
return None
try:
error_data = start.json()
message = error_data.get('user_message') or error_data.get('error', 'Unknown error')
details = error_data.get('details') or {}
print(f"API Error: {message} (code={details.get('error_code')}, retryable={details.get('retryable')})")
except ValueError:
print(f"API Error: {start.status_code} - {start.text}")
return None
# The default wait usually returns the PDF on the POST itself
if 'application/pdf' in start.headers.get('Content-Type', ''):
return start.content
started = start.json()
if started.get('status') == 'email_verification_required':
# See "Email-verified documents" above; the handoff can arrive here too.
print(started.get('next_step'))
return None
task_id = started['task_id']
deadline = time.time() + 300
while time.time() < deadline:
time.sleep(1)
poll = requests.get(f'{api}/api/task/{task_id}', timeout=30)
if poll.ok and 'application/pdf' in poll.headers.get('Content-Type', ''):
return poll.content
data = poll.json()
if not poll.ok or data.get('status') == 'failed':
message = data.get('user_message') or data.get('error', 'Unknown error')
print(f"API Error: {message}")
return None
if data.get('status') == 'email_verification_required':
# Ask the inbox owner for the emailed link, then POST
# data['verify_payload'] (with the link as verification_url) to
# data['verify_url'] and poll the returned poll_url.
print(data.get('next_step'))
return None
# queued / processing - keep polling
print('Conversion timed out')
return None
# Example usage
pdf_data = convert_docsend('https://docsend.com/view/abcdefg')
if pdf_data:
# Save the PDF to a file
with open('document.pdf', 'wb') as f:
f.write(pdf_data)