/No key neededAPI status
The API name and version. Needs no key.
Responses
200The API is up.
curl https://sharepdf.app/api/v1Share PDFs from your own tools and AI agents, and see who read them. Upload files, get share links, read analytics and leads, and get a webhook the moment someone opens a document.
The API is included in the Pro, Max and Business plans. Create a key in Settings → API keys. It is shown once, so copy it somewhere safe.
Upload a PDF and get its share link in one request. PDFs are ready at once. Word and PowerPoint files are converted to PDF first, so they come back with status queued; poll the document or subscribe to the document.converted webhook.
curl https://sharepdf.app/api/v1/documents \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-F "[email protected]"{
"data": {
"id": "k7Qm2xPa9",
"name": "Proposal.pdf",
"title": "Proposal",
"slug": "acme-proposal",
"status": "ready",
"visibility": "unlisted",
"share_url": "https://sharepdf.link/s/acme-proposal-k7Qm2xPa9.pdf",
"custom_domain_url": null,
"allow_download": true,
"require_email": false,
"password_protected": false,
"expires_at": null,
"preview_image_url": "https://sharepdf.link/s/acme-proposal-k7Qm2xPa9.pdf/og",
"qr_url": "https://sharepdf.app/api/v1/documents/k7Qm2xPa9/qr",
"views_count": 12,
"file_size": 482133,
"created_at": "2026-11-28T09:12:44+00:00",
"updated_at": "2026-11-28T09:12:44+00:00"
}
}export SHAREPDF_API_KEY="sp_live_…"
curl -s https://sharepdf.app/api/v1/documents \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-F "[email protected]" \
-F "name=Acme proposal" \
| jq -r '.data.share_url'Send your key as a Bearer token on every request: Authorization: Bearer sp_live_…. Keys start with sp_live_. Also send Accept: application/json.
A key acts as the account that created it and can see all of that account's documents. Keep it on your server, never in a browser or mobile app. Revoke a key in Settings → API keys and it stops working at once.
Each plan has a per-minute rate limit, a monthly request quota, and daily caps on uploads and conversions. Every response carries X-RateLimit-Limit and X-RateLimit-Remaining for the per-minute limit, and X-Quota-Limit, X-Quota-Remaining and X-Quota-Reset (a Unix time) for the monthly quota.
Over a limit, the API answers 429 with a Retry-After header in seconds. Daily caps reset at midnight UTC and the monthly quota on the 1st of the month, UTC. Analytics endpoints allow 20 requests a minute and test webhook events 5 a minute, on top of the plan limit. Documents created through the API count toward your plan's active PDF limit, like any other upload.
| Limit | Pro | Max | Business |
|---|---|---|---|
| Requests per minute | 30 | 60 | 120 |
| Requests per month | 1,000 | 10,000 | 50,000 |
| Uploads per day | 50 | 200 | 1,000 |
| Word and PowerPoint conversions per day | 10 | 50 | 200 |
| API keys | 2 | 5 | 20 |
| Webhook endpoints | 1 | 3 | 10 |
Errors are JSON with a message. Validation errors (422) also carry errors, which maps each field to its messages.
401402403404409410422errors.429Retry-After seconds.503{
"message": "The custom slug must be at least 3 characters.",
"errors": {
"slug": [
"The custom slug must be at least 3 characters."
]
}
}Lists of documents, leads and deliveries are paginated. Pass page and per_page (1 to 100, default 25). Responses include links (first, last, prev, next) and meta (current_page, last_page, per_page, total). Follow links.next until it is null.
To pick up only new leads, pass the last lead id you saw as after_id. Results then come oldest first.
Send a client_upload_id of your choice with POST /documents. Retrying with the same value returns the document that was already created, with status 200, instead of a duplicate. Confirming the same upload_key twice works the same way.
Multipart uploads are limited to 95 MB. For larger files, up to your plan's file size limit, call POST /uploads with the filename and size. PUT the file to the returned upload_url with the returned headers within 15 minutes, then call POST /documents with the upload_key.
You can also send source_url instead of a file, and SharePDF downloads it. The URL must be public http or https on the standard port.
# 1. Start the upload
curl https://sharepdf.app/api/v1/uploads \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"filename": "catalogue.pdf", "size": 157286400}'
# 2. PUT the file to data.upload_url with data.headers
curl -X PUT "$UPLOAD_URL" -H "Content-Type: application/pdf" --data-binary @catalogue.pdf
# 3. Confirm it
curl https://sharepdf.app/api/v1/documents \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"upload_key": "$UPLOAD_KEY"}'Add an endpoint in Settings → Webhooks or with POST /webhooks, and choose its events. SharePDF then sends each event as a JSON POST to your https URL. The URL must use port 443 and a public address. Redirects are not followed.
Answer with any 2xx status within 10 seconds. Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 8 hours, so 6 attempts in all. After 15 events in a row fail every attempt, the endpoint is switched off. Switch it back on in settings or with PATCH /webhooks/{id}.
Events can arrive more than once and out of order. Use the event id to ignore repeats. Each request carries the headers SharePDF-Event, SharePDF-Event-Id, SharePDF-Delivery and SharePDF-Signature.
{
"id": "9b7e4d2c-8f1a-4b3e-9c6d-2a5f7e1b0c3d",
"type": "lead.captured",
"created_at": "2026-11-28T09:30:00+00:00",
"data": {
"lead": {
"id": 3051,
"email": "[email protected]",
"document_id": "k7Qm2xPa9",
"document_name": "Proposal.pdf",
"referrer": "https://mail.example.com/",
"created_at": "2026-11-28T09:30:00+00:00"
},
"document": {
"id": "k7Qm2xPa9",
"name": "Proposal.pdf",
"title": "Proposal",
"slug": "acme-proposal",
"status": "ready",
"visibility": "unlisted",
"share_url": "https://sharepdf.link/s/acme-proposal-k7Qm2xPa9.pdf",
"custom_domain_url": null,
"allow_download": true,
"require_email": false,
"password_protected": false,
"expires_at": null,
"preview_image_url": "https://sharepdf.link/s/acme-proposal-k7Qm2xPa9.pdf/og",
"qr_url": "https://sharepdf.app/api/v1/documents/k7Qm2xPa9/qr",
"views_count": 12,
"file_size": 482133,
"created_at": "2026-11-28T09:12:44+00:00",
"updated_at": "2026-11-28T09:12:44+00:00"
}
}
}Each request is signed with the endpoint's signing secret, which starts with whsec_. The SharePDF-Signature header looks like t=1764322200,v1=5257a8…. t is the Unix time it was sent. v1 is the hex HMAC-SHA256 of the time, a dot and the raw request body, keyed with the secret.
Compute the same value over the raw body, before parsing it as JSON, and compare in constant time. Reject requests more than 5 minutes old so a captured request cannot be replayed.
import crypto from 'node:crypto';
export function verifySharePdfSignature(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(',').map((part) => part.split('=')));
const timestamp = Number(parts.t);
if (!timestamp || Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) {
return false;
}
const expected = crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
const received = Buffer.from(parts.v1 ?? '');
return received.length === expected.length && crypto.timingSafeEqual(received, Buffer.from(expected));
}function verifySharePdfSignature(string $body, string $header, string $secret, int $tolerance = 300): bool
{
parse_str(str_replace(',', '&', $header), $parts);
$timestamp = (int) ($parts['t'] ?? 0);
if ($timestamp === 0 || abs(time() - $timestamp) > $tolerance) {
return false;
}
$expected = hash_hmac('sha256', $timestamp.'.'.$body, $secret);
return hash_equals($expected, (string) ($parts['v1'] ?? ''));
}import hashlib
import hmac
import time
def verify_sharepdf_signature(body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
parts = dict(part.split("=", 1) for part in header.split(","))
timestamp = int(parts.get("t", 0))
if not timestamp or abs(time.time() - timestamp) > tolerance:
return False
expected = hmac.new(secret.encode(), f"{timestamp}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts.get("v1", ""))Each event's data holds these fields.
document.openedSomeone reads a document. Sent once per visitor per document every 30 minutes. Your own views, your own network and known crawlers are left out.
documentDocumentvisitorobjectid, email, country, source.opened_atstringlead.capturedA viewer gives their email on an email-gated document. Sent once per email per document.
leadLeaddocumentDocumentdocument.convertedA Word or PowerPoint file has been converted and its share link works.
documentDocumentready.document.conversion_failedA Word or PowerPoint file could not be converted.
documentDocumentfailed.errorstringwebhook.pingA test event, sent when you press Send test or call POST /webhooks/{id}/test. You cannot subscribe to it.
webhook_idintegermessagestringCheck a key and see your plan limits.
/No key neededThe API name and version. Needs no key.
200The API is up.curl https://sharepdf.app/api/v1/meThe account behind the key, its plan and its limits.
200The account.{ data: Account }curl https://sharepdf.app/api/v1/me \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"Upload files, get share links, and change who can open them.
/documentsYour documents, newest first.
pageinteger, queryper_pageinteger, query200A page of documents.{ data: Document[], links, meta }curl "https://sharepdf.app/api/v1/documents?per_page=50" \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/documentsAdd a PDF, Word (.docx) or PowerPoint (.pptx) file. Send exactly one of file, source_url or upload_key. PDFs are ready at once (201). Word and PowerPoint files are converted in the background (202).
filestringsource_urlstringupload_keystringPOST /uploads, once the file is uploaded.namestringclient_upload_idstring201A PDF was added and its link works.{ data: Document }202A Word or PowerPoint file is being converted.{ data: Document }200This upload was already added; here it is.{ data: Document }403Your plan's active PDF limit is reached.Error409The direct upload has not been sent yet.Error410This upload was added and has since been deleted.Error422A field is invalid.ValidationError429A daily cap was reached, or another upload is in progress.Errorcurl https://sharepdf.app/api/v1/documents \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-F "[email protected]" -F "name=Q4 deck" -F "client_upload_id=deck-2026-q4"/documents/{document}One document. Poll it to see a conversion finish.
documentstring, pathrequired200The document.{ data: Document }404Not found.Errorcurl https://sharepdf.app/api/v1/documents/k7Qm2xPa9 \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/documents/{document}Change any of its settings. Send only the fields to change. Passwords, expiry dates and email capture need a paid plan and are not available on public documents.
documentstring, pathrequirednamestringslugstring or nullvisibilitystringunlisted, public, privateallow_downloadbooleanrequire_emailbooleanpasswordstring or nullexpires_atstring or null200The updated document.{ data: Document }404Not found.Error409The document is still being converted.Error422A field is invalid.ValidationErrorcurl -X PATCH https://sharepdf.app/api/v1/documents/k7Qm2xPa9 \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"require_email": true, "expires_at": "2026-12-31T23:59:00Z"}'/documents/{document}The link stops working at once. The document stays in the trash for 7 days, where it can be restored from the dashboard.
documentstring, pathrequired204Deleted.404Not found.Errorcurl -X DELETE https://sharepdf.app/api/v1/documents/k7Qm2xPa9 \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/documents/{document}/fileSwap in a new PDF and keep the same link, settings and analytics. Send exactly one of file, source_url or upload_key. Counts toward the daily upload cap.
documentstring, pathrequiredfilestringsource_urlstringupload_keystringPOST /uploads.namestring200The document with its new file.{ data: Document }404Not found.Error409The document is still being converted.Error422A field is invalid.ValidationError429The daily upload cap was reached.Errorcurl https://sharepdf.app/api/v1/documents/k7Qm2xPa9/file \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-F "[email protected]"/documents/{document}/qrA QR code image for the document's link. The X-QR-Content header holds the encoded URL.
documentstring, pathrequiredformatstring, querypng.One of: png, svgsizeinteger, querylinkstring, querycustom_domain encodes the link on your custom domain. Default share.One of: share, custom_domain200The image.404Not found.Error409The document is still being converted.Error422A field is invalid.ValidationErrorcurl "https://sharepdf.app/api/v1/documents/k7Qm2xPa9/qr?format=svg&size=1024" \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-o qr.svg/uploadsFor files over 95 MB. PUT the file to upload_url with headers within 15 minutes, then send the upload_key to POST /documents or POST /documents/{document}/file.
filenamestringrequiredsizeintegerrequired201Where to upload the file.{ data: Upload }403Your plan's active PDF limit is reached.Error422A field is invalid.ValidationError429A daily cap was reached.Errorcurl https://sharepdf.app/api/v1/uploads \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"filename": "catalogue.pdf", "size": 157286400}'Emails viewers gave on your email-gated documents.
/leadsNewest first. With after_id, only later leads, oldest first.
documentstring, queryemailstring, queryafter_idinteger, querypageinteger, queryper_pageinteger, query200A page of leads.{ data: Lead[], links, meta }404Not found.Error422A field is invalid.ValidationErrorcurl "https://sharepdf.app/api/v1/leads?after_id=3050" \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/documents/{document}/leadsThe same as GET /leads?document=.
documentstring, pathrequiredemailstring, queryafter_idinteger, querypageinteger, queryper_pageinteger, query200A page of leads.{ data: Lead[], links, meta }404Not found.Error422A field is invalid.ValidationErrorcurl https://sharepdf.app/api/v1/documents/k7Qm2xPa9/leads \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/leads/{lead}Remove a captured email, for example when the viewer asks you to.
leadinteger, pathrequired204Deleted.404Not found.Errorcurl -X DELETE https://sharepdf.app/api/v1/leads/3051 \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"The same numbers as your dashboard. Limited to 20 requests a minute.
/analyticsViews across all your documents.
periodstring, query30d.One of: today, 7d, 30d, 90d, all200Analytics.{ data: Analytics }422A field is invalid.ValidationErrorcurl "https://sharepdf.app/api/v1/analytics?period=7d" \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/documents/{document}/analyticsViews of one document, with reading time per page.
documentstring, pathrequiredperiodstring, query30d.One of: today, 7d, 30d, 90d, all200Analytics.{ data: DocumentAnalytics }404Not found.Error409The document is still being converted.Error422A field is invalid.ValidationErrorcurl "https://sharepdf.app/api/v1/documents/k7Qm2xPa9/analytics?period=30d" \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"Manage where events are sent. The same as Settings → Webhooks.
/webhooksYour endpoints, oldest first. Signing secrets are not included.
200All webhooks.{ data: Webhook[] }curl https://sharepdf.app/api/v1/webhooks \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/webhooksThe response includes the signing secret, once.
urlstringrequiredeventsarrayrequireddocument.opened, document.converted, document.conversion_failed, lead.captureddescriptionstring or null201The webhook and its secret.{ data: WebhookWithSecret }403Your plan's webhook limit is reached.Error422A field is invalid.ValidationErrorcurl https://sharepdf.app/api/v1/webhooks \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"url": "https://hooks.example.com/sharepdf", "events": ["lead.captured", "document.opened"]}'/webhooks/{webhook}One endpoint, without its secret.
webhookinteger, pathrequired200The webhook.{ data: Webhook }404Not found.Errorcurl https://sharepdf.app/api/v1/webhooks/17 \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/webhooks/{webhook}Send only the fields to change. Switching it back on clears its failure count.
webhookinteger, pathrequiredurlstringeventsarraydocument.opened, document.converted, document.conversion_failed, lead.captureddescriptionstring or nullenabledboolean200The updated webhook.{ data: Webhook }404Not found.Error422A field is invalid.ValidationErrorcurl -X PATCH https://sharepdf.app/api/v1/webhooks/17 \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"enabled": true}'/webhooks/{webhook}Stops all events to it and removes its delivery history.
webhookinteger, pathrequired204Deleted.404Not found.Errorcurl -X DELETE https://sharepdf.app/api/v1/webhooks/17 \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/webhooks/{webhook}/rotate-secretThe old secret stops working at once. The response includes the new one, once.
webhookinteger, pathrequired200The webhook and its new secret.{ data: WebhookWithSecret }404Not found.Errorcurl -X POST https://sharepdf.app/api/v1/webhooks/17/rotate-secret \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/webhooks/{webhook}/testQueues a webhook.ping event, even to a switched-off endpoint. Follow it with the deliveries endpoint. Limited to 5 a minute.
webhookinteger, pathrequired202The queued delivery.{ data: WebhookDelivery }404Not found.Error429More than 5 tests a minute.Errorcurl -X POST https://sharepdf.app/api/v1/webhooks/17/test \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"/webhooks/{webhook}/deliveriesEvents sent to the endpoint in the last 30 days, newest first, with your endpoint's answers.
webhookinteger, pathrequiredpageinteger, queryper_pageinteger, query200A page of deliveries.{ data: WebhookDelivery[], links, meta }404Not found.Errorcurl https://sharepdf.app/api/v1/webhooks/17/deliveries \
-H "Authorization: Bearer $SHAREPDF_API_KEY" \
-H "Accept: application/json"The account behind the API key, with its plan limits.
idintegernamestringemailstringplanstringpro, max or business.limitsobjectmax_active_pdfs, max_file_size_kb, api.A shared document.
idstringnamestring.pdf.titlestringname without the .pdf ending, for showing in your own app.slugstring or nullstatusstringready once the link works. Word and PowerPoint files start as queued.One of: queued, processing, ready, failedvisibilitystringunlisted: anyone with the link. public: also indexed by search engines. private: the link is off.One of: unlisted, public, privateshare_urlstring or nullcustom_domain_urlstring or nullallow_downloadbooleanrequire_emailbooleanpassword_protectedbooleanexpires_atstring or nullpreview_image_urlstring or nullqr_urlstringviews_countintegerfile_sizeintegercreated_atstringupdated_atstringA direct upload: PUT the file to upload_url, then confirm it with POST /documents.
upload_keystringPOST /documents once the file is uploaded.upload_urlstringmethodstringPUT.One of: PUTheadersobjectexpires_atstringupload_url and upload_key stop working.An email a viewer gave on an email-gated document.
idintegeremailstringdocument_idstringdocument_namestringreferrerstring or nullcreated_atstringA webhook endpoint.
idintegerurlstringdescriptionstring or nulleventsarray of stringdocument.opened, document.converted, document.conversion_failed, lead.capturedenabledbooleandisabled_reasonstring or nullconsecutive_failuresintegerlast_succeeded_atstring or nulllast_failed_atstring or nullcreated_atstringupdated_atstringA webhook with its signing secret. Returned only when it is created or its secret is replaced.
idintegerurlstringeventsarray of stringdocument.opened, document.converted, document.conversion_failed, lead.capturedenabledbooleansecretstringOne event sent, or being sent, to a webhook. Kept for 30 days.
idintegerSharePDF-Delivery.event_idstringSharePDF-Event-Id.eventstringstatusstringpending while it is queued or waiting to retry.One of: pending, succeeded, failedattemptsintegerresponse_statusinteger or nullresponse_excerptstring or nullerrorstring or nullnext_attempt_atstring or nulldelivered_atstring or nullcreated_atstringpayloadobjectViews across all your documents. The same numbers as the dashboard.
periodstringtoday, 7d, 30d, 90d, allsummaryobjectviews, unique_visitors, repeat_visitors, repeat_visitor_rate, avg_daily_views, avg_read_seconds, views_change_percent, unique_visitors_change_percent.views_over_timearray of objectcountriesarray of objectlocationsarray of objectreferrersarray of objectsourcesarray of objectdevicesarray of objecttop_documentsarray of objectViews of one document, with reading time per page.
document_idstringperiodstringtoday, 7d, 30d, 90d, allsummaryobjectviews, unique_visitors, repeat_visitors, repeat_visitor_rate, avg_daily_views, avg_read_seconds, views_change_percent, unique_visitors_change_percent.views_over_timearray of objectcountriesarray of objectlocationsarray of objectreferrersarray of objectsourcesarray of objectdevicesarray of objectpagesobjecttotal_pages, completion_rate, pages.An error.
messagestringOne or more fields are invalid.
messagestringerrorsobject