pagehive

upload_files

Upload up to 20 files to the draft as one draft version.

Draft contentChanges dataAll plans

What it does

Upload up to 20 files to the draft as one draft version. Each item in files has name and one of source_url (a public https link Pagehive downloads) or content_base64; the same names, types and checks as upload_file apply. Downloads run two at a time; all files together may hold at most 100 MB. If any item fails nothing is written, and details.errors lists each failure with its index, field, reason and message. A name already on the site is replaced. Optional base_version must equal the current draft version, or the call fails with validation_failed reason version_conflict. The whole call counts as one API call. uploaded in the response lists each file (name, url, content_type, size_bytes, sha256) in the order sent; files lists what changed in the draft, as for every write. Visitors see nothing until publish_site.

Plans

Works on every plan: Free, Basic, Pro and Ultra.

Parameters

NameTypeAbout
site_idrequiredstringThe id of the site. list_sites gives the ids of your sites.
filesrequiredarray of objectsUp to 20 files, each { name, source_url } or { name, content_base64 }. Names follow upload_file.
base_versionintegerOptional: the current draft version. Another number fails with version_conflict.
messagestringA short note for the version history, like a commit message.
verbosebooleantrue lists every file and page of the draft. Otherwise the response lists only what this call changed, plus draft totals.

Example

Call upload_files with these arguments:

{
  "site_id": "01a1…",
  "files": [
    {
      "name": "hero.webp",
      "source_url": "https://example.com/hero.webp"
    },
    {
      "name": "team.jpg",
      "source_url": "https://example.com/team.jpg"
    }
  ]
}

Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.

Related guides