{"openapi":"3.0.3","info":{"title":"Page API","version":"1.0.0","description":"HTTP API for https://yourspage.com (product name Page). Authenticated routes use the Clerk browser session cookie named __session. Page does not issue an API key, and these routes do not accept an Authorization bearer token. Errors are JSON objects with error.code, error.message, and error.hint. Successful response bodies are unchanged from the app the browser already uses. This document omits internal routes: POST /api/e (analytics beacon), GET /api/cron/daily (CRON_SECRET bearer), POST /api/webhooks/clerk, POST /api/webhooks/dodo, and the Cloudflare DNS browser redirects at /api/domains/cloudflare/start and /api/domains/cloudflare/callback."},"servers":[{"url":"https://yourspage.com","description":"Production"}],"tags":[{"name":"Usernames","description":"Check whether a public page name is free."},{"name":"Contacts","description":"Download a contact card from a public page."},{"name":"Account","description":"Routes that require the signed-in owner's Clerk session."},{"name":"Files","description":"Uploads, PDF bytes, and emailed product downloads."}],"paths":{"/api/username":{"get":{"tags":["Usernames"],"operationId":"checkUsername","summary":"Check whether a page name is available","description":"Returns whether a public page username can be claimed. Format problems and names that are already taken respond with HTTP 200 and available false, plus a reason. Only the rate limit uses an error status. The check is limited to 60 requests per client IP per 60 seconds. No session is required.","security":[],"parameters":[{"name":"u","in":"query","required":false,"description":"Username to check. It is trimmed, lowercased, and a leading @ is removed. 2 to 30 characters: letters, numbers, dots, dashes, and underscores. It must start and end with a letter or number, and it cannot be a reserved route name.","schema":{"type":"string","minLength":1,"maxLength":40}}],"responses":{"200":{"description":"The name was checked. available false is a normal answer, not a failure.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsernameCheck"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"The caller has checked names too many times. available and reason are still present so the claim form can show the message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsernameRateLimited"}}}}}}},"/api/vcard":{"get":{"tags":["Contacts"],"operationId":"downloadVcard","summary":"Download a public contact card","description":"Downloads the vCard 3.0 file for a visible CONTACT block on a live page. The Save contact button on a public page links here. No session is required. Limited to 60 requests per client IP per 60 seconds. A missing block, a suspended page, or a page without access all use the same not_found error.","security":[],"parameters":[{"name":"b","in":"query","required":true,"description":"Id of the CONTACT block.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"vCard 3.0 file for the contact.","headers":{"Content-Disposition":{"description":"Attachment filename derived from the contact name.","schema":{"type":"string"}}},"content":{"text/vcard":{"schema":{"$ref":"#/components/schemas/VcardFile"}}}},"404":{"description":"No downloadable contact exists for that block id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Too many requests from this client. Wait, then retry. A Retry-After header may be set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/stats/live":{"get":{"tags":["Account"],"operationId":"getLiveActivity","summary":"Read live visitors on the active page","description":"Returns who is on the signed-in owner's active page right now, the latest views and clicks, and per-minute counts. The active page is the Clerk user's current workspace (the page_active cookie, otherwise the stored active page, otherwise their most recently updated page). The response is not cached.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Live activity for the active page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiveActivity"}}}},"401":{"description":"The Clerk session is missing or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"The signed-in user does not have a page yet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/export/page":{"get":{"tags":["Account"],"operationId":"exportPage","summary":"Download the active page as JSON","description":"Downloads the signed-in owner's active page, theme, and blocks as a JSON file. This is the owner's copy: block data can include private fields such as uploaded file keys. The body is pretty-printed JSON with an attachment filename of {username}-page.json.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Page export file.","headers":{"Content-Disposition":{"description":"attachment; filename=\"{username}-page.json\"","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageExport"}}}},"401":{"description":"The Clerk session is missing, expired, or the user has no active page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/export/analytics":{"get":{"tags":["Account"],"operationId":"exportAnalytics","summary":"Download analytics events as CSV","description":"Streams analytics events for the signed-in owner's active page as CSV, up to 500,000 rows. A missing range means all time. An unrecognized range is treated as 30 days. The header row is time_utc,type,link,source,referrer,country,city,device,browser,os,utm_source,utm_medium,utm_campaign.","security":[{"clerkSession":[]}],"parameters":[{"name":"range","in":"query","required":false,"description":"Window of events to include. Omitted means all time. Any other value means the last 30 days.","schema":{"type":"string","enum":["7d","30d","90d","all"]}}],"responses":{"200":{"description":"CSV attachment named {username}-analytics-{range}.csv.","headers":{"Content-Disposition":{"description":"attachment; filename=\"{username}-analytics-{range}.csv\"","schema":{"type":"string"}}},"content":{"text/csv":{"schema":{"$ref":"#/components/schemas/AnalyticsCsv"}}}},"401":{"description":"The Clerk session is missing, expired, or the user has no active page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/export/products":{"get":{"tags":["Account"],"operationId":"exportProductLeads","summary":"Download product lead emails as CSV","description":"Streams people who requested a file on the signed-in owner's active page, up to 100,000 rows. The header row is time_utc,product,name,email,wants_updates. wants_updates is yes or no.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"CSV attachment named {username}-products.csv.","headers":{"Content-Disposition":{"description":"attachment; filename=\"{username}-products.csv\"","schema":{"type":"string"}}},"content":{"text/csv":{"schema":{"$ref":"#/components/schemas/ProductLeadsCsv"}}}},"401":{"description":"The Clerk session is missing, expired, or the user has no active page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/product-upload":{"post":{"tags":["Files"],"operationId":"uploadProductFile","summary":"Upload a product or PDF file","description":"Stores a file for the signed-in owner. The editor posts the raw bytes here. The file name query decides the allowed type, not the Content-Type header. Maximum size is 100 MB. Limited to 30 uploads per user per hour. Returns a private storage key the editor then saves onto a product or PDF block. This is not a public file URL.","security":[{"clerkSession":[]}],"parameters":[{"name":"name","in":"query","required":true,"description":"Original file name, including the extension. Allowed extensions include pdf, epub, zip, txt, csv, md, Office documents, common audio and video types, and png, jpg, jpeg, webp, gif.","schema":{"type":"string","minLength":1,"maxLength":200}}],"requestBody":{"required":true,"description":"Raw file bytes. Content-Length must be between 1 and 104857600 (100 MB).","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"The file was stored. Save fileKey onto the block.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoredFile"}}}},"400":{"description":"The file name, type, or size failed the product file check, or the storage key could not be created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"The Clerk session is missing, expired, or the user has no active page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"Content-Length is missing, not a positive number, or greater than 100 MB.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Too many requests from this client. Wait, then retry. A Retry-After header may be set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Storage accepted the request but could not write the object. Retry the upload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"503":{"description":"Object storage is not configured on this server, so uploads are off.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/product/{token}":{"get":{"tags":["Files"],"operationId":"downloadProductFile","summary":"Open an emailed product download link","description":"Redirects a signed product-email link to a short-lived file URL. The token is the credential. No Clerk session is required. Limited to 40 downloads per client IP per hour. A bad, expired, or mismatched token uses the same not_found error as a removed file.","security":[],"parameters":[{"name":"token","in":"path","required":true,"description":"Signed download token from the product email. Maximum length 2000 characters.","schema":{"type":"string","minLength":1,"maxLength":2000}}],"responses":{"302":{"description":"Redirect to a short-lived URL for the file.","headers":{"Location":{"description":"Presigned file URL. Follow it to download the bytes.","schema":{"type":"string","format":"uri"}}}},"404":{"description":"The link is invalid, expired, or the file is no longer on the page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Too many requests from this client. Wait, then retry. A Retry-After header may be set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/pdf/mine":{"parameters":[{"name":"key","in":"query","required":true,"description":"Private storage key returned by uploadProductFile. It must belong to the signed-in user.","schema":{"type":"string","minLength":1}},{"name":"name","in":"query","required":false,"description":"Download filename. Defaults to document.pdf.","schema":{"type":"string"}},{"name":"download","in":"query","required":false,"description":"Pass 1 to set Content-Disposition to attachment. Any other value, or omitting it, inlines the PDF.","schema":{"type":"string","enum":["1"]}}],"get":{"tags":["Files"],"operationId":"readOwnPdf","summary":"Read a PDF the owner uploaded","description":"Returns the PDF bytes for a file the signed-in user uploaded, including a file that is not public yet. The editor preview uses this. Limited to 120 reads per user per hour. Files larger than 32 MB can still be downloaded with download=1, but inline preview returns payload_too_large.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"PDF bytes.","content":{"application/pdf":{"schema":{"$ref":"#/components/schemas/PdfBytes"}}}},"401":{"description":"The Clerk session is missing or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"The key is missing, not owned by this user, or the object is not a PDF.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"The PDF is larger than 33554432 bytes and download=1 was not set, so it cannot be previewed inline.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Too many requests from this client. Wait, then retry. A Retry-After header may be set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"head":{"tags":["Files"],"operationId":"probeOwnPdf","summary":"Read headers for a PDF the owner uploaded","description":"Same authorization and errors as readOwnPdf, with an empty body and the PDF response headers when the file can be read.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Headers for the PDF, with an empty body.","content":{"application/pdf":{"schema":{"$ref":"#/components/schemas/PdfBytes"}}}},"401":{"description":"The Clerk session is missing or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"The key is missing, not owned by this user, or the object is not a PDF.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"The PDF is larger than 33554432 bytes and download=1 was not set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Too many requests from this client. Wait, then retry. A Retry-After header may be set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/pdf/{pageId}/{blockId}":{"parameters":[{"name":"pageId","in":"path","required":true,"description":"Public page id. 8 to 40 letters or digits.","schema":{"type":"string","minLength":8,"maxLength":40,"pattern":"^[A-Za-z0-9]+$"}},{"name":"blockId","in":"path","required":true,"description":"PDF block id. Up to 64 URL-safe characters.","schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9_-]+$"}},{"name":"download","in":"query","required":false,"description":"Pass 1 to download the file. Omit it to preview inline.","schema":{"type":"string","enum":["1"]}},{"name":"pdf_open","in":"cookie","required":false,"description":"Set after the visitor enters the correct password on the public page. Required only when that PDF block has a password. Unlock lasts 12 hours.","schema":{"type":"string"}}],"get":{"tags":["Files"],"operationId":"readPublicPdf","summary":"Read a PDF published on a page","description":"Returns the PDF bytes for a visible PDF block on a live page. No Clerk session is required. If the block has a password, the pdf_open cookie from the public page unlock is required. Limited to 80 reads per client IP per hour. Inline preview refuses files over 32 MB; download=1 still returns those bytes when the file exists.","security":[],"responses":{"200":{"description":"PDF bytes.","content":{"application/pdf":{"schema":{"$ref":"#/components/schemas/PdfBytes"}}}},"401":{"description":"This PDF has a password and the pdf_open cookie does not unlock it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"The page or block is missing, hidden, suspended, or the object is not a PDF.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"The PDF is larger than 33554432 bytes and download=1 was not set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Too many requests from this client. Wait, then retry. A Retry-After header may be set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"head":{"tags":["Files"],"operationId":"probePublicPdf","summary":"Read headers for a published PDF","description":"Same rules and errors as readPublicPdf, with an empty body and the PDF response headers when the file can be read.","security":[],"responses":{"200":{"description":"Headers for the PDF, with an empty body.","content":{"application/pdf":{"schema":{"$ref":"#/components/schemas/PdfBytes"}}}},"401":{"description":"This PDF has a password and the pdf_open cookie does not unlock it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"The page or block is missing, hidden, suspended, or the object is not a PDF.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"405":{"description":"That HTTP method is not implemented on this path. The Allow header lists the methods that are.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"413":{"description":"The PDF is larger than 33554432 bytes and download=1 was not set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"429":{"description":"Too many requests from this client. Wait, then retry. A Retry-After header may be set.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"components":{"securitySchemes":{"clerkSession":{"type":"apiKey","in":"cookie","name":"__session","description":"Clerk browser session cookie. A signed-in visit to yourspage.com sets it. Send the same cookie jar the browser uses. There is no API key and no bearer token for these routes."}},"schemas":{"ErrorObject":{"type":"object","additionalProperties":false,"required":["code","message","hint"],"properties":{"code":{"type":"string","description":"Stable machine-readable code. Match on this, not on the message.","enum":["unauthorized","not_found","page_not_found","method_not_allowed","rate_limited","invalid_file","payload_too_large","uploads_disabled","storage_failed","password_required"]},"message":{"type":"string","description":"Human-readable explanation."},"hint":{"type":"string","description":"What the caller should do next."}}},"ApiError":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"$ref":"#/components/schemas/ErrorObject"}},"example":{"error":{"code":"unauthorized","message":"Sign in first.","hint":"Sign in, then call this endpoint again."}}},"UsernameCheck":{"type":"object","additionalProperties":false,"required":["available"],"properties":{"available":{"type":"boolean","description":"True only when the name can be claimed right now."},"reason":{"type":"string","description":"Present when available is false. Explains the format problem or that the name is taken."}}},"UsernameRateLimited":{"type":"object","additionalProperties":false,"required":["available","reason","error"],"properties":{"available":{"type":"boolean","enum":[false]},"reason":{"type":"string","description":"Same sentence as error.message, kept for the claim form."},"error":{"$ref":"#/components/schemas/ErrorObject"}}},"VcardFile":{"type":"string","description":"RFC 6350 vCard 3.0 text, including FN and N, plus ORG, TEL, EMAIL, and URL when the block has them."},"LiveActivity":{"type":"object","additionalProperties":false,"required":["here","recent","minutes"],"properties":{"here":{"type":"integer","minimum":0,"description":"Distinct visitors with a view or click in the last 5 minutes."},"recent":{"type":"array","maxItems":14,"items":{"$ref":"#/components/schemas/LiveEvent"}},"minutes":{"type":"array","description":"One object per minute of the recent window, currently 30 minutes, oldest first.","items":{"$ref":"#/components/schemas/LiveMinute"}}}},"LiveEvent":{"type":"object","additionalProperties":false,"required":["id","type","blockId","country","city","source","createdAt","label"],"properties":{"id":{"type":"string"},"type":{"type":"string","enum":["VIEW","CLICK"]},"blockId":{"type":"string","nullable":true},"country":{"type":"string","nullable":true,"description":"ISO country code, when known."},"city":{"type":"string","nullable":true},"source":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"label":{"type":"string","nullable":true,"description":"Block label, or null when the event is not tied to a block."}}},"LiveMinute":{"type":"object","additionalProperties":false,"required":["at","views","clicks"],"properties":{"at":{"type":"string","format":"date-time","description":"ISO start of the minute."},"views":{"type":"integer","minimum":0},"clicks":{"type":"integer","minimum":0}}},"PageExport":{"type":"object","additionalProperties":false,"required":["format","exportedAt","page","blocks"],"properties":{"format":{"type":"string","enum":["page-page@1"]},"exportedAt":{"type":"string","format":"date-time"},"page":{"$ref":"#/components/schemas/ExportedPage"},"blocks":{"type":"array","items":{"$ref":"#/components/schemas/Block"}}}},"ExportedPage":{"type":"object","additionalProperties":false,"required":["username","displayName","bio","avatarUrl","bannerUrl","bannerY","showBadge","theme","customDomain"],"properties":{"username":{"type":"string"},"displayName":{"type":"string"},"bio":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"bannerUrl":{"type":"string","nullable":true},"bannerY":{"type":"integer","minimum":0,"maximum":100,"description":"0 is the top of the banner, 100 is the bottom."},"showBadge":{"type":"boolean"},"theme":{"$ref":"#/components/schemas/ThemeSettings"},"customDomain":{"type":"string","nullable":true,"description":"Verified hostname, or null when the page has no verified domain."}}},"ThemeSettings":{"type":"object","description":"Saved theme. Unset color and type fields fall back to the preset.","properties":{"preset":{"type":"string","maxLength":32},"accent":{"type":"string","nullable":true,"pattern":"^#([0-9a-fA-F]{6})$"},"background":{"type":"string","nullable":true,"pattern":"^#([0-9a-fA-F]{6})$"},"card":{"type":"string","nullable":true,"pattern":"^#([0-9a-fA-F]{6})$"},"font":{"type":"string","nullable":true,"enum":["figtree","fraunces","instrument","bricolage","mono","nunito"]},"fontSize":{"type":"string","nullable":true,"enum":["sm","md","lg","xl"]},"buttonShape":{"type":"string","nullable":true,"enum":["pill","rounded","square"]},"buttonStyle":{"type":"string","nullable":true,"enum":["solid","soft","outline","hard"]},"avatarShape":{"type":"string","nullable":true,"enum":["circle","rounded","square"]},"motion":{"type":"object","description":"Optional motion settings saved with the theme.","additionalProperties":true}}},"Block":{"type":"object","additionalProperties":false,"required":["id","type","visible","data"],"properties":{"id":{"type":"string"},"type":{"type":"string","enum":["LINK","CARD","SOCIALS","HEADING","TEXT","EMBED","IMAGE","GALLERY","FAQ","STATS","DISCOUNT","CONTACT","EVENTS","GITHUB","SKILLS","EXPERIENCE","PRODUCT","COURSE","COMMUNITY","MAP","PDF"]},"visible":{"type":"boolean"},"data":{"type":"object","description":"Payload for this block type. The owner export can include private fields such as file keys.","additionalProperties":true}}},"AnalyticsCsv":{"type":"string","description":"UTF-8 CSV. Header: time_utc,type,link,source,referrer,country,city,device,browser,os,utm_source,utm_medium,utm_campaign. type is view or click."},"ProductLeadsCsv":{"type":"string","description":"UTF-8 CSV. Header: time_utc,product,name,email,wants_updates. wants_updates is yes or no."},"StoredFile":{"type":"object","additionalProperties":false,"required":["fileKey","fileName","fileBytes","fileType"],"properties":{"fileKey":{"type":"string","description":"Private storage key. Not a public URL."},"fileName":{"type":"string"},"fileBytes":{"type":"integer","minimum":1},"fileType":{"type":"string","description":"Media type chosen from the file name."}}},"PdfBytes":{"type":"string","format":"binary","description":"PDF bytes. HEAD responses use the same content type and an empty body."}}}}