The Pagehaus API
Scripts, apps and AI agents can manage your sites over HTTP: list, read, upload and delete files, unpack a zip, check usage and create sites. Everything goes through the same limits, virus scanning and checks as the dashboard.
Get a token
Go to Account → API, give the token a name and choose what it can reach:
- One site, read only: list and read files.
- One site, read and write: also upload and delete files.
- All my sites: read and write every site, and create new ones.
The token is shown once. Keep it like a password: in an environment variable, not in your site's files. You can see when each token was last used, and revoke it at any time.
export PAGEHAUS_TOKEN=ph_...
Examples
All requests go to https://pagehaus.app/api/v1 with the token in an Authorization header. Paths always
start at the top of the site, like /index.html.
# Upload (or replace) a file. Folders are created as needed.
curl -X PUT -H "Authorization: Bearer $PAGEHAUS_TOKEN" --data-binary @index.html \
"https://pagehaus.app/api/v1/sites/yoursite/files/content?path=/index.html"
# Read a file
curl -H "Authorization: Bearer $PAGEHAUS_TOKEN" "https://pagehaus.app/api/v1/sites/yoursite/files/content?path=/index.html"
# List a folder
curl -H "Authorization: Bearer $PAGEHAUS_TOKEN" "https://pagehaus.app/api/v1/sites/yoursite/files?path=/"
# Delete a file (or an empty folder)
curl -X DELETE -H "Authorization: Bearer $PAGEHAUS_TOKEN" "https://pagehaus.app/api/v1/sites/yoursite/files?path=/old.html"
# Upload a zip and unpack it into a folder
curl -X POST -H "Authorization: Bearer $PAGEHAUS_TOKEN" --data-binary @site.zip "https://pagehaus.app/api/v1/sites/yoursite/zip?path=/"
Endpoints
| Request | What it does |
|---|---|
GET /me | The token's name, access, expiry and your plan |
GET /sites | The sites this token can use, with their addresses |
POST /sites | Create a site: {"name": "mysite"}. Whole-account tokens only. |
GET /sites/{name}/files?path= | List a folder |
GET /sites/{name}/files/content?path= | Read a file |
PUT /sites/{name}/files/content?path= | Create or replace a file; the body is the file |
DELETE /sites/{name}/files?path= | Delete a file, or a folder once it's empty |
POST /sites/{name}/zip?path= | Unpack a zip into a folder; the body is the zip |
GET /sites/{name}/usage | Storage, files and folders, and traffic against your plan |
Errors and limits
Errors come back as JSON with a message you can show to a person, such as
{"error": "This token is read-only."}:
400: something to fix, such as a bad path, a full plan or a file type your plan doesn't allow.401: the token is missing, wrong, revoked or expired, or your email address isn't confirmed yet.403: the token can't do that, or the site is suspended.404: no such site, file or folder for this token.409: a folder where a file was expected (or the reverse), or a folder that isn't empty.422: the file was removed because it contains malware.429: slow down. Each token can make 600 reads and 60 changes a minute, and 2,000 changes a day. An account can create 5 sites a day through the API.
Changes to one account are made one at a time, and every change is listed under Account → API.
Using it with an AI agent
Most assistants are easiest to connect with MCP: see Connect an AI assistant. Agents that can run commands can also use SFTP; see Let an AI agent manage your site.