Upload file
Changed onStores a file via multipart upload and returns a download link. Only safe file types accepted; a missing or wrong extension is corrected from the content and reported in notices. Reuse existing owner token to group entities under one owner. An HTML or Markdown file is published as a page in any namespace, with or without a password (same rules and limits as POST /api/html). 'format' decides; without one a known extension, then a specific declared part type (text/html, text/markdown, application/json, text/csv), then a content guess; otherwise it stays an inert file. '.txt' without 'format' stays a text file. A whole HTML document sent as 'markdown' is an HTML page. Any readable encoding is stored as UTF-8, notice 'charset-guessed' when no usable charset was named. link and ownerLink point to the page, notice 'html-file-as-page' or 'markdown-file-as-page'; a code format chosen by 'format' or the declared type is published the same way, notice 'file-format-applied'. An HTML file over the page size limit or that no encoding reads is stored as a file and shown as source, notice 'html-file-as-source'. A JSON file in the public namespace is stored as sent, notice 'json-file-not-listed'; JSON data belongs in POST /api/json. Secrets allowed; likely ones are flagged in notices. To share a password or key: POST /api/secrets (client-side encrypted one-time link).
Request
- Base URLhttps://brewpage.app
- Auth
- none
- or API key in header X-Owner-Token
Query parameters
Send ns=public for anything meant to be found or shared (docs, guides, demos, portfolios, reports, landing pages): listed in the public gallery and sitemap, so Google, Bing and AI search index it and people discover it. Public pages are served on the brewpage.app domain itself, for the strongest search reach; code that needs its own origin (cookies, storage) gets its own subdomain automatically. Anyone can find and read a public page: never put secrets, tokens or personal data there. No ns (default): private. Unlisted and not indexed; anyone who has the link can still open it. Lowercase only.
Comma-separated tags
Format of a page published from this file: decides over the file name. Unknown values are ignored.
TTL in days: up to 30 days without an account, up to 90 with a free profile (send its X-Owner-Token); a default applies when ttl is omitted. Accepts whole days: 15, 15d, 15 days.
For an HTML file published as a page: store it exactly as sent. By default a whole HTML page pasted from a chat (wrapped in a code block, surrounded by chat text, or entity-escaped) is restored and a notice is returned; 'true' keeps the text as is.
Optional. Readable name for the public link of the new page, site or file, e.g. my-recipes (query parameter or form/multipart field; 6-20 lowercase letters, digits and hyphens with at least one letter). Needs ns=public and an X-Owner-Token added to a free BrewPage profile. The publication is always created; on success the answer carries linkName and link is https://brewpage.app/public/{linkName} (or https://{linkName}.brewpage.app/ on its own address). Otherwise it keeps its random link and one notice says why the name was not set: link-name-needs-account, link-name-unavailable, link-name-invalid, link-name-public-only, link-name-paused or link-name-limited. Updates ignore it (notice link-name-ignored): use POST /api/{type}/public/{id}/link-name.
Headers
Access password. Empty = public file visible in gallery. With password = hidden from gallery; readers unlock the publication or use X-Password for API access
Reuse existing owner token to group entities under one owner. If omitted, a new token is generated
Request body multipart/form-data
File part; any single file part is accepted when 'file' is absent
Response
File uploaded, or HTML or Markdown file published as a page. Header X-Existing-Resource: 1 when an existing publication with the same content was returned
Upload result. For a file published as a page (notice 'html-file-as-page', 'markdown-file-as-page' or 'file-format-applied') id, link and ownerLink belong to that page; manage it via /api/html
Unique 10-character alphanumeric file ID, or the page ID when the HTML file was published as a page
Original filename as uploaded
Detected MIME type (e.g. image/png); the page type (text/html, text/markdown) for a file published as a page
Stored size in bytes; for a published page the page size (UTF-8 BOM removed)
Primary URL returned for browser download and sharing
API URL for programmatic access (delete); /api/html/{ns}/{id} for a published page
Owner token: keep it (cannot be recovered; show it to the user on request); send it as X-Owner-Token on later publishes and updates. Absent when result.extras.isOwner is false
Publication outcome: code, action and optional reason. Action merged means an existing publication was returned instead of a new one.
Link access in words, e.g. 'Public: listed in the gallery and sitemap; search engines can index it.' (public html, site and file add an unlist hint), 'Public: anyone with the link. Not listed.' (public json, kv, json pages, json and html files), 'Private: not listed. Only via your unique private link.' or 'Password: link + password.'
Management link, full control of this one publication. Give it to the user with the link; it is private, never post it publicly. Present only when minted.
true = listed in the gallery and sitemap now (public, no password, not hidden).
false = never listed in the gallery whatever the namespace (JSON and KV, JSON pages, HTML and JSON files); listing does not apply
Owner: POST {"listed":false|true} here to unlist or list. Link unchanged.
Owner only: true if this upload replaced your stored page; else absent.
public: html, site and file listed in gallery and sitemap. unlisted: private, not listed. protected: link + password.
Why this mode is in effect:'policy:subdomain-required', 'policy:mode-locked', 'policy:classic-link', 'policy:version-stale', 'policy:republish-keeps-mode', 'policy:custom-domain-attached' or 'policy:state-declared'. Absent when nothing applies.
Human-readable explanation of deliveryModeReason. Absent whenever deliveryModeReason is absent.
Link name of this public page, site or file; null = its random link. Absent when link names are not available.
Advisories about the request or its result; omitted when none.
Changes
- info
added the new optional
queryrequest parameterlinkName - info
added the optional property
levelto the response with the status - info
added the optional property
levelto the response with the status
4 more changes in this revision
- info