public-it

REST API

Everything the dashboard does, the API does: create sites, publish HTML, manage versions and domains. Base URL: https://public-it.com/api — JSON in and out.

Authentication

Use an API key in the header (create one at Dashboard → API & MCP):

Authorization: Bearer pit_your_key_here

Example: publish an artifact

# 1. Create the site (once) curl -X POST https://public-it.com/api/sites \ -H "Authorization: Bearer pit_..." \ -H "Content-Type: application/json" \ -d '{"name": "My Dashboard", "subdomain": "my-dashboard"}' # 2. Publish the HTML (every publish = new version) curl -X POST https://public-it.com/api/sites/SITE_ID/publish \ -H "Authorization: Bearer pit_..." \ -H "Content-Type: application/json" \ -d '{"type": "inline", "html": "<!DOCTYPE html><html>...</html>"}' # → { "publication": { "version": 1, "status": "live" }, # "url": "https://my-dashboard.public-it.com" }

Endpoints

MethodRouteDescription
GET/api/sitesList the user's sites.
POST/api/sitesCreate a site.
{ "name": "Meu site", "subdomain": "meu-site" }
GET/api/sites/:idGet one site.
DELETE/api/sites/:idDelete a site, its versions and files (irreversible).
POST/api/sites/:id/publishPublish inline HTML (new live version) or finalize a ZIP upload.
{ "type": "inline", "html": "<!DOCTYPE html>..." }
POST/api/sites/:id/publicationsStart a ZIP publication (validates quota/paths; returns the upload prefix).
{ "files": [{ "path": "index.html", "size": 1234 }] }
GET/api/sites/:id/publicationsVersion history of the site.
POST/api/sites/:id/rollbackRestore an archived version (paid plans).
{ "publicationId": "uuid" }
GET/api/sites/:id/domainCustom-domain status (expected TXT/CNAME).
POST/api/sites/:id/domainConnect a custom domain (paid plans).
{ "domain": "meusite.com" }
POST/api/sites/:id/domain/verifyVerify the domain DNS (TXT) and activate it.
GET/api/meThe user's plan and usage (sites, storage, traffic).
GET/api/keysList active API keys.
POST/api/keysCreate an API key (the full value is shown only once).
{ "name": "minha-chave" }
DELETE/api/keys/:idRevoke a key.

Errors

Every failure uses the same envelope:

{ "error": { "code": "quota_exceeded", "message": "Your Free plan allows up to 1 site(s)..." } }
StatusCodeWhen
401unauthorized / invalid_api_keyMissing header, invalid or revoked key
402quota_exceeded / plan_requiredPlan quota reached or paid-plan feature
404not_foundResource doesn't exist or belongs to another user
409subdomain_taken / domain_takenAddress already in use
400validation_errorInvalid request body

Limits

Sites, storage (shared across the account's sites) and monthly traffic vary by plan — see the plans. Inline HTML up to 5 MB per publish; ZIPs up to 2,000 files.