{"openapi":"3.1.0","info":{"title":"SharePDF API","version":"1.0.0","description":"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.","contact":{"email":"hey@sharepdf.app"}},"externalDocs":{"url":"https://sharepdf.app/docs/api"},"servers":[{"url":"https://sharepdf.app/api/v1"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Account","description":"Check a key and see your plan limits."},{"name":"Documents","description":"Upload files, get share links, and change who can open them."},{"name":"Leads","description":"Emails viewers gave on your email-gated documents."},{"name":"Analytics","description":"The same numbers as your dashboard. Limited to 20 requests a minute."},{"name":"Webhook endpoints","description":"Manage where events are sent. The same as Settings → Webhooks."}],"paths":{"/":{"get":{"operationId":"api-index","summary":"API status","description":"The API name and version. Needs no key.","tags":["Account"],"security":[],"responses":{"200":{"description":"The API is up."}}}},"/me":{"get":{"operationId":"me","summary":"Get your account","description":"The account behind the key, its plan and its limits.","tags":["Account"],"responses":{"200":{"description":"The account.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Account"}},"required":["data"]}}}}}}},"/documents":{"get":{"operationId":"list-documents","summary":"List documents","description":"Your documents, newest first.","tags":["Documents"],"parameters":[{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer"},"example":1},{"name":"per_page","in":"query","required":false,"description":"Results per page, 1 to 100. Default 25.","schema":{"type":"integer"},"example":25}],"responses":{"200":{"description":"A page of documents.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"links":{"type":"object","properties":{"first":{"type":["string","null"]},"last":{"type":["string","null"]},"prev":{"type":["string","null"]},"next":{"type":["string","null"]}}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}},"required":["data","links","meta"]}}}}}},"post":{"operationId":"create-document","summary":"Upload a document","description":"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`).","tags":["Documents"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","description":"The file, up to 95 MB or your plan's limit.","format":"binary"},"source_url":{"type":"string","description":"A public http or https URL to download the file from.","format":"uri"},"upload_key":{"type":"string","description":"The key from `POST /uploads`, once the file is uploaded.","format":"uuid"},"name":{"type":"string","description":"Name shown to viewers. Defaults to the file name."},"client_upload_id":{"type":"string","description":"Your own id, up to 100 characters. Retrying with it returns the first document."}}}}}},"responses":{"201":{"description":"A PDF was added and its link works.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}},"required":["data"]}}}},"202":{"description":"A Word or PowerPoint file is being converted.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}},"required":["data"]}}}},"200":{"description":"This upload was already added; here it is.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}},"required":["data"]}}}},"403":{"description":"Your plan's active PDF limit is reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The direct upload has not been sent yet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"This upload was added and has since been deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"429":{"description":"A daily cap was reached, or another upload is in progress.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/documents/{document}":{"get":{"operationId":"get-document","summary":"Get a document","description":"One document. Poll it to see a conversion finish.","tags":["Documents"],"parameters":[{"name":"document","in":"path","required":true,"description":"The document id.","schema":{"type":"string"},"example":"k7Qm2xPa9"}],"responses":{"200":{"description":"The document.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}},"required":["data"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"update-document","summary":"Update a document","description":"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.","tags":["Documents"],"parameters":[{"name":"document","in":"path","required":true,"description":"The document id.","schema":{"type":"string"},"example":"k7Qm2xPa9"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Name shown to viewers."},"slug":{"type":["string","null"],"description":"3 to 30 lowercase letters, numbers and hyphens. Null removes it."},"visibility":{"type":"string","description":"Who can open it.","enum":["unlisted","public","private"]},"allow_download":{"type":"boolean","description":"Show a download button."},"require_email":{"type":"boolean","description":"Ask for an email before it opens."},"password":{"type":["string","null"],"description":"4 to 128 characters. Null removes it."},"expires_at":{"type":["string","null"],"description":"A future date and time. Null removes it.","format":"date-time"}}}}}},"responses":{"200":{"description":"The updated document.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}},"required":["data"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The document is still being converted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}},"delete":{"operationId":"delete-document","summary":"Delete a document","description":"The link stops working at once. The document stays in the trash for 7 days, where it can be restored from the dashboard.","tags":["Documents"],"parameters":[{"name":"document","in":"path","required":true,"description":"The document id.","schema":{"type":"string"},"example":"k7Qm2xPa9"}],"responses":{"204":{"description":"Deleted."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/documents/{document}/file":{"post":{"operationId":"replace-document-file","summary":"Replace the file","description":"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.","tags":["Documents"],"parameters":[{"name":"document","in":"path","required":true,"description":"The document id.","schema":{"type":"string"},"example":"k7Qm2xPa9"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","description":"The new PDF.","format":"binary"},"source_url":{"type":"string","description":"A public URL to download the new PDF from.","format":"uri"},"upload_key":{"type":"string","description":"The key from `POST /uploads`.","format":"uuid"},"name":{"type":"string","description":"A new name. Keeps the old one if left out."}}}}}},"responses":{"200":{"description":"The document with its new file.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Document"}},"required":["data"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The document is still being converted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"429":{"description":"The daily upload cap was reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/documents/{document}/qr":{"get":{"operationId":"document-qr","summary":"Get a QR code","description":"A QR code image for the document's link. The `X-QR-Content` header holds the encoded URL.","tags":["Documents"],"parameters":[{"name":"document","in":"path","required":true,"description":"The document id.","schema":{"type":"string"},"example":"k7Qm2xPa9"},{"name":"format","in":"query","required":false,"description":"Defaults to `png`.","schema":{"type":"string","enum":["png","svg"]},"example":"svg"},{"name":"size","in":"query","required":false,"description":"Width in pixels, 128 to 2048. Default 512.","schema":{"type":"integer"},"example":1024},{"name":"link","in":"query","required":false,"description":"`custom_domain` encodes the link on your custom domain. Default `share`.","schema":{"type":"string","enum":["share","custom_domain"]},"example":"share"}],"responses":{"200":{"description":"The image.","content":{"image/png":{"schema":{"type":"string","format":"binary"}},"image/svg+xml":{"schema":{"type":"string"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The document is still being converted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}}},"/uploads":{"post":{"operationId":"create-upload","summary":"Start a direct upload","description":"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`.","tags":["Documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","description":"Ends in .pdf, .docx or .pptx."},"size":{"type":"integer","description":"File size in bytes, within your plan's limit."}},"required":["filename","size"]}}}},"responses":{"201":{"description":"Where to upload the file.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Upload"}},"required":["data"]}}}},"403":{"description":"Your plan's active PDF limit is reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"429":{"description":"A daily cap was reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/leads":{"get":{"operationId":"list-leads","summary":"List leads","description":"Newest first. With `after_id`, only later leads, oldest first.","tags":["Leads"],"parameters":[{"name":"document","in":"query","required":false,"description":"Only leads from this document id.","schema":{"type":"string"},"example":"k7Qm2xPa9"},{"name":"email","in":"query","required":false,"description":"Only this email, ignoring case.","schema":{"type":"string"},"example":"ana@example.com"},{"name":"after_id","in":"query","required":false,"description":"Only leads with a higher id.","schema":{"type":"integer"},"example":3050},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer"},"example":1},{"name":"per_page","in":"query","required":false,"description":"Results per page, 1 to 100. Default 25.","schema":{"type":"integer"},"example":25}],"responses":{"200":{"description":"A page of leads.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"links":{"type":"object","properties":{"first":{"type":["string","null"]},"last":{"type":["string","null"]},"prev":{"type":["string","null"]},"next":{"type":["string","null"]}}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}},"required":["data","links","meta"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}}},"/documents/{document}/leads":{"get":{"operationId":"list-document-leads","summary":"List a document's leads","description":"The same as `GET /leads?document=`.","tags":["Leads"],"parameters":[{"name":"document","in":"path","required":true,"description":"The document id.","schema":{"type":"string"},"example":"k7Qm2xPa9"},{"name":"email","in":"query","required":false,"description":"Only this email, ignoring case.","schema":{"type":"string"},"example":"ana@example.com"},{"name":"after_id","in":"query","required":false,"description":"Only leads with a higher id.","schema":{"type":"integer"},"example":3050},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer"},"example":1},{"name":"per_page","in":"query","required":false,"description":"Results per page, 1 to 100. Default 25.","schema":{"type":"integer"},"example":25}],"responses":{"200":{"description":"A page of leads.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"links":{"type":"object","properties":{"first":{"type":["string","null"]},"last":{"type":["string","null"]},"prev":{"type":["string","null"]},"next":{"type":["string","null"]}}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}},"required":["data","links","meta"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}}},"/leads/{lead}":{"delete":{"operationId":"delete-lead","summary":"Delete a lead","description":"Remove a captured email, for example when the viewer asks you to.","tags":["Leads"],"parameters":[{"name":"lead","in":"path","required":true,"description":"The lead id.","schema":{"type":"integer"},"example":3051}],"responses":{"204":{"description":"Deleted."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/analytics":{"get":{"operationId":"analytics","summary":"Account analytics","description":"Views across all your documents.","tags":["Analytics"],"parameters":[{"name":"period","in":"query","required":false,"description":"Defaults to `30d`.","schema":{"type":"string","enum":["today","7d","30d","90d","all"]},"example":"7d"}],"responses":{"200":{"description":"Analytics.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Analytics"}},"required":["data"]}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}}},"/documents/{document}/analytics":{"get":{"operationId":"document-analytics","summary":"Document analytics","description":"Views of one document, with reading time per page.","tags":["Analytics"],"parameters":[{"name":"document","in":"path","required":true,"description":"The document id.","schema":{"type":"string"},"example":"k7Qm2xPa9"},{"name":"period","in":"query","required":false,"description":"Defaults to `30d`.","schema":{"type":"string","enum":["today","7d","30d","90d","all"]},"example":"7d"}],"responses":{"200":{"description":"Analytics.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DocumentAnalytics"}},"required":["data"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The document is still being converted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}}},"/webhooks":{"get":{"operationId":"list-webhooks","summary":"List webhooks","description":"Your endpoints, oldest first. Signing secrets are not included.","tags":["Webhook endpoints"],"responses":{"200":{"description":"All webhooks.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["data"]}}}}}},"post":{"operationId":"create-webhook","summary":"Add a webhook","description":"The response includes the signing secret, once.","tags":["Webhook endpoints"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"An https URL on port 443 that resolves to a public address.","format":"uri"},"events":{"type":"array","description":"One or more events.","items":{"type":"string","enum":["document.opened","document.converted","document.conversion_failed","lead.captured"]}},"description":{"type":["string","null"],"description":"A note, up to 255 characters."}},"required":["url","events"]}}}},"responses":{"201":{"description":"The webhook and its secret.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookWithSecret"}},"required":["data"]}}}},"403":{"description":"Your plan's webhook limit is reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}}},"/webhooks/{webhook}":{"get":{"operationId":"get-webhook","summary":"Get a webhook","description":"One endpoint, without its secret.","tags":["Webhook endpoints"],"parameters":[{"name":"webhook","in":"path","required":true,"description":"The webhook id.","schema":{"type":"integer"},"example":17}],"responses":{"200":{"description":"The webhook.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Webhook"}},"required":["data"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"update-webhook","summary":"Update a webhook","description":"Send only the fields to change. Switching it back on clears its failure count.","tags":["Webhook endpoints"],"parameters":[{"name":"webhook","in":"path","required":true,"description":"The webhook id.","schema":{"type":"integer"},"example":17}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"An https URL on port 443 that resolves to a public address.","format":"uri"},"events":{"type":"array","description":"One or more events.","items":{"type":"string","enum":["document.opened","document.converted","document.conversion_failed","lead.captured"]}},"description":{"type":["string","null"],"description":"A note, up to 255 characters."},"enabled":{"type":"boolean","description":"Switch it on or off."}}}}}},"responses":{"200":{"description":"The updated webhook.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Webhook"}},"required":["data"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"A field is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}}}},"delete":{"operationId":"delete-webhook","summary":"Delete a webhook","description":"Stops all events to it and removes its delivery history.","tags":["Webhook endpoints"],"parameters":[{"name":"webhook","in":"path","required":true,"description":"The webhook id.","schema":{"type":"integer"},"example":17}],"responses":{"204":{"description":"Deleted."},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{webhook}/rotate-secret":{"post":{"operationId":"rotate-webhook-secret","summary":"Replace the signing secret","description":"The old secret stops working at once. The response includes the new one, once.","tags":["Webhook endpoints"],"parameters":[{"name":"webhook","in":"path","required":true,"description":"The webhook id.","schema":{"type":"integer"},"example":17}],"responses":{"200":{"description":"The webhook and its new secret.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookWithSecret"}},"required":["data"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{webhook}/test":{"post":{"operationId":"test-webhook","summary":"Send a test event","description":"Queues a `webhook.ping` event, even to a switched-off endpoint. Follow it with the deliveries endpoint. Limited to 5 a minute.","tags":["Webhook endpoints"],"parameters":[{"name":"webhook","in":"path","required":true,"description":"The webhook id.","schema":{"type":"integer"},"example":17}],"responses":{"202":{"description":"The queued delivery.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookDelivery"}},"required":["data"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"More than 5 tests a minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{webhook}/deliveries":{"get":{"operationId":"list-webhook-deliveries","summary":"List deliveries","description":"Events sent to the endpoint in the last 30 days, newest first, with your endpoint's answers.","tags":["Webhook endpoints"],"parameters":[{"name":"webhook","in":"path","required":true,"description":"The webhook id.","schema":{"type":"integer"},"example":17},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer"},"example":1},{"name":"per_page","in":"query","required":false,"description":"Results per page, 1 to 100. Default 25.","schema":{"type":"integer"},"example":25}],"responses":{"200":{"description":"A page of deliveries.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"links":{"type":"object","properties":{"first":{"type":["string","null"]},"last":{"type":["string","null"]},"prev":{"type":["string","null"]},"next":{"type":["string","null"]}}},"meta":{"type":"object","properties":{"current_page":{"type":"integer"},"last_page":{"type":"integer"},"per_page":{"type":"integer"},"total":{"type":"integer"}}}},"required":["data","links","meta"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"An API key from Settings → API keys."}},"schemas":{"Account":{"type":"object","description":"The account behind the API key, with its plan limits.","properties":{"id":{"type":"integer","description":"Account id.","examples":[4821]},"name":{"type":"string","description":"Account name.","examples":["Ana Silva"]},"email":{"type":"string","description":"Account email.","format":"email","examples":["ana@example.com"]},"plan":{"type":"string","description":"Current plan, such as `pro`, `max` or `business`.","examples":["pro"]},"limits":{"type":"object","description":"Plan limits.","properties":{"max_active_pdfs":{"type":["integer","null"],"description":"Most documents the account can have at once. Null means no limit.","examples":[100]},"max_file_size_kb":{"type":["integer","null"],"description":"Largest file, in kilobytes.","examples":[51200]},"api":{"type":["object","null"],"description":"API limits: `api_keys`, `requests_per_minute`, `requests_per_month`, `webhook_endpoints`, `uploads_per_day` and `conversions_per_day`.","examples":[{"api_keys":2,"requests_per_minute":30,"requests_per_month":1000,"webhook_endpoints":1,"uploads_per_day":50,"conversions_per_day":10}]}}}},"required":["id","name","email","plan","limits"]},"Document":{"type":"object","description":"A shared document.","properties":{"id":{"type":"string","description":"Document id, used in URLs.","examples":["k7Qm2xPa9"]},"name":{"type":"string","description":"File name shown to viewers. Always ends in `.pdf`.","examples":["Proposal.pdf"]},"title":{"type":"string","description":"`name` without the `.pdf` ending, for showing in your own app.","examples":["Proposal"]},"slug":{"type":["string","null"],"description":"Custom words at the start of the link.","examples":["acme-proposal"]},"status":{"type":"string","description":"`ready` once the link works. Word and PowerPoint files start as `queued`.","enum":["queued","processing","ready","failed"],"examples":["ready"]},"visibility":{"type":"string","description":"`unlisted`: anyone with the link. `public`: also indexed by search engines. `private`: the link is off.","enum":["unlisted","public","private"],"examples":["unlisted"]},"share_url":{"type":["string","null"],"description":"The link to send. Null until the document is ready.","format":"uri","examples":["https://sharepdf.link/s/acme-proposal-k7Qm2xPa9.pdf"]},"custom_domain_url":{"type":["string","null"],"description":"The link on your custom domain, when one is active.","format":"uri","examples":[null]},"allow_download":{"type":"boolean","description":"Whether viewers see a download button.","examples":[true]},"require_email":{"type":"boolean","description":"Whether viewers must give an email first.","examples":[false]},"password_protected":{"type":"boolean","description":"Whether the link needs a password.","examples":[false]},"expires_at":{"type":["string","null"],"description":"When the link stops working.","format":"date-time","examples":[null]},"preview_image_url":{"type":["string","null"],"description":"A JPEG of the first page, the same image link previews use. Null until the document is ready.","format":"uri","examples":["https://sharepdf.link/s/acme-proposal-k7Qm2xPa9.pdf/og"]},"qr_url":{"type":"string","description":"API URL for a QR code of the share link. Needs your API key, like any other request.","format":"uri","examples":["https://sharepdf.app/api/v1/documents/k7Qm2xPa9/qr"]},"views_count":{"type":"integer","description":"Total views, updated every few minutes.","examples":[12]},"file_size":{"type":"integer","description":"Size of the PDF in bytes.","examples":[482133]},"created_at":{"type":"string","description":"When it was added.","format":"date-time","examples":["2026-11-28T09:12:44+00:00"]},"updated_at":{"type":"string","description":"When it last changed.","format":"date-time","examples":["2026-11-28T09:12:44+00:00"]}},"required":["id","name","title","slug","status","visibility","share_url","custom_domain_url","allow_download","require_email","password_protected","expires_at","preview_image_url","qr_url","views_count","file_size","created_at","updated_at"]},"Upload":{"type":"object","description":"A direct upload: PUT the file to `upload_url`, then confirm it with `POST /documents`.","properties":{"upload_key":{"type":"string","description":"Send this to `POST /documents` once the file is uploaded.","format":"uuid","examples":["0b8f4a3e-6c2d-4e9b-a1f7-5d3c8e2b9a64"]},"upload_url":{"type":"string","description":"Where to PUT the file.","format":"uri","examples":["https://uploads.example.com/pdfs/0b8f4a3e.pdf?X-Amz-Signature=…"]},"method":{"type":"string","description":"Always `PUT`.","enum":["PUT"],"examples":["PUT"]},"headers":{"type":"object","description":"Headers to send with the PUT.","examples":[{"Content-Type":"application/pdf"}]},"expires_at":{"type":"string","description":"When `upload_url` and `upload_key` stop working.","format":"date-time","examples":["2026-11-28T09:27:44+00:00"]}},"required":["upload_key","upload_url","method","headers","expires_at"]},"Lead":{"type":"object","description":"An email a viewer gave on an email-gated document.","properties":{"id":{"type":"integer","description":"Lead id.","examples":[3051]},"email":{"type":"string","description":"The email they gave.","format":"email","examples":["ana@example.com"]},"document_id":{"type":"string","description":"The document it was captured on.","examples":["k7Qm2xPa9"]},"document_name":{"type":"string","description":"That document's name.","examples":["Proposal.pdf"]},"referrer":{"type":["string","null"],"description":"The page the viewer came from, when known.","examples":["https://mail.example.com/"]},"created_at":{"type":"string","description":"When it was captured.","format":"date-time","examples":["2026-11-28T09:30:00+00:00"]}},"required":["id","email","document_id","document_name","referrer","created_at"]},"Webhook":{"type":"object","description":"A webhook endpoint.","properties":{"id":{"type":"integer","description":"Webhook id.","examples":[17]},"url":{"type":"string","description":"Where events are sent.","format":"uri","examples":["https://hooks.example.com/sharepdf"]},"description":{"type":["string","null"],"description":"Your note.","examples":["CRM sync"]},"events":{"type":"array","description":"Events it receives.","items":{"type":"string","enum":["document.opened","document.converted","document.conversion_failed","lead.captured"]},"examples":[["lead.captured","document.opened"]]},"enabled":{"type":"boolean","description":"Whether events are sent.","examples":[true]},"disabled_reason":{"type":["string","null"],"description":"Why it was switched off.","examples":[null]},"consecutive_failures":{"type":"integer","description":"Events in a row that failed every attempt.","examples":[0]},"last_succeeded_at":{"type":["string","null"],"description":"Last successful delivery.","format":"date-time","examples":["2026-11-28T09:30:02+00:00"]},"last_failed_at":{"type":["string","null"],"description":"Last failed delivery.","format":"date-time","examples":[null]},"created_at":{"type":"string","description":"When it was added.","format":"date-time","examples":["2026-11-28T09:00:00+00:00"]},"updated_at":{"type":"string","description":"When it last changed.","format":"date-time","examples":["2026-11-28T09:00:00+00:00"]}},"required":["id","url","description","events","enabled","disabled_reason","consecutive_failures","last_succeeded_at","last_failed_at","created_at","updated_at"]},"WebhookWithSecret":{"type":"object","description":"A webhook with its signing secret. Returned only when it is created or its secret is replaced.","properties":{"id":{"type":"integer","description":"Webhook id.","examples":[17]},"url":{"type":"string","description":"Where events are sent.","format":"uri","examples":["https://hooks.example.com/sharepdf"]},"events":{"type":"array","description":"Events it receives.","items":{"type":"string","enum":["document.opened","document.converted","document.conversion_failed","lead.captured"]},"examples":[["lead.captured"]]},"enabled":{"type":"boolean","description":"Whether events are sent.","examples":[true]},"secret":{"type":"string","description":"The signing secret. Store it now: it is not shown again.","examples":["whsec_Xk3…"]}},"required":["id","url","events","enabled","secret"]},"WebhookDelivery":{"type":"object","description":"One event sent, or being sent, to a webhook. Kept for 30 days.","properties":{"id":{"type":"integer","description":"Delivery id, also sent as `SharePDF-Delivery`.","examples":[90412]},"event_id":{"type":"string","description":"Event id, also sent as `SharePDF-Event-Id`.","format":"uuid","examples":["9b7e4d2c-8f1a-4b3e-9c6d-2a5f7e1b0c3d"]},"event":{"type":"string","description":"Event type.","examples":["lead.captured"]},"status":{"type":"string","description":"`pending` while it is queued or waiting to retry.","enum":["pending","succeeded","failed"],"examples":["succeeded"]},"attempts":{"type":"integer","description":"Attempts so far.","examples":[1]},"response_status":{"type":["integer","null"],"description":"HTTP status your endpoint answered with.","examples":[200]},"response_excerpt":{"type":["string","null"],"description":"The start of your endpoint's answer.","examples":["ok"]},"error":{"type":["string","null"],"description":"Why the last attempt failed.","examples":[null]},"next_attempt_at":{"type":["string","null"],"description":"When it will be retried.","format":"date-time","examples":[null]},"delivered_at":{"type":["string","null"],"description":"When it succeeded.","format":"date-time","examples":["2026-11-28T09:30:02+00:00"]},"created_at":{"type":"string","description":"When the event happened.","format":"date-time","examples":["2026-11-28T09:30:00+00:00"]},"payload":{"type":"object","description":"The exact JSON that was sent.","examples":[{"id":"9b7e4d2c-8f1a-4b3e-9c6d-2a5f7e1b0c3d","type":"lead.captured","created_at":"2026-11-28T09:30:00+00:00","data":{"…":"…"}}]}},"required":["id","event_id","event","status","attempts","response_status","response_excerpt","error","next_attempt_at","delivered_at","created_at","payload"]},"Analytics":{"type":"object","description":"Views across all your documents. The same numbers as the dashboard.","properties":{"period":{"type":"string","description":"The period asked for.","enum":["today","7d","30d","90d","all"],"examples":["30d"]},"summary":{"type":"object","description":"Totals for the period.","properties":{"views":{"type":"integer","description":"Views.","examples":[42]},"unique_visitors":{"type":"integer","description":"Different visitors.","examples":[25]},"repeat_visitors":{"type":"integer","description":"Visitors who came back.","examples":[6]},"repeat_visitor_rate":{"type":"number","description":"Percent of visitors who came back.","examples":[24]},"avg_daily_views":{"type":"number","description":"Average views a day.","examples":[1.4]},"avg_read_seconds":{"type":"number","description":"Average reading time.","examples":[96.5]},"views_change_percent":{"type":["number","null"],"description":"Change from the previous period. Null when there is nothing to compare.","examples":[12.5]},"unique_visitors_change_percent":{"type":["number","null"],"description":"Change from the previous period.","examples":[8.7]}}},"views_over_time":{"type":"array","description":"Views per day.","items":{"type":"object","properties":{"date":{"type":"string","description":"Day, UTC.","format":"date","examples":["2026-11-27"]},"views":{"type":"integer","description":"Views that day.","examples":[3]}}}},"countries":{"type":"array","description":"Views by country.","items":{"type":"object","properties":{"country":{"type":"string","description":"Two-letter country code.","examples":["DE"]},"views":{"type":"integer","description":"Views.","examples":[11]}}}},"locations":{"type":"array","description":"Views by city.","items":{"type":"object","properties":{"city":{"type":"string","description":"City.","examples":["Berlin"]},"region":{"type":"string","description":"Region.","examples":["Berlin"]},"country":{"type":"string","description":"Two-letter country code.","examples":["DE"]},"views":{"type":"integer","description":"Views.","examples":[7]}}}},"referrers":{"type":"array","description":"Views by the site that linked to the document.","items":{"type":"object","properties":{"referrer":{"type":"string","description":"Referring page.","examples":["https://www.linkedin.com/"]},"views":{"type":"integer","description":"Views.","examples":[5]}}}},"sources":{"type":"array","description":"Views by where viewers came from.","items":{"type":"object","properties":{"source":{"type":"string","description":"Source.","enum":["direct","search","social","email","websites","other"],"examples":["email"]},"views":{"type":"integer","description":"Views.","examples":[18]},"percentage":{"type":"number","description":"Share of views, in percent.","examples":[42.9]}}}},"devices":{"type":"array","description":"Views by device type.","items":{"type":"object","properties":{"device":{"type":"string","description":"Device.","enum":["desktop","mobile","tablet","unknown"],"examples":["desktop"]},"views":{"type":"integer","description":"Views.","examples":[18]},"percentage":{"type":"number","description":"Share of views, in percent.","examples":[42.9]}}}},"top_documents":{"type":"array","description":"Most viewed documents.","items":{"type":"object","properties":{"id":{"type":"string","description":"Document id.","examples":["k7Qm2xPa9"]},"name":{"type":"string","description":"Document name.","examples":["Proposal.pdf"]},"views":{"type":"integer","description":"Views in the period.","examples":[42]}}}}},"required":["period","summary","views_over_time","countries","locations","referrers","sources","devices","top_documents"]},"DocumentAnalytics":{"type":"object","description":"Views of one document, with reading time per page.","properties":{"document_id":{"type":"string","description":"Document id.","examples":["k7Qm2xPa9"]},"period":{"type":"string","description":"The period asked for.","enum":["today","7d","30d","90d","all"],"examples":["30d"]},"summary":{"type":"object","description":"Totals for the period.","properties":{"views":{"type":"integer","description":"Views.","examples":[42]},"unique_visitors":{"type":"integer","description":"Different visitors.","examples":[25]},"repeat_visitors":{"type":"integer","description":"Visitors who came back.","examples":[6]},"repeat_visitor_rate":{"type":"number","description":"Percent of visitors who came back.","examples":[24]},"avg_daily_views":{"type":"number","description":"Average views a day.","examples":[1.4]},"avg_read_seconds":{"type":"number","description":"Average reading time.","examples":[96.5]},"views_change_percent":{"type":["number","null"],"description":"Change from the previous period. Null when there is nothing to compare.","examples":[12.5]},"unique_visitors_change_percent":{"type":["number","null"],"description":"Change from the previous period.","examples":[8.7]}}},"views_over_time":{"type":"array","description":"Views per day.","items":{"type":"object","properties":{"date":{"type":"string","description":"Day, UTC.","format":"date","examples":["2026-11-27"]},"views":{"type":"integer","description":"Views that day.","examples":[3]}}}},"countries":{"type":"array","description":"Views by country.","items":{"type":"object","properties":{"country":{"type":"string","description":"Two-letter country code.","examples":["DE"]},"views":{"type":"integer","description":"Views.","examples":[11]}}}},"locations":{"type":"array","description":"Views by city.","items":{"type":"object","properties":{"city":{"type":"string","description":"City.","examples":["Berlin"]},"region":{"type":"string","description":"Region.","examples":["Berlin"]},"country":{"type":"string","description":"Two-letter country code.","examples":["DE"]},"views":{"type":"integer","description":"Views.","examples":[7]}}}},"referrers":{"type":"array","description":"Views by the site that linked to the document.","items":{"type":"object","properties":{"referrer":{"type":"string","description":"Referring page.","examples":["https://www.linkedin.com/"]},"views":{"type":"integer","description":"Views.","examples":[5]}}}},"sources":{"type":"array","description":"Views by where viewers came from.","items":{"type":"object","properties":{"source":{"type":"string","description":"Source.","enum":["direct","search","social","email","websites","other"],"examples":["email"]},"views":{"type":"integer","description":"Views.","examples":[18]},"percentage":{"type":"number","description":"Share of views, in percent.","examples":[42.9]}}}},"devices":{"type":"array","description":"Views by device type.","items":{"type":"object","properties":{"device":{"type":"string","description":"Device.","enum":["desktop","mobile","tablet","unknown"],"examples":["desktop"]},"views":{"type":"integer","description":"Views.","examples":[18]},"percentage":{"type":"number","description":"Share of views, in percent.","examples":[42.9]}}}},"pages":{"type":"object","description":"Reading time per page.","properties":{"total_pages":{"type":["integer","null"],"description":"Pages in the document, once someone has read it.","examples":[8]},"completion_rate":{"type":["number","null"],"description":"Percent of readers who reached the last page.","examples":[41.7]},"pages":{"type":"array","description":"One row per page.","items":{"type":"object","properties":{"page":{"type":"integer","description":"Page number.","examples":[1]},"viewers":{"type":"integer","description":"Readers who saw it.","examples":[12]},"total_seconds":{"type":"number","description":"Time spent on it by everyone.","examples":[340.5]},"avg_seconds":{"type":"number","description":"Average time per reader.","examples":[28.4]}}}}}}},"required":["document_id","period","summary","views_over_time","countries","locations","referrers","sources","devices","pages"]},"Error":{"type":"object","description":"An error.","properties":{"message":{"type":"string","description":"What went wrong.","examples":["Invalid API key."]}},"required":["message"]},"ValidationError":{"type":"object","description":"One or more fields are invalid.","properties":{"message":{"type":"string","description":"The first problem.","examples":["The custom slug must be at least 3 characters."]},"errors":{"type":"object","description":"Messages for each field.","examples":[{"slug":["The custom slug must be at least 3 characters."]}]}},"required":["message","errors"]}}}}