Skip to content
API

SharePDF API

Share 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.

Base URL https://sharepdf.app/api/v1 · OpenAPI · llms.txt

Quick start

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.

Upload a PDF
curl https://sharepdf.app/api/v1/documents \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json" \
  -F "[email protected]"
Response
{
    "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"
    }
}
Upload and print just the share link (needs jq)
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'

Authentication

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.

Limits

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.

LimitProMaxBusiness
Requests per minute3060120
Requests per month1,00010,00050,000
Uploads per day502001,000
Word and PowerPoint conversions per day1050200
API keys2520
Webhook endpoints1310

Errors

Errors are JSON with a message. Validation errors (422) also carry errors, which maps each field to its messages.

401
The API key is missing or invalid.
402
Your plan does not include the API.
403
A plan limit was reached, such as active PDFs or webhook endpoints.
404
The document, lead, webhook or upload does not exist or belongs to another account.
409
The document is still being converted, or a direct upload has not been sent yet.
410
This upload was already added and has since been deleted.
422
A field is invalid. See errors.
429
A rate limit, quota or daily cap was reached, or another upload is in progress. Wait Retry-After seconds.
503
A temporary problem on our side. Retry with backoff.
422 response
{
    "message": "The custom slug must be at least 3 characters.",
    "errors": {
        "slug": [
            "The custom slug must be at least 3 characters."
        ]
    }
}

Pagination

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.

Safe retries

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.

Large files

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.

Direct upload
# 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"}'

Webhooks

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.

Payload
{
    "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"
        }
    }
}

Verifying signatures

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.

Node.js
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));
}
PHP
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'] ?? ''));
}
Python
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", ""))

Webhook events

Each event's data holds these fields.

document.opened

Someone reads a document. Sent once per visitor per document every 30 minutes. Your own views, your own network and known crawlers are left out.

documentDocument
The document that was opened.
visitorobject
Who opened it. Fields: id, email, country, source.
opened_atstring
When the document was opened.
lead.captured

A viewer gives their email on an email-gated document. Sent once per email per document.

leadLead
The captured email.
documentDocument
The document it was captured on.
document.converted

A Word or PowerPoint file has been converted and its share link works.

documentDocument
The document, now with status ready.
document.conversion_failed

A Word or PowerPoint file could not be converted.

documentDocument
The document, with status failed.
errorstring
Why it failed.
webhook.ping

A test event, sent when you press Send test or call POST /webhooks/{id}/test. You cannot subscribe to it.

webhook_idinteger
The endpoint that was tested.
messagestring
A fixed message.

Account

Check a key and see your plan limits.

GET/No key needed

API status

The API name and version. Needs no key.

Responses

  • 200The API is up.
curl GET sharepdf.app/api/v1
curl https://sharepdf.app/api/v1
GET/me

Get your account

The account behind the key, its plan and its limits.

Responses

  • 200The account.{ data: Account }
curl GET sharepdf.app/api/v1/me
curl https://sharepdf.app/api/v1/me \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"

Documents

Upload files, get share links, and change who can open them.

GET/documents

List documents

Your documents, newest first.

Parameters

pageinteger, query
Page number, from 1.
per_pageinteger, query
Results per page, 1 to 100. Default 25.

Responses

  • 200A page of documents.{ data: Document[], links, meta }
curl GET sharepdf.app/api/v1/documents
curl "https://sharepdf.app/api/v1/documents?per_page=50" \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
POST/documents

Upload a document

Add 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).

Body (multipart/form-data)

filestring
The file, up to 95 MB or your plan's limit.
source_urlstring
A public http or https URL to download the file from.
upload_keystring
The key from POST /uploads, once the file is uploaded.
namestring
Name shown to viewers. Defaults to the file name.
client_upload_idstring
Your own id, up to 100 characters. Retrying with it returns the first document.

Responses

  • 201A 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.Error
  • 409The direct upload has not been sent yet.Error
  • 410This upload was added and has since been deleted.Error
  • 422A field is invalid.ValidationError
  • 429A daily cap was reached, or another upload is in progress.Error
curl POST sharepdf.app/api/v1/documents
curl 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"
GET/documents/{document}

Get a document

One document. Poll it to see a conversion finish.

Parameters

documentstring, pathrequired
The document id.

Responses

  • 200The document.{ data: Document }
  • 404Not found.Error
curl GET sharepdf.app/api/v1/documents/{document}
curl https://sharepdf.app/api/v1/documents/k7Qm2xPa9 \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
PATCH/documents/{document}

Update a 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.

Parameters

documentstring, pathrequired
The document id.

Body (application/json)

namestring
Name shown to viewers.
slugstring or null
3 to 30 lowercase letters, numbers and hyphens. Null removes it.
visibilitystring
Who can open it.One of: unlisted, public, private
allow_downloadboolean
Show a download button.
require_emailboolean
Ask for an email before it opens.
passwordstring or null
4 to 128 characters. Null removes it.
expires_atstring or null
A future date and time. Null removes it.

Responses

  • 200The updated document.{ data: Document }
  • 404Not found.Error
  • 409The document is still being converted.Error
  • 422A field is invalid.ValidationError
curl PATCH sharepdf.app/api/v1/documents/{document}
curl -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"}'
DELETE/documents/{document}

Delete a document

The link stops working at once. The document stays in the trash for 7 days, where it can be restored from the dashboard.

Parameters

documentstring, pathrequired
The document id.

Responses

  • 204Deleted.
  • 404Not found.Error
curl DELETE sharepdf.app/api/v1/documents/{document}
curl -X DELETE https://sharepdf.app/api/v1/documents/k7Qm2xPa9 \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
POST/documents/{document}/file

Replace the file

Swap 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.

Parameters

documentstring, pathrequired
The document id.

Body (multipart/form-data)

filestring
The new PDF.
source_urlstring
A public URL to download the new PDF from.
upload_keystring
The key from POST /uploads.
namestring
A new name. Keeps the old one if left out.

Responses

  • 200The document with its new file.{ data: Document }
  • 404Not found.Error
  • 409The document is still being converted.Error
  • 422A field is invalid.ValidationError
  • 429The daily upload cap was reached.Error
curl POST sharepdf.app/api/v1/documents/{document}/file
curl https://sharepdf.app/api/v1/documents/k7Qm2xPa9/file \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json" \
  -F "[email protected]"
GET/documents/{document}/qr

Get a QR code

A QR code image for the document's link. The X-QR-Content header holds the encoded URL.

Parameters

documentstring, pathrequired
The document id.
formatstring, query
Defaults to png.One of: png, svg
sizeinteger, query
Width in pixels, 128 to 2048. Default 512.
linkstring, query
custom_domain encodes the link on your custom domain. Default share.One of: share, custom_domain

Responses

  • 200The image.
  • 404Not found.Error
  • 409The document is still being converted.Error
  • 422A field is invalid.ValidationError
curl GET sharepdf.app/api/v1/documents/{document}/qr
curl "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
POST/uploads

Start a direct upload

For 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.

Body (application/json)

filenamestringrequired
Ends in .pdf, .docx or .pptx.
sizeintegerrequired
File size in bytes, within your plan's limit.

Responses

  • 201Where to upload the file.{ data: Upload }
  • 403Your plan's active PDF limit is reached.Error
  • 422A field is invalid.ValidationError
  • 429A daily cap was reached.Error
curl POST sharepdf.app/api/v1/uploads
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}'

Leads

Emails viewers gave on your email-gated documents.

GET/leads

List leads

Newest first. With after_id, only later leads, oldest first.

Parameters

documentstring, query
Only leads from this document id.
emailstring, query
Only this email, ignoring case.
after_idinteger, query
Only leads with a higher id.
pageinteger, query
Page number, from 1.
per_pageinteger, query
Results per page, 1 to 100. Default 25.

Responses

  • 200A page of leads.{ data: Lead[], links, meta }
  • 404Not found.Error
  • 422A field is invalid.ValidationError
curl GET sharepdf.app/api/v1/leads
curl "https://sharepdf.app/api/v1/leads?after_id=3050" \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
GET/documents/{document}/leads

List a document's leads

The same as GET /leads?document=.

Parameters

documentstring, pathrequired
The document id.
emailstring, query
Only this email, ignoring case.
after_idinteger, query
Only leads with a higher id.
pageinteger, query
Page number, from 1.
per_pageinteger, query
Results per page, 1 to 100. Default 25.

Responses

  • 200A page of leads.{ data: Lead[], links, meta }
  • 404Not found.Error
  • 422A field is invalid.ValidationError
curl GET sharepdf.app/api/v1/documents/{document}/leads
curl https://sharepdf.app/api/v1/documents/k7Qm2xPa9/leads \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
DELETE/leads/{lead}

Delete a lead

Remove a captured email, for example when the viewer asks you to.

Parameters

leadinteger, pathrequired
The lead id.

Responses

  • 204Deleted.
  • 404Not found.Error
curl DELETE sharepdf.app/api/v1/leads/{lead}
curl -X DELETE https://sharepdf.app/api/v1/leads/3051 \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"

Analytics

The same numbers as your dashboard. Limited to 20 requests a minute.

GET/analytics

Account analytics

Views across all your documents.

Parameters

periodstring, query
Defaults to 30d.One of: today, 7d, 30d, 90d, all

Responses

  • 200Analytics.{ data: Analytics }
  • 422A field is invalid.ValidationError
curl GET sharepdf.app/api/v1/analytics
curl "https://sharepdf.app/api/v1/analytics?period=7d" \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
GET/documents/{document}/analytics

Document analytics

Views of one document, with reading time per page.

Parameters

documentstring, pathrequired
The document id.
periodstring, query
Defaults to 30d.One of: today, 7d, 30d, 90d, all

Responses

  • 200Analytics.{ data: DocumentAnalytics }
  • 404Not found.Error
  • 409The document is still being converted.Error
  • 422A field is invalid.ValidationError
curl GET sharepdf.app/api/v1/documents/{document}/analytics
curl "https://sharepdf.app/api/v1/documents/k7Qm2xPa9/analytics?period=30d" \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"

Webhook endpoints

Manage where events are sent. The same as Settings → Webhooks.

GET/webhooks

List webhooks

Your endpoints, oldest first. Signing secrets are not included.

Responses

  • 200All webhooks.{ data: Webhook[] }
curl GET sharepdf.app/api/v1/webhooks
curl https://sharepdf.app/api/v1/webhooks \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
POST/webhooks

Add a webhook

The response includes the signing secret, once.

Body (application/json)

urlstringrequired
An https URL on port 443 that resolves to a public address.
eventsarrayrequired
One or more events.One of: document.opened, document.converted, document.conversion_failed, lead.captured
descriptionstring or null
A note, up to 255 characters.

Responses

  • 201The webhook and its secret.{ data: WebhookWithSecret }
  • 403Your plan's webhook limit is reached.Error
  • 422A field is invalid.ValidationError
curl POST sharepdf.app/api/v1/webhooks
curl 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"]}'
GET/webhooks/{webhook}

Get a webhook

One endpoint, without its secret.

Parameters

webhookinteger, pathrequired
The webhook id.

Responses

  • 200The webhook.{ data: Webhook }
  • 404Not found.Error
curl GET sharepdf.app/api/v1/webhooks/{webhook}
curl https://sharepdf.app/api/v1/webhooks/17 \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
PATCH/webhooks/{webhook}

Update a webhook

Send only the fields to change. Switching it back on clears its failure count.

Parameters

webhookinteger, pathrequired
The webhook id.

Body (application/json)

urlstring
An https URL on port 443 that resolves to a public address.
eventsarray
One or more events.One of: document.opened, document.converted, document.conversion_failed, lead.captured
descriptionstring or null
A note, up to 255 characters.
enabledboolean
Switch it on or off.

Responses

  • 200The updated webhook.{ data: Webhook }
  • 404Not found.Error
  • 422A field is invalid.ValidationError
curl PATCH sharepdf.app/api/v1/webhooks/{webhook}
curl -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}'
DELETE/webhooks/{webhook}

Delete a webhook

Stops all events to it and removes its delivery history.

Parameters

webhookinteger, pathrequired
The webhook id.

Responses

  • 204Deleted.
  • 404Not found.Error
curl DELETE sharepdf.app/api/v1/webhooks/{webhook}
curl -X DELETE https://sharepdf.app/api/v1/webhooks/17 \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
POST/webhooks/{webhook}/rotate-secret

Replace the signing secret

The old secret stops working at once. The response includes the new one, once.

Parameters

webhookinteger, pathrequired
The webhook id.

Responses

  • 200The webhook and its new secret.{ data: WebhookWithSecret }
  • 404Not found.Error
curl POST sharepdf.app/api/v1/webhooks/{webhook}/rotate-secret
curl -X POST https://sharepdf.app/api/v1/webhooks/17/rotate-secret \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
POST/webhooks/{webhook}/test

Send a test event

Queues a webhook.ping event, even to a switched-off endpoint. Follow it with the deliveries endpoint. Limited to 5 a minute.

Parameters

webhookinteger, pathrequired
The webhook id.

Responses

  • 202The queued delivery.{ data: WebhookDelivery }
  • 404Not found.Error
  • 429More than 5 tests a minute.Error
curl POST sharepdf.app/api/v1/webhooks/{webhook}/test
curl -X POST https://sharepdf.app/api/v1/webhooks/17/test \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"
GET/webhooks/{webhook}/deliveries

List deliveries

Events sent to the endpoint in the last 30 days, newest first, with your endpoint's answers.

Parameters

webhookinteger, pathrequired
The webhook id.
pageinteger, query
Page number, from 1.
per_pageinteger, query
Results per page, 1 to 100. Default 25.

Responses

  • 200A page of deliveries.{ data: WebhookDelivery[], links, meta }
  • 404Not found.Error
curl GET sharepdf.app/api/v1/webhooks/{webhook}/deliveries
curl https://sharepdf.app/api/v1/webhooks/17/deliveries \
  -H "Authorization: Bearer $SHAREPDF_API_KEY" \
  -H "Accept: application/json"

Objects

Account

The account behind the API key, with its plan limits.

idinteger
Account id.
namestring
Account name.
emailstring
Account email.
planstring
Current plan, such as pro, max or business.
limitsobject
Plan limits. Fields: max_active_pdfs, max_file_size_kb, api.

Document

A shared document.

idstring
Document id, used in URLs.
namestring
File name shown to viewers. Always ends in .pdf.
titlestring
name without the .pdf ending, for showing in your own app.
slugstring or null
Custom words at the start of the link.
statusstring
ready once the link works. Word and PowerPoint files start as queued.One of: queued, processing, ready, failed
visibilitystring
unlisted: anyone with the link. public: also indexed by search engines. private: the link is off.One of: unlisted, public, private
share_urlstring or null
The link to send. Null until the document is ready.
custom_domain_urlstring or null
The link on your custom domain, when one is active.
allow_downloadboolean
Whether viewers see a download button.
require_emailboolean
Whether viewers must give an email first.
password_protectedboolean
Whether the link needs a password.
expires_atstring or null
When the link stops working.
preview_image_urlstring or null
A JPEG of the first page, the same image link previews use. Null until the document is ready.
qr_urlstring
API URL for a QR code of the share link. Needs your API key, like any other request.
views_countinteger
Total views, updated every few minutes.
file_sizeinteger
Size of the PDF in bytes.
created_atstring
When it was added.
updated_atstring
When it last changed.

Upload

A direct upload: PUT the file to upload_url, then confirm it with POST /documents.

upload_keystring
Send this to POST /documents once the file is uploaded.
upload_urlstring
Where to PUT the file.
methodstring
Always PUT.One of: PUT
headersobject
Headers to send with the PUT.
expires_atstring
When upload_url and upload_key stop working.

Lead

An email a viewer gave on an email-gated document.

idinteger
Lead id.
emailstring
The email they gave.
document_idstring
The document it was captured on.
document_namestring
That document's name.
referrerstring or null
The page the viewer came from, when known.
created_atstring
When it was captured.

Webhook

A webhook endpoint.

idinteger
Webhook id.
urlstring
Where events are sent.
descriptionstring or null
Your note.
eventsarray of string
Events it receives.One of: document.opened, document.converted, document.conversion_failed, lead.captured
enabledboolean
Whether events are sent.
disabled_reasonstring or null
Why it was switched off.
consecutive_failuresinteger
Events in a row that failed every attempt.
last_succeeded_atstring or null
Last successful delivery.
last_failed_atstring or null
Last failed delivery.
created_atstring
When it was added.
updated_atstring
When it last changed.

WebhookWithSecret

A webhook with its signing secret. Returned only when it is created or its secret is replaced.

idinteger
Webhook id.
urlstring
Where events are sent.
eventsarray of string
Events it receives.One of: document.opened, document.converted, document.conversion_failed, lead.captured
enabledboolean
Whether events are sent.
secretstring
The signing secret. Store it now: it is not shown again.

WebhookDelivery

One event sent, or being sent, to a webhook. Kept for 30 days.

idinteger
Delivery id, also sent as SharePDF-Delivery.
event_idstring
Event id, also sent as SharePDF-Event-Id.
eventstring
Event type.
statusstring
pending while it is queued or waiting to retry.One of: pending, succeeded, failed
attemptsinteger
Attempts so far.
response_statusinteger or null
HTTP status your endpoint answered with.
response_excerptstring or null
The start of your endpoint's answer.
errorstring or null
Why the last attempt failed.
next_attempt_atstring or null
When it will be retried.
delivered_atstring or null
When it succeeded.
created_atstring
When the event happened.
payloadobject
The exact JSON that was sent.

Analytics

Views across all your documents. The same numbers as the dashboard.

periodstring
The period asked for.One of: today, 7d, 30d, 90d, all
summaryobject
Totals for the period. Fields: views, unique_visitors, repeat_visitors, repeat_visitor_rate, avg_daily_views, avg_read_seconds, views_change_percent, unique_visitors_change_percent.
views_over_timearray of object
Views per day.
countriesarray of object
Views by country.
locationsarray of object
Views by city.
referrersarray of object
Views by the site that linked to the document.
sourcesarray of object
Views by where viewers came from.
devicesarray of object
Views by device type.
top_documentsarray of object
Most viewed documents.

DocumentAnalytics

Views of one document, with reading time per page.

document_idstring
Document id.
periodstring
The period asked for.One of: today, 7d, 30d, 90d, all
summaryobject
Totals for the period. Fields: views, unique_visitors, repeat_visitors, repeat_visitor_rate, avg_daily_views, avg_read_seconds, views_change_percent, unique_visitors_change_percent.
views_over_timearray of object
Views per day.
countriesarray of object
Views by country.
locationsarray of object
Views by city.
referrersarray of object
Views by the site that linked to the document.
sourcesarray of object
Views by where viewers came from.
devicesarray of object
Views by device type.
pagesobject
Reading time per page. Fields: total_pages, completion_rate, pages.

Error

An error.

messagestring
What went wrong.

ValidationError

One or more fields are invalid.

messagestring
The first problem.
errorsobject
Messages for each field.