# SharePDF API > Share PDFs from your own tools and AI agents, and see who read them. Upload a PDF, Word or PowerPoint file, get a share link, change its settings, and read views, leads and analytics. Webhooks tell you the moment someone opens a document or leaves their email. - Base URL: https://sharepdf.app/api/v1 - Documentation: https://sharepdf.app/docs/api - OpenAPI: https://sharepdf.app/openapi.json - Authentication: `Authorization: Bearer `, with `Accept: application/json` ## 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: ```bash curl https://sharepdf.app/api/v1/documents \ -H "Authorization: Bearer $SHAREPDF_API_KEY" \ -H "Accept: application/json" \ -F "file=@proposal.pdf" ``` Response: ```json { "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): ```bash 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 "file=@proposal.pdf" \ -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. | 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 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: ```json { "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: ```bash # 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: ```json { "id": "9b7e4d2c-8f1a-4b3e-9c6d-2a5f7e1b0c3d", "type": "lead.captured", "created_at": "2026-11-28T09:30:00+00:00", "data": { "lead": { "id": 3051, "email": "ana@example.com", "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: ```javascript 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: ```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: ```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 - `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. `data`: `document` (Document), `visitor` (object { id, email, country, source }), `opened_at` (string). - `lead.captured`: A viewer gives their email on an email-gated document. Sent once per email per document. `data`: `lead` (Lead), `document` (Document). - `document.converted`: A Word or PowerPoint file has been converted and its share link works. `data`: `document` (Document). - `document.conversion_failed`: A Word or PowerPoint file could not be converted. `data`: `document` (Document), `error` (string). - `webhook.ping`: A test event, sent when you press Send test or call `POST /webhooks/{id}/test`. You cannot subscribe to it. `data`: `webhook_id` (integer), `message` (string). ## Endpoints ### Account Check a key and see your plan limits. #### GET / API status. The API name and version. Needs no key. Responses: `200` The API is up. ```bash curl https://sharepdf.app/api/v1 ``` #### GET /me Get your account. The account behind the key, its plan and its limits. Responses: `200` The account. → `{ data: Account }` ```bash 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. - `page` (query, integer): Page number, from 1. - `per_page` (query, integer): Results per page, 1 to 100. Default 25. Responses: `200` A page of documents. → `{ data: Document[], links, meta }` ```bash 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`). - `file` (body, string): The file, up to 95 MB or your plan's limit. - `source_url` (body, string): A public http or https URL to download the file from. - `upload_key` (body, string): The key from `POST /uploads`, once the file is uploaded. - `name` (body, string): Name shown to viewers. Defaults to the file name. - `client_upload_id` (body, string): Your own id, up to 100 characters. Retrying with it returns the first document. Send the body as `multipart/form-data`. Responses: `201` A PDF was added and its link works. → `{ data: Document }`; `202` A Word or PowerPoint file is being converted. → `{ data: Document }`; `200` This upload was already added; here it is. → `{ data: Document }`; `403` Your plan's active PDF limit is reached.; `409` The direct upload has not been sent yet.; `410` This upload was added and has since been deleted.; `422` A field is invalid.; `429` A daily cap was reached, or another upload is in progress. ```bash curl https://sharepdf.app/api/v1/documents \ -H "Authorization: Bearer $SHAREPDF_API_KEY" \ -H "Accept: application/json" \ -F "file=@deck.pptx" -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. - `document` (path, string, required): The document id. Responses: `200` The document. → `{ data: Document }`; `404` Not found. ```bash 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. - `document` (path, string, required): The document id. - `name` (body, string): Name shown to viewers. - `slug` (body, string): 3 to 30 lowercase letters, numbers and hyphens. Null removes it. - `visibility` (body, string): Who can open it. One of: `unlisted`, `public`, `private`. - `allow_download` (body, boolean): Show a download button. - `require_email` (body, boolean): Ask for an email before it opens. - `password` (body, string): 4 to 128 characters. Null removes it. - `expires_at` (body, string): A future date and time. Null removes it. Send the body as `application/json`. Responses: `200` The updated document. → `{ data: Document }`; `404` Not found.; `409` The document is still being converted.; `422` A field is invalid. ```bash 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. - `document` (path, string, required): The document id. Responses: `204` Deleted.; `404` Not found. ```bash 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. - `document` (path, string, required): The document id. - `file` (body, string): The new PDF. - `source_url` (body, string): A public URL to download the new PDF from. - `upload_key` (body, string): The key from `POST /uploads`. - `name` (body, string): A new name. Keeps the old one if left out. Send the body as `multipart/form-data`. Responses: `200` The document with its new file. → `{ data: Document }`; `404` Not found.; `409` The document is still being converted.; `422` A field is invalid.; `429` The daily upload cap was reached. ```bash curl https://sharepdf.app/api/v1/documents/k7Qm2xPa9/file \ -H "Authorization: Bearer $SHAREPDF_API_KEY" \ -H "Accept: application/json" \ -F "file=@proposal-v2.pdf" ``` #### 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. - `document` (path, string, required): The document id. - `format` (query, string): Defaults to `png`. One of: `png`, `svg`. - `size` (query, integer): Width in pixels, 128 to 2048. Default 512. - `link` (query, string): `custom_domain` encodes the link on your custom domain. Default `share`. One of: `share`, `custom_domain`. Responses: `200` The image.; `404` Not found.; `409` The document is still being converted.; `422` A field is invalid. ```bash 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`. - `filename` (body, string, required): Ends in .pdf, .docx or .pptx. - `size` (body, integer, required): File size in bytes, within your plan's limit. Send the body as `application/json`. Responses: `201` Where to upload the file. → `{ data: Upload }`; `403` Your plan's active PDF limit is reached.; `422` A field is invalid.; `429` A daily cap was reached. ```bash 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. - `document` (query, string): Only leads from this document id. - `email` (query, string): Only this email, ignoring case. - `after_id` (query, integer): Only leads with a higher id. - `page` (query, integer): Page number, from 1. - `per_page` (query, integer): Results per page, 1 to 100. Default 25. Responses: `200` A page of leads. → `{ data: Lead[], links, meta }`; `404` Not found.; `422` A field is invalid. ```bash 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=`. - `document` (path, string, required): The document id. - `email` (query, string): Only this email, ignoring case. - `after_id` (query, integer): Only leads with a higher id. - `page` (query, integer): Page number, from 1. - `per_page` (query, integer): Results per page, 1 to 100. Default 25. Responses: `200` A page of leads. → `{ data: Lead[], links, meta }`; `404` Not found.; `422` A field is invalid. ```bash 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. - `lead` (path, integer, required): The lead id. Responses: `204` Deleted.; `404` Not found. ```bash 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. - `period` (query, string): Defaults to `30d`. One of: `today`, `7d`, `30d`, `90d`, `all`. Responses: `200` Analytics. → `{ data: Analytics }`; `422` A field is invalid. ```bash 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. - `document` (path, string, required): The document id. - `period` (query, string): Defaults to `30d`. One of: `today`, `7d`, `30d`, `90d`, `all`. Responses: `200` Analytics. → `{ data: DocumentAnalytics }`; `404` Not found.; `409` The document is still being converted.; `422` A field is invalid. ```bash 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: `200` All webhooks. → `{ data: Webhook[] }` ```bash 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. - `url` (body, string, required): An https URL on port 443 that resolves to a public address. - `events` (body, array, required): One or more events. One of: `document.opened`, `document.converted`, `document.conversion_failed`, `lead.captured`. - `description` (body, string): A note, up to 255 characters. Send the body as `application/json`. Responses: `201` The webhook and its secret. → `{ data: WebhookWithSecret }`; `403` Your plan's webhook limit is reached.; `422` A field is invalid. ```bash 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. - `webhook` (path, integer, required): The webhook id. Responses: `200` The webhook. → `{ data: Webhook }`; `404` Not found. ```bash 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. - `webhook` (path, integer, required): The webhook id. - `url` (body, string): An https URL on port 443 that resolves to a public address. - `events` (body, array): One or more events. One of: `document.opened`, `document.converted`, `document.conversion_failed`, `lead.captured`. - `description` (body, string): A note, up to 255 characters. - `enabled` (body, boolean): Switch it on or off. Send the body as `application/json`. Responses: `200` The updated webhook. → `{ data: Webhook }`; `404` Not found.; `422` A field is invalid. ```bash 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. - `webhook` (path, integer, required): The webhook id. Responses: `204` Deleted.; `404` Not found. ```bash 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. - `webhook` (path, integer, required): The webhook id. Responses: `200` The webhook and its new secret. → `{ data: WebhookWithSecret }`; `404` Not found. ```bash 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. - `webhook` (path, integer, required): The webhook id. Responses: `202` The queued delivery. → `{ data: WebhookDelivery }`; `404` Not found.; `429` More than 5 tests a minute. ```bash 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. - `webhook` (path, integer, required): The webhook id. - `page` (query, integer): Page number, from 1. - `per_page` (query, integer): Results per page, 1 to 100. Default 25. Responses: `200` A page of deliveries. → `{ data: WebhookDelivery[], links, meta }`; `404` Not found. ```bash 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. - `id` (integer): Account id. - `name` (string): Account name. - `email` (string): Account email. - `plan` (string): Current plan, such as `pro`, `max` or `business`. - `limits` (object { max_active_pdfs, max_file_size_kb, api }): Plan limits. ### Document A shared document. - `id` (string): Document id, used in URLs. - `name` (string): File name shown to viewers. Always ends in `.pdf`. - `title` (string): `name` without the `.pdf` ending, for showing in your own app. - `slug` (string, nullable): Custom words at the start of the link. - `status` (string): `ready` once the link works. Word and PowerPoint files start as `queued`. One of: `queued`, `processing`, `ready`, `failed`. - `visibility` (string): `unlisted`: anyone with the link. `public`: also indexed by search engines. `private`: the link is off. One of: `unlisted`, `public`, `private`. - `share_url` (string, nullable): The link to send. Null until the document is ready. - `custom_domain_url` (string, nullable): The link on your custom domain, when one is active. - `allow_download` (boolean): Whether viewers see a download button. - `require_email` (boolean): Whether viewers must give an email first. - `password_protected` (boolean): Whether the link needs a password. - `expires_at` (string, nullable): When the link stops working. - `preview_image_url` (string, nullable): A JPEG of the first page, the same image link previews use. Null until the document is ready. - `qr_url` (string): API URL for a QR code of the share link. Needs your API key, like any other request. - `views_count` (integer): Total views, updated every few minutes. - `file_size` (integer): Size of the PDF in bytes. - `created_at` (string): When it was added. - `updated_at` (string): When it last changed. ### Upload A direct upload: PUT the file to `upload_url`, then confirm it with `POST /documents`. - `upload_key` (string): Send this to `POST /documents` once the file is uploaded. - `upload_url` (string): Where to PUT the file. - `method` (string): Always `PUT`. One of: `PUT`. - `headers` (object): Headers to send with the PUT. - `expires_at` (string): When `upload_url` and `upload_key` stop working. ### Lead An email a viewer gave on an email-gated document. - `id` (integer): Lead id. - `email` (string): The email they gave. - `document_id` (string): The document it was captured on. - `document_name` (string): That document's name. - `referrer` (string, nullable): The page the viewer came from, when known. - `created_at` (string): When it was captured. ### Webhook A webhook endpoint. - `id` (integer): Webhook id. - `url` (string): Where events are sent. - `description` (string, nullable): Your note. - `events` (array): Events it receives. One of: `document.opened`, `document.converted`, `document.conversion_failed`, `lead.captured`. - `enabled` (boolean): Whether events are sent. - `disabled_reason` (string, nullable): Why it was switched off. - `consecutive_failures` (integer): Events in a row that failed every attempt. - `last_succeeded_at` (string, nullable): Last successful delivery. - `last_failed_at` (string, nullable): Last failed delivery. - `created_at` (string): When it was added. - `updated_at` (string): When it last changed. ### WebhookWithSecret A webhook with its signing secret. Returned only when it is created or its secret is replaced. - `id` (integer): Webhook id. - `url` (string): Where events are sent. - `events` (array): Events it receives. One of: `document.opened`, `document.converted`, `document.conversion_failed`, `lead.captured`. - `enabled` (boolean): Whether events are sent. - `secret` (string): 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. - `id` (integer): Delivery id, also sent as `SharePDF-Delivery`. - `event_id` (string): Event id, also sent as `SharePDF-Event-Id`. - `event` (string): Event type. - `status` (string): `pending` while it is queued or waiting to retry. One of: `pending`, `succeeded`, `failed`. - `attempts` (integer): Attempts so far. - `response_status` (integer, nullable): HTTP status your endpoint answered with. - `response_excerpt` (string, nullable): The start of your endpoint's answer. - `error` (string, nullable): Why the last attempt failed. - `next_attempt_at` (string, nullable): When it will be retried. - `delivered_at` (string, nullable): When it succeeded. - `created_at` (string): When the event happened. - `payload` (object): The exact JSON that was sent. ### Analytics Views across all your documents. The same numbers as the dashboard. - `period` (string): The period asked for. One of: `today`, `7d`, `30d`, `90d`, `all`. - `summary` (object { views, unique_visitors, repeat_visitors, repeat_visitor_rate, avg_daily_views, avg_read_seconds, views_change_percent, unique_visitors_change_percent }): Totals for the period. - `views_over_time` (array of { date, views }): Views per day. - `countries` (array of { country, views }): Views by country. - `locations` (array of { city, region, country, views }): Views by city. - `referrers` (array of { referrer, views }): Views by the site that linked to the document. - `sources` (array of { source, views, percentage }): Views by where viewers came from. - `devices` (array of { device, views, percentage }): Views by device type. - `top_documents` (array of { id, name, views }): Most viewed documents. ### DocumentAnalytics Views of one document, with reading time per page. - `document_id` (string): Document id. - `period` (string): The period asked for. One of: `today`, `7d`, `30d`, `90d`, `all`. - `summary` (object { views, unique_visitors, repeat_visitors, repeat_visitor_rate, avg_daily_views, avg_read_seconds, views_change_percent, unique_visitors_change_percent }): Totals for the period. - `views_over_time` (array of { date, views }): Views per day. - `countries` (array of { country, views }): Views by country. - `locations` (array of { city, region, country, views }): Views by city. - `referrers` (array of { referrer, views }): Views by the site that linked to the document. - `sources` (array of { source, views, percentage }): Views by where viewers came from. - `devices` (array of { device, views, percentage }): Views by device type. - `pages` (object { total_pages, completion_rate, pages }): Reading time per page. ### Error An error. - `message` (string): What went wrong. ### ValidationError One or more fields are invalid. - `message` (string): The first problem. - `errors` (object): Messages for each field.