### API Initialization with Python Source: https://pagedrop.dev/docs Initial setup for using the requests library with the PageDrop API. ```python import requests ``` -------------------------------- ### API Operations with cURL Source: https://pagedrop.dev/docs Command-line examples for deploying, retrieving, and deleting sites. ```bash curl -X POST "https://pagedrop.dev/api/v1/sites" \ -H "Content-Type: application/json" \ -d '{"html": "
Deployed with PageDrop
"} ) result = response.json() site = result["data"] print(f"Live at: {site['url']}") print(f"Expires: {site['expiresAt'] or 'Never'}") print(f"Delete token: {site['deleteToken']}") # Save this! ``` -------------------------------- ### GET /api/v1/sites/:siteId Source: https://pagedrop.dev/docs Retrieve metadata about a specific hosted site. ```APIDOC ## GET /api/v1/sites/:siteId ### Description Retrieve metadata about a hosted site. ### Method GET ### Endpoint /api/v1/sites/:siteId ### Parameters #### Path Parameters - **siteId** (string) - Required - The unique site identifier ### Response #### Success Response (200) - **siteId** (string) - The site identifier - **url** (string) - The site URL - **viewCount** (number) - Number of views #### Response Example { "status": "success", "data": { "siteId": "a1b2c3d4", "url": "https://pagedrop.dev/s/a1b2c3d4", "viewCount": 42 } } ``` -------------------------------- ### Get Site Metadata Source: https://pagedrop.dev/docs Retrieve metadata for a specific hosted site using its site ID. ```APIDOC ## GET /api/v1/sites/{siteId} ### Description Retrieves metadata for a specific hosted site. ### Method GET ### Endpoint https://pagedrop.dev/api/v1/sites/{siteId} ### Parameters #### Path Parameters - **siteId** (string) - Required - The unique identifier of the site. ### Response #### Success Response (200) - **data** (object) - Contains site information. - **url** (string) - The live URL of the deployed site. - **expiresAt** (string) - The expiration date of the site. - **deleteToken** (string) - The token required to delete the site. - **siteId** (string) - The unique identifier for the site. #### Response Example ```json { "data": { "url": "https://pagedrop.dev/site/abcdef123", "expiresAt": "2024-12-31T23:59:59Z", "deleteToken": "your_delete_token_here", "siteId": "abcdef123" } } ``` ``` -------------------------------- ### GET /api/v1/sites/:siteId/analytics Source: https://pagedrop.dev/docs Get detailed view analytics for a site, including daily view counts, top referrers, and recent views. ```APIDOC ## GET /api/v1/sites/:siteId/analytics ### Description Get detailed view analytics for a site. Returns daily view counts, top referrers, and the 20 most recent individual views. Requires the delete token — only the site owner can access analytics. ### Method GET ### Endpoint /api/v1/sites/:siteId/analytics ### Parameters #### Path Parameters - **siteId** (string) - Required - The ID of the site #### Headers - **X-Delete-Token** (string) - Required - The delete token returned when the site was created ### Response #### Success Response (200) - **status** (string) - Status of the operation - **data** (object) - Analytics data including `viewCount`, `recentViews`, `dailyViews`, and `topReferrers` #### Response Example { "status": "success", "data": { "siteId": "a1b2c3d4", "viewCount": 42, "recentViews": [ { "timestamp": "2026-03-11T14:30:00.000Z", "referrer": "https://twitter.com/someone/status/123" } ], "dailyViews": { "2026-03-11": 15 }, "topReferrers": [ { "referrer": "(direct)", "count": 20 } ] } } ``` -------------------------------- ### Upload PDF to Create Site Source: https://pagedrop.dev/docs Create a new hosted site by uploading a PDF file. The `file` field should contain the path to the PDF, prefixed with `@`. ```bash curl -X POST "https://pagedrop.dev/api/v1/sites" \ -F "file=@document.pdf" ``` -------------------------------- ### GET /api/v1/sites/:siteId Source: https://pagedrop.dev/llms.txt Retrieve metadata and analytics for a specific site. ```APIDOC ## GET /api/v1/sites/:siteId ### Description Get site metadata including viewCount analytics. ### Method GET ### Endpoint /api/v1/sites/:siteId ### Parameters #### Path Parameters - **siteId** (string) - Required - The unique identifier of the site ``` -------------------------------- ### Initialize Theme Management Source: https://pagedrop.dev/ Sets the document theme based on localStorage or system preference. ```javascript (function() { var saved = localStorage.getItem('sv-theme'); var prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; var theme = saved || (prefersDark ? 'dark' : 'light'); document.documentElement.setAttribute('data-theme', theme); })(); ``` -------------------------------- ### Create Site from Markdown Source: https://pagedrop.dev/docs Use this endpoint to create a new hosted site from Markdown content. A slug can be provided to customize the site's URL. ```bash curl -X POST "https://pagedrop.dev/api/v1/sites" \ -H "Content-Type: application/json" \ -d '{ "markdown": "# Hello World\n\nThis is **bold** and this is `code`.\n\n## Features\n\n- Auto-styled HTML\n- Dark/light mode\n- Responsive design", "slug": "my-readme" }' ``` -------------------------------- ### POST /sites Source: https://pagedrop.dev/docs Creates a new hosted site by accepting raw HTML, Markdown, or a file upload. ```APIDOC ## POST /api/v1/sites ### Description Create a new hosted site. Accepts JSON with raw HTML, Markdown, or a multipart form upload with a file (HTML, PDF, or ZIP). ### Method POST ### Endpoint /api/v1/sites ### Parameters #### Request Body **Option 1: JSON Body** - **html** (string) - required* - Raw HTML content to host. Max 15 MB. *Provide `html` or `markdown`, not both. - **markdown** (string) - required* - Markdown content — auto-rendered to a responsive, styled HTML page with dark/light mode support. Max 15 MB. *Provide `html` or `markdown`, not both. - **title** (string) - optional - Page title for markdown rendering. Auto-detected from the first `# heading` if omitted. - **ttl** (string) - optional - Time-to-live. Format: number + unit (`h`=hours, `d`=days, `m`=months). Examples: `1d`, `12h`, `30d`. Default: **never expires** (permanent). - **slug** (string) - optional - Custom vanity slug for the URL. 3-64 characters, lowercase alphanumeric and hyphens. Example: `"my-project"` → `/s/my-project`. Must be unique. - **ogTitle** (string) - optional - Custom Open Graph title for social media previews. Max 200 characters. Injected as `` when the page is served. - **ogDescription** (string) - optional - Custom Open Graph description for social media previews. Max 500 characters. Also sets ``. - **ogImage** (string) - optional - URL to an Open Graph image (1200x630px recommended). Enables `twitter:card=summary_large_image` for rich Twitter/X previews. - **password** (string) - optional - Password-protect the page. Visitors must enter this password before viewing the content. - **passwordExpiry** (number) - optional - Password cookie expiry in hours (1–720). Default: 24. After this period, visitors must re-enter the password. **Option 2: Multipart Upload** - **file** (file) - required - HTML file (.html), PDF file (.pdf), or ZIP archive (.zip) containing a project with an `index.html` at the root. PDF files are auto-wrapped in a viewer page. Max 10MB for PDF and ZIP. ### Request Example #### JSON Body Example ```json { "html": "Deployed with PageDrop!
" } ``` #### cURL Example (JSON Body) ```bash curl -X POST "https://pagedrop.dev/api/v1/sites" \ -H "Content-Type: application/json" \ -d '{"html": "Deployed with PageDrop!
"}' ``` ``` -------------------------------- ### Upload ZIP to Create Site Source: https://pagedrop.dev/docs This endpoint allows creating a hosted site by uploading a ZIP archive. Ensure the `file` field is correctly set to the path of your ZIP file, prefixed with `@`. ```bash curl -X POST "https://pagedrop.dev/api/v1/sites" \ -F "file=@my-project.zip" ``` -------------------------------- ### POST /api/v1/sites Source: https://pagedrop.dev/llms.txt Create a new hosted site by providing HTML, Markdown, or file content. ```APIDOC ## POST /api/v1/sites ### Description Create a new hosted site (HTML paste, Markdown paste, PDF upload, file upload, or ZIP deploy). ### Method POST ### Endpoint /api/v1/sites ### Request Body - **markdown** (string) - Optional - Auto-rendered Markdown content - **slug** (string) - Optional - Vanity URL slug - **ttl** (integer) - Optional - Time to live for expiry - **ogTitle** (string) - Optional - Custom Open Graph title - **ogDescription** (string) - Optional - Custom Open Graph description - **ogImage** (string) - Optional - Custom Open Graph image URL - **password** (string) - Optional - Password for protected pages ``` -------------------------------- ### Create Multiple Sites in Batch Source: https://pagedrop.dev/docs Efficiently create up to 20 sites in a single API call. This endpoint supports both HTML and Markdown content for each site within the `sites` array. Optional fields like `slug`, `ttl`, and OG tags can be specified per site. ```bash curl -X POST "https://pagedrop.dev/api/v1/sites/batch" \ -H "Content-Type: application/json" \ -d '{ "sites": [ { "html": "Deployed with PageDrop!
"}' ``` -------------------------------- ### Host HTML via POST Request Source: https://pagedrop.dev/ Use this command to deploy raw HTML content to PageDrop. The API returns a live URL and a delete token for future management. ```bash curl -X POST https://pagedrop.dev/api/v1/sites -H 'Content-Type: application/json' -d '{"html":"Deployed with PageDrop
" }) }); const { data } = await response.json(); console.log(`Live at: ${data.url}`); console.log(`Expires: ${data.expiresAt ?? "Never"}`); console.log(`Delete token: ${data.deleteToken}`); // Save this! // Get site metadata const meta = await fetch(`https://pagedrop.dev/api/v1/sites/${data.siteId}`); console.log(await meta.json()); // Upload a PDF file const pdfForm = new FormData(); pdfForm.append("file", pdfBlob, "document.pdf"); const pdfUpload = await fetch("https://pagedrop.dev/api/v1/sites", { method: "POST", body: pdfForm }); console.log(await pdfUpload.json()); // Upload a ZIP file const formData = new FormData(); formData.append("file", zipFileBlob, "project.zip"); const upload = await fetch("https://pagedrop.dev/api/v1/sites", { method: "POST", body: formData }); console.log(await upload.json()); // Delete a site await fetch(`https://pagedrop.dev/api/v1/sites/${data.siteId}`, { method: "DELETE", headers: { "X-Delete-Token": data.deleteToken } }); ``` -------------------------------- ### Success Response for Site Creation Source: https://pagedrop.dev/docs This JSON structure represents a successful site creation, detailing the site's ID, URL, delete token, expiration, associated files, and size. ```json { "status": "success", "data": { "created": [ { "siteId": "page-one", "url": "https://pagedrop.dev/s/page-one", "deleteToken": "dlt_abc123...", "expiresAt": "2026-03-20T12:00:00.000Z", "files": ["index.html"], "totalSizeBytes": 22 }, { "siteId": "a1b2c3d4", "url": "https://pagedrop.dev/s/a1b2c3d4", "deleteToken": "dlt_def456...", "expiresAt": null, "files": ["index.html"], "totalSizeBytes": 150 }, { "siteId": "e5f6g7h8", "url": "https://pagedrop.dev/s/e5f6g7h8", "deleteToken": "dlt_ghi789...", "expiresAt": null, "files": ["index.html"], "totalSizeBytes": 24 } ], "failed": [], "totalCreated": 3, "totalFailed": 0 } } ``` -------------------------------- ### Site Creation Success Response Source: https://pagedrop.dev/docs A successful response after creating a site includes the `siteId`, `url`, and a crucial `deleteToken`. Save the `deleteToken` as it's only provided once and is necessary for future updates or deletions. ```json { "status": "success", "data": { "siteId": "a1b2c3d4", "url": "https://pagedrop.dev/s/a1b2c3d4", "deleteToken": "dlt_e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8", "expiresAt": null, "ttlDays": null, "files": ["index.html"], "totalSizeBytes": 1234, "viewCount": 0, "createdAt": "2026-02-17T12:00:00.000Z", "passwordProtected": false } } ``` -------------------------------- ### Success Response for Site Forking Source: https://pagedrop.dev/docs This JSON confirms a successful site fork operation, providing the new site's ID, URL, delete token, expiration, file list, size, and the ID of the original site it was forked from. ```json { "status": "success", "data": { "siteId": "my-remix", "url": "https://pagedrop.dev/s/my-remix", "deleteToken": "dlt_...", "expiresAt": null, "files": ["index.html"], "totalSizeBytes": 42, "forkedFrom": "abc123", "createdAt": "2026-03-17T..." } } ``` -------------------------------- ### Initialize Application Insights Telemetry Source: https://pagedrop.dev/docs Configures and loads the Azure Application Insights SDK for monitoring. ```javascript !(function (cfg){function e(){cfg.onInit&&cfg.onInit(n)}var x,w,D,t,E,n,C=window,O=document,b=C.location,q="script",I="ingestionendpoint",L="disableExceptionTracking",j="ai.device.";"instrumentationKey"[x="toLowerCase"](),w="crossOrigin",D="POST",t="appInsightsSDK",E=cfg.name||"appInsights",(cfg.name||C[t])&&(C[t]=E),n=C[E]||function(g){var f=!1,m=!1,h={initialize:!0,queue:[],sv:"8",version:2,config:g};function v(e,t){var n={},i="Browser";function a(e){e=""+e;return 1===e.length?"0"+e:e}return n[j+"id"]=i[x](),n[j+"type"]=i,n["ai.operation.name"]=b&&b.pathname||"_unknown_",n["ai.internal.sdkVersion"]="javascript:snippet_"+(h.sv||h.version),{time:(i=new Date).getUTCFullYear()+"-"+a(1+i.getUTCMonth())+"-"+a(i.getUTCDate())+"T"+a(i.getUTCHours())+":"+a(i.getUTCMinutes())+":"+a(i.getUTCSeconds())+"."+(i.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z",iKey:e,name:"Microsoft.ApplicationInsights."+e.replace(/-/g,"")+"."+t,sampleRate:100,tags:n,data:{baseData:{ver:2}},ver:undefined,seq:"1",aiDataContract:undefined}}var n,i,t,a,y=-1,T=0,S=["js.monitor.azure.com","js.cdn.applicationinsights.io","js.cdn.monitor.azure.com","js0.cdn.applicationinsights.io","js0.cdn.monitor.azure.com","js2.cdn.applicationinsights.io","js2.cdn.monitor.azure.com","az416426.vo.msecnd.net"],o=g.url||cfg.src,r=function(){return s(o,null)};function s(d,t){if((n=navigator)&&(~(n=(n.userAgent||"").toLowerCase()).indexOf("msie")||~n.indexOf("trident/"))&&~d.indexOf("ai.3")&&(d=d.replace(/(\/)(ai\.3\.)([^\d]*)$/,function(e,t,n){return t+"ai.2"+n})),!1!==cfg.cr)for(var e=0;e